Contract ac3db046c2be39ef53ab43465311aaa82144a72d43b12135acd22a8962978f46

← Back to Index 📥 Download WASM

Meta

rssdkver 21.7.7#5da789c50b18a4c2be53394138212fed56f0dfc4
rsver 1.97.0

Instances

  • CAL4TZHXCLR57W2WUY5IKY7HPQ3ALWWCGOYFQRFLUBPLCBZXKNBNQWQJ

Interface

Bump contract instance TTL (anyone can call)

fn bump(env: soroban_sdk::Env)

Buyer deposits tokens into the escrow contract. Transfers (amount + fee) from buyer to contract.

fn fund(env: soroban_sdk::Env, escrow_id: u64) -> Result<(), EscrowError>

Cancel an escrow that was never funded.

fn cancel(env: soroban_sdk::Env, escrow_id: u64) -> Result<(), EscrowError>

Either buyer or seller can raise a dispute while funded.

fn dispute(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    escrow_id: u64,
) -> Result<(), EscrowError>

Buyer releases funds to the seller (trade completed). Seller receives the escrowed amount. Fee is sent to the treasury address (or stays in contract if no treasury set).

fn release(env: soroban_sdk::Env, escrow_id: u64) -> Result<(), EscrowError>

Arbiter resolves a dispute. release_to_seller = true sends to seller, otherwise refunds the buyer.

fn resolve(
    env: soroban_sdk::Env,
    escrow_id: u64,
    release_to_seller: bool,
) -> Result<(), EscrowError>

Update fee (admin only)

fn set_fee(env: soroban_sdk::Env, new_fee_bps: u32) -> Result<(), EscrowError>

Get escrow details by ID

fn get_escrow(
    env: soroban_sdk::Env,
    escrow_id: u64,
) -> Result

Initialize the escrow contract with an admin and fee rate

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    fee_bps: u32,
) -> Result<(), EscrowError>

Combined create + fund in a single transaction. Buyer calls this to create the escrow AND lock tokens immediately. Requires the buyer to have called approve on the token contract granting this contract a sufficient allowance.

fn create_fund(
    env: soroban_sdk::Env,
    buyer: soroban_sdk::Address,
    seller: soroban_sdk::Address,
    arbiter: soroban_sdk::Address,
    token: soroban_sdk::Address,
    amount: i128,
    deadline_days: u32,
    description_hash: u64,
) -> Result

Set treasury address for fee collection (admin only)

fn set_treasury(
    env: soroban_sdk::Env,
    treasury: soroban_sdk::Address,
) -> Result<(), EscrowError>

Create a new escrow. Buyer specifies seller, arbiter, token, amount and optional deadline (in days, 0 = default 30 days). Tokens are NOT transferred yet — call fund next.

fn create_escrow(
    env: soroban_sdk::Env,
    buyer: soroban_sdk::Address,
    seller: soroban_sdk::Address,
    arbiter: soroban_sdk::Address,
    token: soroban_sdk::Address,
    amount: i128,
    deadline_days: u32,
    description_hash: u64,
) -> Result

Admin withdraws accumulated escrow fees for a given token.

fn withdraw_fees(
    env: soroban_sdk::Env,
    token: soroban_sdk::Address,
    to: soroban_sdk::Address,
) -> Result

If the deadline passes and buyer hasn't released, buyer can reclaim.

fn refund_expired(env: soroban_sdk::Env, escrow_id: u64) -> Result<(), EscrowError>

Get all escrow IDs where caller is the buyer

fn get_buyer_escrows(
    env: soroban_sdk::Env,
    buyer: soroban_sdk::Address,
) -> soroban_sdk::Vec

Get all escrow IDs where caller is the seller

fn get_seller_escrows(
    env: soroban_sdk::Env,
    seller: soroban_sdk::Address,
) -> soroban_sdk::Vec

Imports

WebAssembly Text (WAT) ▶