Skip to main content

Module settlement

Module settlement 

Source
Expand description

Escrow + settlement — the money side, gated on verification, and incapable of moving funds itself.

An Escrow is a small state machine over the agreed price. It is funded (Offered → Held), then settled (Held → ReleasedToProvider | RefundedToRequester) only by a verification verdict. On Verified it emits a MicropaymentInstruction addressed to the provider; on Rejected it emits a refund and no provider payment. Emitting an instruction is not the same as executing it: the actual transfer is performed by the separate crate::ilp_dispatcher rail, under human authorisation. Nothing here touches a wallet, a connector, or the network.

The money arithmetic (fair-price cap, energy viability) reuses crate::modalities::value_flow — the single source of truth — rather than re-implementing it.

Structs§

Escrow
An escrow for one paid job.

Enums§

EscrowState
Escrow lifecycle. A job is paid only by passing left-to-right through Verified.
SettlementOutcome
What settlement produced. A Pay carries an instruction for the existing ILP rail; a Refund carries nothing payable.

Functions§

energy_viable
The solar-excess viability gate: a paid job should only be dispatched to an energy-supplier node if the value returned justifies the energy spent — E-ROI at or above min_ratio. Below the floor the job is net-extractive and must be refused. Reuses eroi_viable (the thermodynamic cost cap).
price_paid_job
Fair price for a paid job: the audited production (energy) cost plus a capped ROI margin (the extraction guard), via commons_cost. The price never exceeds production_cost × (1 + max_roi%).