Create secure peer-to-peer deals with automatic escrow. Funds are held by the contract until both parties confirm delivery, with built-in dispute and expiry mechanisms.
Peer-to-peer trading with trustless settlement
Freelance payments with delivery confirmation
OTC deals with automatic escrow custody
Buyer creates a deal specifying seller, token, amount, and deadline
Buyer funds the deal (tokens held by the contract)
Seller marks goods/services as delivered
Buyer confirms receipt, releasing funds to the seller
If anything goes wrong, the buyer can dispute or funds auto-return after deadline
Method Parameters Description create_dealseller, token_id, amount, description, deadlineBuyer creates a new deal. Returns deal ID. fund_dealdeal_id: u64Buyer deposits tokens into escrow. mark_delivereddeal_id: u64Seller marks goods as delivered. confirm_receiveddeal_id: u64Buyer confirms receipt. Releases funds to seller. disputedeal_id: u64Buyer flags a dispute on a funded deal. cancel_dealdeal_id: u64Buyer cancels a deal before funding. refund_expireddeal_id: u64Return funds to buyer after deadline passes.
Method Parameters Returns Description get_dealdeal_id: u64DealFull deal details get_deal_count-- u64Total number of deals created
pub enum DealStatus {
Created , // Deal created, not yet funded
Funded , // Buyer deposited tokens
Delivered , // Seller marked as delivered
Completed , // Buyer confirmed, funds released
Disputed , // Buyer raised a dispute
Cancelled , // Deal cancelled before funding
Refunded , // Funds returned after expiry
}
pub struct Deal {
pub id : u64 ,
pub buyer : Address ,
pub seller : Address ,
pub token_id : TokenId ,
pub amount : u128 ,
pub description : String ,
pub status : DealStatus ,
pub created_at : u64 ,
pub funded_at : u64 ,
pub deadline : u64 ,
}
# Deploy
norn wallet deploy-loom --name my-escrow
# Upload bytecode
norn wallet upload-bytecode --loom-id < LOOM_I D > \
--bytecode escrow.wasm
# Execute (borsh-encoded input)
norn wallet execute-loom --loom-id < LOOM_I D > --input < HE X >
# Query a deal
norn wallet query-loom --loom-id < LOOM_I D > --input < HE X >