Closes #248 Closes #249 Closes #250 Closes #251
This change introduces enterprise utilities for fleet-wide streaming caps, peer-to-peer energy exchange, device liveness with slashing, and grid shortage load-shedding using a tier–epoch pattern. It also fixes Soroban contract metadata limits (export = false where needed), completes the DataKey / ContractError surface, and wires fleet accounting into stream create, pause, resume, rate updates, depletion, and amicable close.
- Persistent
FleetStateaggregate underDataKey::FleetAgg(provider); cap underFleetCap(provider). create_continuous_streamenforcessum + new_rate ≤ cap(saturated i128 math);set_provider_fleet_cap(super admin or DAO governor) updates cap and emits a limit event.- Fleet total is updated on stream create, pause, resume, flow rate change, depletion, and amicable close. Lowering the cap does not terminate existing streams.
p2p_finalize_exchangeenforces distinct supplier/consumer, optional credit vault and battery cap, and routes grid fee in bps to the utility treasury. Emits a P2P finalization event for indexers.
stream_device_heartbeatwith ed25519 over(stream_id || meter_id)payload; last ledger in temporaryStreamLastHeartbeat.apply_liveness_slash(proportionate) andpardon_stream_livenessfor provider pardon flow.
ProviderGridEpochper provider;grid_shortage_load_shedincrements epoch and floor tier (grid admin only). Streams compare tier vs epoch lazily; Critical cannot be shed by policy.set_grid_administrator/set_dao_governorfor governance wiring.
- Adds
contracts/Cargo.tomlworkspace soutility_contractsandprice_oracleresolvesoroban-sdkfrom[workspace.dependencies].
- Resolve remaining compiler errors outside this surface (ZK helpers, legacy meter fields in some branches) until
cargo build -p utility_contractsis fully green. - Add integration tests for 100-stream fleet cap breach and 24h P2P scenarios once the crate builds cleanly.