Expand description
Chain-agnostic withdrawal queue types and pure logic functions.
This module provides data structures for pending withdrawals and pure functions for queue logic. Storage implementation is left to chain-specific executors (NEAR, Soroban, etc.).
Re-exports§
pub use crate::state::vault::MAX_PENDING;
Structs§
- Pending
Withdrawal - A pending withdrawal request in the queue.
- Pending
Withdrawals - Queue
Status - Aggregate status of the entire withdrawal queue.
- Withdraw
Queue - Withdrawal queue storage with FIFO ordering.
- Withdrawal
Request Status - Status information for a single withdrawal request in the queue.
- Withdrawal
Result - Result of attempting to satisfy a withdrawal from available assets.
Enums§
- Queue
Error - Errors that can occur during queue operations.
Constants§
- DEFAULT_
COOLDOWN_ NS - Default cooldown period in nanoseconds (24 hours). Withdrawals cannot be processed until this time has elapsed.
- MAX_
QUEUE_ LENGTH - Maximum queue length before rejecting new requests.
- MIN_
WITHDRAWAL_ ASSETS - Minimum withdrawal amount in base asset units to prevent dust. Withdrawals below this threshold should be rejected.
Functions§
- can_
enqueue - can_
partially_ satisfy - Check if a withdrawal can be partially satisfied.
- can_
satisfy_ withdrawal - Check if a withdrawal can be satisfied given available assets.
- compute_
full_ withdrawal - Compute the withdrawal result for a fully satisfied withdrawal.
- compute_
idle_ settlement - compute_
partial_ withdrawal - Compute the withdrawal result for a partial withdrawal.
- compute_
queue_ status - Compute aggregate queue status from an iterator of withdrawals.
- compute_
settlement - Compute escrow settlement when completing a withdrawal.
- compute_
settlement_ by_ price - Compute settlement using share price (WAD-scaled).
- count_
satisfiable - Calculate how many withdrawals can be fully satisfied from a queue.
- find_
request_ status - Find a withdrawal request’s status by owner.
- is_
past_ cooldown - is_
valid_ withdrawal_ amount