This document summarizes the public functions exposed by the StellarSettle Soroban contracts.
The payment-distributor contract now implements the settlement/refund fan-out flow used by invoice-escrow when a distributor is configured.
- Sets the distributor admin.
distribute_payment(escrow_contract: Address, invoice_id: Symbol, addresses: Vec<Address>, amounts: Vec<i128>, escrow_status: u32)
- Callable only by the authenticated escrow contract.
addressesmust be[token, seller, funder, admin].amountsmust be[paid_amount, seller_amount, investor_amount, platform_fee].escrow_statusmust representFundedorSettled.- Uses
paid_amountplus internal distribution state to prevent replay or double distribution. - Transfers funds held by
payment-distributorto the seller, funder, and admin.
distribute_refund(escrow_contract: Address, invoice_id: Symbol, addresses: Vec<Address>, amounts: Vec<i128>, escrow_status: u32)
- Callable only by the authenticated escrow contract.
addressesmust be[token, funder].amountsmust be[refund_amount].escrow_statusmust representRefunded.- Refund distribution is one-time per
(escrow_contract, invoice_id).
- Returns the tracked payout progress for an escrow invoice.
paid_distributedis the cumulativepaid_amountalready fanned out.refund_distributedindicates whether the refund leg has already been processed.
- Returns the distributor admin.
payment_distributedrefund_distributedinitialized
invoice-token is the invoice ownership token contract with transfer-lock and pause controls.
initialize(admin, name, symbol, decimals, invoice_id, minter)transfer(from, to, amount)approve(from, spender, amount, expiration_ledger)transfer_from(spender, from, to, amount)burn(from, amount)burn_from(spender, from, amount)mint(to, amount, by)set_transfer_locked(caller, locked)set_minter(new_minter)set_paused(paused)paused() -> booltransfer_locked() -> bool
- When paused, the contract rejects
transfer,approve,transfer_from,burn,burn_from, andmint. - Admin-only config operations such as
set_transfer_locked,set_minter, andset_pausedremain available.
transferapprovemintburntransfer_locked_updatedminter_updatedpaused_updated
invoice-escrow remains the lifecycle orchestrator and now optionally routes settlement/refund payouts through payment-distributor.
initialize(admin: Address, platform_fee_bps: u32)create_escrow(invoice_id, seller, amount, due_date, payment_token, invoice_token)cancel_escrow(invoice_id, seller)fund_escrow(invoice_id, buyer)record_payment(invoice_id, payer, amount)refund(invoice_id)update_platform_fee_bps(new_fee_bps)set_payment_distributor(payment_distributor)set_paused(paused)get_escrow(invoice_id) -> EscrowDataget_config() -> Configget_escrow_status(invoice_id) -> EscrowStatuspaused() -> bool
- If
payment_distributoris configured,record_paymenttransfers the current settlement funds into the distributor and invokesdistribute_payment. - If
payment_distributoris configured,refundtransfers the remaining collateral into the distributor and invokesdistribute_refund. - If no distributor is configured, escrow falls back to the legacy direct-transfer path.
create_escrow(invoice_id: Symbol, seller: Address, debtor: Address, face_value: i128, purchase_price: i128, due_date: u64, payment_token: Address, invoice_token: Address, commitment: BytesN<32>)
Creates an escrow for an invoice with the specified parameters.
- invoice_id: Unique identifier for the invoice.
- seller: Address of the invoice seller (creator of the escrow).
- debtor: Address of the party responsible for paying the invoice.
- face_value: Total amount owed by the debtor (must be > 0).
- purchase_price: Amount the investor will pay to fund the escrow (must be > 0).
- due_date: Unix timestamp when the invoice is due (must be > 0 and > current ledger timestamp).
- payment_token: Address of the token used for payments.
- invoice_token: Address of the invoice token contract.
- commitment: SHA-256 hash of off-chain invoice data (immutable anchor).
Constraints:
- face_value and purchase_price must be positive (> 0)
- due_date must be non-zero and strictly greater than the current ledger timestamp
- Each invoice_id can only be used once
Records a full or partial payment for a funded invoice.
-
amount: Must be
$> 0$ and$\le$ (initial amount - total already paid). - Partial payments distribute the platform fee to the admin, the remainder to the investor, and release a proportional amount of the investor's initial funding to the seller.
- The invoice status transitions to
Settledonly when the total paid matches the invoice amount.
- When paused, the contract rejects lifecycle-changing operations:
create_escrow,cancel_escrow,fund_escrow,record_payment, andrefund. - View functions and admin-only configuration updates remain available.
escrow_createdescrow_fundedpayment_settledescrow_refundedescrow_cancelledplatform_fee_updateddistributor_updatedpaused_updated