pub trait Funder: Send + Sync {
// Required method
fn recover(&self, remaining: U256) -> SourceFuture<'_, Recovery>;
// Provided method
fn pool_spent(&self) -> Option<U256> { ... }
}Expand description
The injected funding recovery seam (ADR 003 § Funding recovery). Wraps the
deployment’s funding path (the CLI’s CliFunder and the node’s
NodeFunder, each over its own chain handle), so the acquire loop and
[BlobSource] never name a contract instance.
The acquire loop calls recover only when its candidate
set is exhausted with at least one source priced out, and only when the
progress rule allows a step: the first step of a fetch always, a further
step only after a newly verified byte. That rule, not the funder, bounds how
often one fetch adds funds.
Required Methods§
Sourcefn recover(&self, remaining: U256) -> SourceFuture<'_, Recovery>
fn recover(&self, remaining: U256) -> SourceFuture<'_, Recovery>
Run one funding recovery step. remaining is the pool’s spendable
deposit as the caller sees it (deposit less every lane’s spend).
A self-funded owner tops its current pool up toward its sized deposit.
A pool that is Closing or Closed refuses the top-up, and the owner
opens a new pool at its normal deposit and makes it current instead
(Recovery::Replaced). A pool that already holds its sized deposit and
still accepts funds needs no top-up: the step settles at its deposit
(Recovery::ToppedUp), so the caller asks the nodes again. A buyer with
no way to add funds returns Recovery::Unavailable.
§Errors
If the on-chain topUp or openPool fails to submit or reverts: the
funds did not move. If a topUp submit fails in transport or its
receipt is not obtained, the funds may have moved and the error carries
crate::buyer_pool::TopUpUnconfirmed. If a mined transaction cannot be
credited locally, the funds are escrowed and the error names the tx
(crate::buyer_pool::escrowed_but_untracked).
Provided Methods§
Sourcefn pool_spent(&self) -> Option<U256>
fn pool_spent(&self) -> Option<U256>
The funder’s own view of what the pool has spent across every lane, including lanes the acquire loop does not drive: vouchers to providers outside the fetch (or the run). The deposit gate takes the larger of this and the committed amounts of the loop’s own lanes, so a pool shared across many providers gates on its true remaining deposit.
None by default: the funder has no view beyond the loop’s lanes.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".