pub struct Escrow {
pub job_id: u64,
pub requester_did: u64,
pub provider_did: u64,
pub amount_micro_units: u64,
pub provider_ilp: String,
pub use_nym: bool,
pub state: EscrowState,
}Expand description
An escrow for one paid job.
Fields§
§job_id: u64§requester_did: u64§provider_did: u64§amount_micro_units: u64§provider_ilp: StringWhere the provider is paid if verified (an ILP payment pointer / address).
use_nym: bool§state: EscrowStateImplementations§
Source§impl Escrow
impl Escrow
Sourcepub fn offer(
job_id: u64,
requester_did: u64,
provider_did: u64,
amount_micro_units: u64,
provider_ilp: impl Into<String>,
use_nym: bool,
) -> Self
pub fn offer( job_id: u64, requester_did: u64, provider_did: u64, amount_micro_units: u64, provider_ilp: impl Into<String>, use_nym: bool, ) -> Self
Open an escrow in the Offered state for an agreed price.
Sourcepub fn hold(&mut self) -> Result<(), SwarmError>
pub fn hold(&mut self) -> Result<(), SwarmError>
Commit the funds to escrow (Offered → Held). Tracked only — no transfer.
Sourcepub fn settle(
&mut self,
verdict: VerificationVerdict,
) -> Result<SettlementOutcome, SwarmError>
pub fn settle( &mut self, verdict: VerificationVerdict, ) -> Result<SettlementOutcome, SwarmError>
Settle the escrow according to a verification verdict. Must be Held.
Verified→ReleasedToProvider, returns the provider payment instruction.Rejected→RefundedToRequester, returns a refund (no provider payment).
This is the only path to a provider payment, and it is impossible to reach
without a Verified verdict.
Trait Implementations§
impl StructuralPartialEq for Escrow
Auto Trait Implementations§
impl Freeze for Escrow
impl RefUnwindSafe for Escrow
impl Send for Escrow
impl Sync for Escrow
impl Unpin for Escrow
impl UnsafeUnpin for Escrow
impl UnwindSafe for Escrow
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more