Get current nonce for a user Used to get the current nonce before calling functions that require it
fn get_nonce(env: soroban_sdk::Env, user: soroban_sdk::Address) -> u64
fn get_config(env: soroban_sdk::Env) -> Config
fn get_escrow(env: soroban_sdk::Env, escrow_id: u64) -> Result
Initialize contract configuration Can only be called once on deploy (or when empty).
fn __constructor(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
collect_on_create: bool,
) -> Result<(), EscrowError>
Create escrow with guarantee period
fn create_escrow(
env: soroban_sdk::Env,
buyer: soroban_sdk::Address,
seller: soroban_sdk::Address,
amount: i128,
asset: soroban_sdk::Address,
fee_bps: u32,
guarantee_days: u32,
product_id: soroban_sdk::String,
allow_early_release: bool,
) -> Result
Update configuration (only current admin)
fn update_config(
env: soroban_sdk::Env,
new_admin: soroban_sdk::Address,
collect_on_create: bool,
)
Withdraw funds from the contract (admin only)
fn admin_withdraw(
env: soroban_sdk::Env,
asset: soroban_sdk::Address,
amount: i128,
) -> Result<(), EscrowError>
Initiate a dispute on an active escrow
fn dispute_escrow(
env: soroban_sdk::Env,
escrow_id: u64,
caller: soroban_sdk::Address,
nonce: u64,
) -> Result<(), EscrowError>
Refund (only buyer and within guarantee period) Includes nonce for replay attack protection and traceability
fn request_refund(
env: soroban_sdk::Env,
escrow_id: u64,
buyer: soroban_sdk::Address,
nonce: u64,
) -> Result<(), EscrowError>
Release payment to seller (after guarantee period or by seller) Includes nonce for replay attack protection and traceability
fn release_payment(
env: soroban_sdk::Env,
escrow_id: u64,
seller: soroban_sdk::Address,
nonce: u64,
) -> Result<(), EscrowError>
Resolve a disputed escrow when both parties agree
fn resolve_dispute(
env: soroban_sdk::Env,
escrow_id: u64,
caller: soroban_sdk::Address,
nonce: u64,
) -> Result<(), EscrowError>
Check if a token is allowed (public helper function)
fn is_token_allowed(env: soroban_sdk::Env, token: soroban_sdk::Address) -> bool
Add a token to the allowed list (admin only) This ensures only trusted tokens can be used in escrows
fn add_allowed_token(env: soroban_sdk::Env, token: soroban_sdk::Address)
Get the list of allowed tokens (public)
fn get_allowed_tokens(env: soroban_sdk::Env) -> soroban_sdk::Vec
Propose a resolution for a disputed escrow
fn propose_resolution(
env: soroban_sdk::Env,
escrow_id: u64,
caller: soroban_sdk::Address,
nonce: u64,
favor_buyer: bool,
) -> Result<(), EscrowError>
Remove a token from the allowed list (admin only) Note: Existing escrows with this token will still function
fn remove_allowed_token(env: soroban_sdk::Env, token: soroban_sdk::Address)
Admin resolves dispute when parties can't agree
fn admin_resolve_dispute(
env: soroban_sdk::Env,
escrow_id: u64,
favor_buyer: bool,
nonce: u64,
) -> Result<(), EscrowError>