This document reflects the escrow API currently implemented in
contracts/escrow/src/lib.rs.
initialize(admin)is single-use and requiresadmin.require_auth().- Pause and emergency controls require the stored admin's authorization.
- Mutating lifecycle calls fail while paused or in emergency mode.
create_contractrequires client authorization, rejects identical client/freelancer addresses, rejects empty or non-positive milestones, caps milestone count, and caps total escrow value.deposit_fundsrejects non-positive amounts, repeat exact-total deposits, exact-total mismatches, and incremental overfunding.release_milestonerequirescaller.require_auth(), enforces the contract'sReleaseAuthorizationmode (ClientOnly, ArbiterOnly, ClientAndArbiter, or MultiSig), and checks valid non-expired approvals before releasing funds. MultiSig requires both client and freelancer approvals viacheck_approvals, and release may be triggered only by the stored client or freelancer.issue_reputationrequires the stored client as caller, matching freelancer, completed status, rating in1..=5, and no prior reputation issuance for the contract.cancel_contractrequires client or freelancer authorization and rejects completed or already-cancelled contracts.finalize_contractrequires client, freelancer, or assigned arbiter authorization, is allowed only fromCompletedorDisputed, and locks future contract-specific mutations withAlreadyFinalized.- Aggregate amount math uses checked helpers where totals are accumulated.
- Balance-changing operations verify the core accounting invariant:
total_deposited == released_amount + refunded_amount + available_balance. - Finalization summaries use checked arithmetic and persistent storage. They do not expire through TTL and do not create, deduct, or withdraw protocol fees.
- The contract records escrow accounting only. Token custody, token transfers,
and atomic asset movement are outside
lib.rsand must be handled by a separate audited integration. - Admin transfer, protocol fees, refunds, approval expiry, and storage migration are not implemented public entrypoints.
ReadinessChecklist.governed_params_setexists, but no live governance parameter entrypoint sets it totrue.
- Two-step admin transfer: #318
- Protocol fee accounting and withdrawal: #313, #314
- Immutable finalization: #320
- Governed parameter setter/readiness wiring: #323
- Structured deposit and fee events: #336
- Canonical storage-key reference: #342
- Verify no integration guide treats planned entrypoints as live API.
- Verify pause/emergency blocks every mutating lifecycle call.
- Verify duplicate release, duplicate reputation issuance, overfunding, and invalid amount paths fail closed.
- Verify off-chain token transfer integrations are atomic or idempotent with respect to escrow state changes.