Skip to content

feat: escrow module — multisig approvals, time-lock & rate limiting (#288) - #320

Open
A6dulmalik wants to merge 2 commits into
StellAIverse:mainfrom
A6dulmalik:feat/288-escrow-multisig-timelock
Open

feat: escrow module — multisig approvals, time-lock & rate limiting (#288)#320
A6dulmalik wants to merge 2 commits into
StellAIverse:mainfrom
A6dulmalik:feat/288-escrow-multisig-timelock

Conversation

@A6dulmalik

Copy link
Copy Markdown
Contributor

Closes #288

Summary

New contracts/escrow Soroban crate implementing the full escrow module:

  • M-of-N multisig: configurable signer set (max 20) and approval threshold; admins can add/remove signers (with threshold auto-adjustment guards), change the threshold, time-lock delay, grace period, rate limit, and pause/unpause.
  • Time-lock + grace period: queued transactions unlock after timelock_delay seconds and remain executable for grace_period; afterwards they expire and become cancellable by anyone (garbage collection).
  • Multiple instances: create_escrow(token, is_native, purpose) mints independent purpose-specific escrow ids with per-instance balance accounting. Token escrows move SAC/ERC20-style tokens via TokenClient; native escrows account internally.
  • Queue/cancel: signers or admins queue withdrawals (submitter counts as first approver); admin/submitter may cancel pre-execution.
  • Rate limiting: sliding-window cap on executions both globally and per recipient, pruning old timestamps on each execution.
  • AccessControl integration: optionally link an AccessControl contract at init; holders of its Admin role can administer escrow settings through a cross-contract has_role call.
  • Events on every state transition.

Validation

  • cargo clippy -p escrow --all-targets: 0 errors / 0 warnings
  • cargo fmt applied
  • 15 unit tests: init validation (thresholds, dupes, zero params), token+native deposits, M-of-N approve/revoke flows, time-lock boundaries, grace expiry + third-party cancel, cancel permissions, rate-limit saturation + window reset, pause gating, signer management bounds, AC-role delegation, close/deposit rejection, multi-instance isolation, view lookups

A6dulmalik and others added 2 commits August 22, 2026 20:04
…g (issue StellAIverse#288)

- Escrow contract: configurable M-of-N signer approvals with admin
  management (add/remove signers, threshold, time-lock, grace period,
  rate limit, pause) all adjustable post-init
- Multiple purpose-specific escrow instances (token or native with
  internal accounting)
- Transaction queueing with submitter-as-first-approver; permissionless
  keeper execution gated by approvals + time-lock + grace window
- Cancellation by admin/submitter anytime, by anyone after grace lapse
- Sliding-window rate limiting per recipient and globally
- Optional AccessControl integration: linked contract's Admin role can
  administer escrow via cross-contract has_role call
- Events on init, deposits, queueing, approval, execution, cancellation,
  pause, config changes
- 15 unit tests covering happy paths, all error branches and edge cases
@devIKargi

Copy link
Copy Markdown
Contributor

Weldone @A6dulmalik just run `Cargo fmt' and push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Module: Escrow - Multi-Signature and Time-Lock Contracts

2 participants