Full refund of all funded milestones. Admin only.
fn refund(env: soroban_sdk::Env, deal_id: u64) -> Result<(), EscrowError>
Deposit funds for a specific milestone. Client transfers tokens from their wallet to this contract.
fn deposit(
env: soroban_sdk::Env,
deal_id: u64,
milestone_idx: u32,
) -> Result<(), EscrowError>
Raise a dispute on a funded milestone. Freezes funds. Can be called by either client or provider.
fn dispute(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
deal_id: u64,
milestone_idx: u32,
) -> Result<(), EscrowError>
Get deal details by ID.
fn get_deal(env: soroban_sdk::Env, deal_id: u64) -> Result
Fund all currently pending milestones in a single client payment. Releases, disputes, and refunds still operate per milestone.
fn fund_deal(env: soroban_sdk::Env, deal_id: u64) -> Result<(), EscrowError>
Initialize the contract with admin and protocol wallet addresses. Must be called once before any other function.
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
protocol_wallet: soroban_sdk::Address,
) -> Result<(), EscrowError>
Create a new deal with defined participants, splits, and milestones.
platform_fee_bps: platform fee in basis points (1000 = 10%)connector_share_bps: connector's share of the platform fee in bps (4000 = 40%)milestone_amounts: vector of amounts for each milestone (in token units)fn create_deal(
env: soroban_sdk::Env,
client: soroban_sdk::Address,
provider: soroban_sdk::Address,
connector: soroban_sdk::Address,
token_addr: soroban_sdk::Address,
platform_fee_bps: u32,
connector_share_bps: u32,
milestone_amounts: soroban_sdk::Vec,
) -> Result
Get total number of deals created.
fn get_deal_count(env: soroban_sdk::Env) -> Result
Get provider's on-chain reputation (completed deal count).
fn get_reputation(env: soroban_sdk::Env, provider: soroban_sdk::Address) -> u64
Resolve a dispute. Admin splits funds between client and provider.
refund_bps: percentage to refund client (5000 = 50%)
fn resolve_dispute(
env: soroban_sdk::Env,
deal_id: u64,
milestone_idx: u32,
refund_bps: u32,
) -> Result<(), EscrowError>
Release a funded milestone with atomic 3-way split.
Split logic (mirrors The Signal's approveMilestone):
fn release_milestone(
env: soroban_sdk::Env,
deal_id: u64,
milestone_idx: u32,
) -> Result<(), EscrowError>