Skip to content

Commit d385931

Browse files
committed
feat: add map based sep-41 event definitions
1 parent 3f862c0 commit d385931

1 file changed

Lines changed: 43 additions & 14 deletions

File tree

ecosystem/sep-0041.md

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Title: Soroban Token Interface
66
Authors: Jonathan Jove <@jonjove>, Siddharth Suresh <@sisuresh>, Simon Chow <@chowbao>, Leigh McCulloch <@leighmcculloch>
77
Status: Draft
88
Created: 2023-09-22
9-
Updated: 2025-08-28
10-
Version 0.4.1
9+
Updated: 2026-06-08
10+
Version 0.5.0
1111
Discussion: https://discord.com/channels/897514728459468821/1159937045322547250, https://github.com/stellar/stellar-protocol/discussions/1584
1212
```
1313

@@ -173,6 +173,12 @@ pub trait TokenInterface {
173173

174174
### Events
175175

176+
Token events support two data formats. The original data format is the format
177+
defined by earlier versions of this SEP. The map data format encodes the event
178+
data as a `Map` with `Symbol` keys, and may contain additional keys beyond
179+
those defined in this SEP. Event consumers must be able to handle keys they do
180+
not recognize, and are expected to support both formats.
181+
176182
#### Approve Event
177183

178184
The `approve` event is emitted when the allowance is set.
@@ -183,10 +189,17 @@ The event has topics:
183189
- `Address` the address holding the balance of tokens to be drawn from.
184190
- `Address` the address spending the tokens held by `from`.
185191

186-
The event has data:
192+
The event's original data format is:
193+
194+
- `Vec` containing
195+
- `i128` the amount allowed to be spent.
196+
- `u32` the expiration ledger.
197+
198+
The event's map data format is:
187199

188-
- `i128` the amount allowed to be spent.
189-
- `u32` the expiration ledger.
200+
- `Map` containing entries with `Symbol` keys, and values defined as
201+
- `amount: i128` the amount allowed to be spent.
202+
- `live_until_ledger: u32` the expiration ledger.
190203

191204
#### Transfer Event
192205

@@ -199,15 +212,17 @@ The event has topics:
199212
- `Address` the address holding the balance of tokens that was drawn from.
200213
- `Address` the address that received the tokens.
201214

202-
The event has data:
215+
The event's original data format is:
203216

204217
- `i128` the amount transferred.
205-
- or `map` containing entries with `Symbol` keys, and values defined as
206-
- `amount: i128` the amount minted.
218+
219+
The event's map data format is:
220+
221+
- `Map` containing entries with `Symbol` keys, and values defined as
222+
- `amount: i128` the amount transferred.
207223
- `to_muxed_id: Option<u64 | String | BytesN<32>>` void, or entry absent, if
208224
no muxed ID, or the u64 muxed ID, or for historical legacy reasons, the
209225
string or bytes memo for Stellar assets.
210-
- Other entries allowed as defined by the implementation.
211226

212227
#### Burn Event
213228

@@ -218,10 +233,15 @@ The event has topics:
218233
- `Symbol` with value `"burn"`
219234
- `Address` the address holding the balance of tokens that was burned.
220235

221-
The event has data:
236+
The event's original data format is:
222237

223238
- `i128` the amount burned.
224239

240+
The event's map data format is:
241+
242+
- `Map` containing entries with `Symbol` keys, and values defined as
243+
- `amount: i128` the amount burned.
244+
225245
#### Mint Event
226246

227247
The `mint` event is emitted when an amount of the token is minted.
@@ -234,15 +254,17 @@ The event has topics:
234254
- `Symbol` with value `"mint"`
235255
- `Address` the address to hold the newly minted tokens.
236256

237-
The event has data:
257+
The event's original data format is:
238258

239259
- `i128` the amount minted.
240-
- or `map` containing entries with `Symbol` keys, and values defined as
260+
261+
The event's map data format is:
262+
263+
- `Map` containing entries with `Symbol` keys, and values defined as
241264
- `amount: i128` the amount minted.
242265
- `to_muxed_id: Option<u64 | String | BytesN<32>>` void, or entry absent, if
243266
no muxed ID, or the u64 muxed ID, or for historical legacy reasons, the
244267
string or bytes memo for Stellar assets.
245-
- Other entries allowed as defined by the implementation.
246268

247269
#### Clawback Event
248270

@@ -259,10 +281,15 @@ The event has topics:
259281
- `Address` The address holding the balance from which the clawback will take
260282
tokens.
261283

262-
The event has data:
284+
The event's original data format is:
263285

264286
- `i128` the amount clawed back.
265287

288+
The event's map data format is:
289+
290+
- `Map` containing entries with `Symbol` keys, and values defined as
291+
- `amount: i128` the amount clawed back.
292+
266293
### Mint and Clawback Event Flexibility
267294

268295
This SEP has purposely not added `mint()`, `init_asset()`, nor `clawback()`
@@ -283,6 +310,8 @@ and a clawback action that emits a clawback event must reduce total supply.
283310
- `v0.4.0` - Add muxed support to transfer, and mint.
284311
- `v0.4.1` - Clarify that clawback burns tokens reducing total supply and that
285312
no separate burn or transfer event is emitted alongside the clawback event.
313+
- `v0.5.0` - Document the original and map data formats for all events,
314+
generalizing the form already used by `transfer` and `mint`.
286315

287316
## Implementations
288317

0 commit comments

Comments
 (0)