Sigil documentation
ReferenceRust referencearise-sigil

arise-sigil · escrow

Source declarations, signatures and documentation for escrow.

Source: sigil/node/../arise-bridge/arise-sigil/src/escrow.rs. SHA-256: 68a229eef4dfed78169ae693c122f24c21c7bf98c5d6710f540135ccc6cc3b4a.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

escrow::EscrowOperation

A single escrow operation submitted by a consumer.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EscrowOperation {
/// DID of the consumer initiating the operation.

pub consumer_did: String,
/// Optional org DID if the consumer acts on behalf of an organization.

pub org_did: Option<String>,
/// The escrow operation to execute.

pub operation: EscrowOp
}

Source line: 13.

escrow::EscrowOp

The set of operations that can be performed on an escrow account.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum EscrowOp {
    /// Deposit tokens into the consumer's escrow account.
    Fund {
        /// Amount in micro-MINT to deposit.
        amount: u64,
    },
    /// Reserve tokens for a specific job (locks funds for the provider).
    Reserve {
        /// Unique identifier for the compute job.
        job_id: String,
        /// Amount in micro-MINT to reserve.
        amount: u64,
        /// DID of the provider to whom the reservation is directed.
        provider_did: String,
    },
    /// Settle a completed job, debiting the actual cost from the reservation.
    Settle {
        /// The job being settled.
        job_id: String,
        /// DID of the provider submitting the settlement.
        provider_did: String,
        /// Actual cost incurred in micro-MINT.
        actual_cost: u64,
    },
    /// Refund the full reserved amount for a cancelled or failed job.
    Refund {
        /// The job whose reservation should be refunded.
        job_id: String,
    },
    /// Withdraw available (unreserved) tokens from the escrow account.
    Withdraw {
        /// Amount in micro-MINT to withdraw.
        amount: u64,
    },
}

Source line: 24.

escrow::EscrowAccount

In-memory escrow account for tracking balances during validation.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EscrowAccount {
/// DID of the account owner.

pub consumer_did: String,
/// Total deposited balance in micro-MINT.

pub total_balance: u64,
/// Amount currently reserved for pending jobs.

pub reserved_balance: u64,
/// Per-job reservations. Settlement/refund must address exactly one job.

pub reservations: HashMap<String, EscrowReservation>
}

Source line: 62.

escrow::EscrowReservation

Funds reserved for one compute job.

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct EscrowReservation {
/// Amount reserved in micro-MINT.

pub amount: u64,
/// Provider DID named when the reservation was created.

pub provider_did: String
}

Source line: 75.

escrow::EscrowAccount::new

Creates a new escrow account with zero balance.

pub fn new(consumer_did: String) -> Self;

Source line: 84.

escrow::EscrowAccount::available_balance

Returns the available (unreserved) balance.

pub fn available_balance(&self) -> u64;

Source line: 94.

escrow::EscrowAccount::apply

Applies an escrow operation, returning an error if the operation cannot be performed (e.g. insufficient funds).

pub fn apply(&mut self, op: &EscrowOp) -> Result<(), AriseError>;

Source line: 100.

escrow::EscrowAccount::settle_as_provider

Settles a reservation only when the caller is the provider recorded when funds were reserved for the job.

pub fn settle_as_provider(
        &mut self,
        provider_did: &str,
        job_id: &str,
        actual_cost: u64,
    ) -> Result<(), AriseError>;

Source line: 195.

On this page