Escrow is optional. When enabled, it links a participant's queue position to a payment hold so funds are handled by contract rules rather than manual operator discretion.
- Hold deposits only for queues that explicitly require escrow.
- Make release, refund, and expiry conditions auditable.
- Prevent operators from taking funds before the participant is served.
- Give participants a recovery path when a queue stalls or is cancelled.
- Avoid storing personal or payment-sensitive metadata on-chain.
| State | Description | Terminal |
|---|---|---|
Active |
Deposit is held for a participant and queue. | No |
Released |
Funds were released to the operator because the participant was served. | Yes |
Refunded |
Funds were returned to the participant. | Yes |
Expired |
Recovery period elapsed and funds are recoverable through the configured expiry path. | Yes |
deposit
|
v
Active
|----------- release -----------> Released
|----------- refund ------------> Refunded
|----------- expire ------------> Expired
- Queue configuration declares that escrow is required.
- Participant enrolls or begins enrollment.
- Participant deposits the configured asset and amount.
- Escrow contract validates amount bounds, queue ID, identity, and authorization.
- Escrow record becomes
Active. - Event consumers index the deposit for participant and operator dashboards.
Release should happen only when the participant is served or the queue rules define an equivalent successful outcome.
- Queue advancement marks the participant position as advanced or serviceable.
- Escrow release is invoked by the authorized operator or by the queue integration path supported by the contract version.
- Escrow contract checks the record is
Active. - Funds transfer to the configured recipient.
- Escrow record becomes
Released. - A release event is emitted.
Refunds cover cancellation, failed service, policy-defined withdrawal, or operator action after a queue closes without serving the participant.
- Refund path is invoked for an
Activeescrow record. - Contract validates authorization and queue policy.
- Funds return to the participant.
- Escrow record becomes
Refunded. - A refund event is emitted.
Expiry is a participant protection path. It should be available when the configured hold period elapses and no release or refund has occurred.
- Participant or authorized automation invokes expiry.
- Contract compares current ledger time with the record's expiry time.
- Funds become recoverable according to the contract version.
- Escrow record becomes
Expired. - An expiry event is emitted.
asset: asset contract or native asset identifier.amount: required deposit amount.minDepositandmaxDeposit: bounds for flexible deposit policies.recipient: operator or treasury address for released funds.holdPeriod: maximum time a deposit can remain active without release or refund.refundPolicy: reason codes and authorization rules for refunds.
- A terminal escrow record cannot return to
Active. - An escrow record cannot be released and refunded.
- A release must correspond to a valid queue outcome.
- A refund must return funds to the participant identity associated with the record.
- Expiry must not be available before the configured time.
The current scaffold documents the desired escrow state machine and includes an initial Soroban escrow crate. Before production use, maintainers should add integration tests that exercise queue advancement and escrow release/refund together, not only as isolated contract calls.