Skip to main content

Public Functions

initialize

Initializes contract state. Can only be invoked once.
  • admin: Account authorized to update fee configs and protocol settings.
  • fee_recipient: Account that collects basis point protocol fees.
  • fee_bps: Protocol fee in basis points (max 1,000 = 10%).

settle_payment

Executes an atomic transfer from payer to merchant, deducting the protocol fee.
  • Reverts with Error::InvalidNonce if nonce != current_nonce + 1.
  • Reverts with Error::ExpiredSignature if env.ledger().timestamp() > valid_until.
  • Invokes token::Client::new(&env, &token).transfer(...) atomically.
  • Emits SettlementReceipt event.
  • Returns the net amount transferred to the merchant (i128).

verify_and_split

Splits a payment across multiple recipients according to basis points.
  • Enforces that the sum of recipient basis points plus protocol fee equals 10,000 (100%).
  • Atomically transfers each recipient’s share.

Read Views


Error Codes (#[contracterror])