Skip to content

Commit 8d9cf20

Browse files
authored
Merge pull request Stellar-IndigoPay#327 from MerlinTheWhiz/feat/emergency-withdrawal-timelock
feat: add emergency withdrawal with 7-day timelock (Stellar-IndigoPay#288)
2 parents 9595bfe + 0fd8ec0 commit 8d9cf20

2 files changed

Lines changed: 574 additions & 1 deletion

File tree

contracts/EVENTS.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,47 @@ This document lists all events emitted by the Stellar IndigoPay Soroban smart co
129129

130130
---
131131

132+
## 13. `ew_init`
133+
134+
**Description**: Emitted when an admin initiates a 7-day timelocked emergency withdrawal.
135+
136+
| Event Name | Topics | Data | When Emitted |
137+
| ---------- | ------------------------------------- | ------------------------------------------------------------------ | --------------------------------------------- |
138+
| `ew_init` | `["ew_init", admin, project_id]` | `{ "new_wallet": Address, "amount": i128, "token": Address, "executable_at": u32 }` | When admin calls `initiate_emergency_withdrawal` |
139+
140+
---
141+
142+
## 14. `ew_exec`
143+
144+
**Description**: Emitted when an emergency withdrawal is executed after the 7-day timelock.
145+
146+
| Event Name | Topics | Data | When Emitted |
147+
| ---------- | --------------------------------- | ------------------------------------------------------ | ------------------------------------------- |
148+
| `ew_exec` | `["ew_exec", project_id]` | `{ "new_wallet": Address, "amount": i128, "token": Address }` | After timelock, funds transferred to new wallet |
149+
150+
---
151+
152+
## 15. `ew_cncl`
153+
154+
**Description**: Emitted when an admin cancels a pending emergency withdrawal.
155+
156+
| Event Name | Topics | Data | When Emitted |
157+
| ---------- | ----------------------------------- | ---- | ------------------------------------------- |
158+
| `ew_cncl` | `["ew_cncl", admin, project_id]` | `()` | When admin calls `cancel_emergency_withdrawal` |
159+
160+
---
161+
132162
## Usage Notes
133163

134164
- All events follow Soroban’s standard event format: `topics: Vec<Val>`, `data: Val`.
135165
- `donor` and `project_id` are usually `Address` or `String` depending on implementation.
136166
- Events can be queried via Horizon or Soroban RPC tools.
137167
- Frontend / backend should listen to these for real-time updates, notifications, and leaderboard.
138168

139-
**Last Updated**: July 17, 2026
169+
**Last Updated**: July 18, 2026
170+
171+
---
172+
173+
## Coordination Note for #277 (Matching Pool)
174+
175+
`DataKey::ProjectContractBalance(String, Address)` is the **canonical per-project per-token balance ledger** for all contract-held funds. Any deposit/matching-pool logic (including #277) **must** increment this key on deposit and decrement it on withdrawal. Do not introduce a parallel balance concept — the compound key already supports multi-token per project. See `SECURITY.md` for the full rationale.

0 commit comments

Comments
 (0)