Contract 8e78074c5db33a5d5392f3db4e5ae349060039fb14aaec349ea88ee8d9031eef

← Back to Index 📥 Download WASM

Meta

rssdkver 26.0.1#f52b6aad85f18c5e312ff3f60e57cb613274e6bb
rsver 1.93.0

Instances

  • CAJ3A27JEGOQEPAQIDJFER3QBEZQKTZJR6OF4MR726IX3NWTW3QUYWT2

Interface

Trader cancels their own active order and reclaims funds.

fn cancel(
    env: soroban_sdk::Env,
    trader: soroban_sdk::Address,
    nullifier: soroban_sdk::BytesN<32>,
)

Anyone can expire an order that has passed its deadline, returning funds to trader.

fn expire(env: soroban_sdk::Env, nullifier: soroban_sdk::BytesN<32>)

Lock trader funds alongside order submission. Called by OrderBook (which the trader authorizes as part of their Soroban tx). Transfers amount of asset from the trader's wallet into this vault.

fn deposit(
    env: soroban_sdk::Env,
    trader: soroban_sdk::Address,
    asset: soroban_sdk::Address,
    amount: i128,
    nullifier: soroban_sdk::BytesN<32>,
    commitment: soroban_sdk::BytesN<32>,
    expires_at: u64,
)

Called ONLY by the Settlement contract. Releases amount of the matched deposit to recipient (the counterparty) and refunds any surplus (deposit − amount) to the original depositor.

The surplus arises in a uniform-price batch auction: a buyer escrows USDC at their limit price but the batch clears at a (better) uniform price, so only amount is owed to the seller — the price-improvement difference must return to the buyer, not leak to the counterparty. The Settlement auth check is non-negotiable — no other caller can release funds.

fn release(
    env: soroban_sdk::Env,
    nullifier: soroban_sdk::BytesN<32>,
    recipient: soroban_sdk::Address,
    amount: i128,
)
fn is_paused(env: soroban_sdk::Env) -> bool

One-time initialization. matching_engine and settlement are the only addresses allowed to call lock_for_settlement() and release() respectively. xlm_token/ usdc_token are the only assets deposit() will accept — see deposit() for why.

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    matching_engine: soroban_sdk::Address,
    settlement: soroban_sdk::Address,
    xlm_token: soroban_sdk::Address,
    usdc_token: soroban_sdk::Address,
)

Admin-only emergency switch. Pausing blocks new deposits only — cancel/expire/release always remain callable so traders can never be locked out of funds already in the vault.

fn set_paused(env: soroban_sdk::Env, admin: soroban_sdk::Address, paused: bool)
fn get_deposit(
    env: soroban_sdk::Env,
    nullifier: soroban_sdk::BytesN<32>,
) -> Option

Called by MatchingEngine when a match is found. Transitions deposit from Active → Matched so it cannot be cancelled.

fn lock_for_settlement(
    env: soroban_sdk::Env,
    nullifier: soroban_sdk::BytesN<32>,
) -> DepositRecord

Imports

WebAssembly Text (WAT) ▶