Extend SEP-41 map-form event data to approve, burn, and clawback
#1916
Replies: 2 comments 1 reply
|
+1 on extending the map form to It's also worth noting that during CAP-67 we discussed this idea and while no consensus was stated explicitly it felt like there was general consensus with the only concern being the performance implication if everyone moved to maps even in the cases amounts were the only value. A few data points from that discussion:
So I think the direction is consistent with prior consensus, and this proposal is a narrower, concrete form of it. One correction on the backwards-compatibility framing:
I don't think this is quite right. Existing on-chain consumers are fine, since no contract logic depends on the shape of event data. SAC is also unaffected since it wouldn't start emitting the map form. But existing off-chain consumers (indexers, wallets, explorers) that only handle the scalar/tuple form will need to be upgraded to process the map form once any custom token starts emitting it. That's the same situation we already accepted for |
|
+1 on the change itself. I think we should keep approve/burn/transfer symmetric with transfer/mint events. One orthogonal concern I want to flag here but not derail the thread on: SEP-41 has now accumulated several in-place interface/event changes since its inception (mint/clawback events, MuxedAddress support, etc). As @leighmcculloch mentioned, there is a cost to downstream data providers because they need to upgrade their service to support the new changes. It's becoming hard to track which revision a given deployed contract has targeted, as well as whether the off-chain consumer supports that given revision. A side effect we're seeing is that parsers are falling back to strict whole-interface conformance checks and dropping otherwise-legitimate tokens because one method signature or one event shape doesn't match the current spec. Contract tokens are gaining popularity, and I think it's time to finalize SEP-41, and figure out better versioning (extend SEP-47) so that off-chain providers have an easier time dispatching changes. I'll open a separate discussion on SEP-41 lifecycle / versioning so we can work that out without blocking this proposal. Will link back once it's up |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
SEP-41 v0.4.1 permits a map-form
datapayload with implementation-defined extra entries ontransferandmint, but restrictsapprove,burn, andclawbackto scalar or tuple data. This asymmetry blocks real integrations — tokens that need to carry additional implementation-specific context.This post proposes extending the same map-form pattern to those three events, fully backwards compatible. It follows up on an exchange in PR #1775, where @leighmcculloch and @dmkozh flagged the topic as worth a separate conversation.
Today's shape
datatransferi128orMap { amount, to_muxed_id?, ... }minti128orMap { amount, to_muxed_id?, ... }approve[i128, u32]burni128clawbacki128Motivating use case
Regulated-asset issuers need administrative events to carry extra context — for example, the actor that triggered a
clawbackor the compliance rule tied to aburn. The workaround today is emitting a parallel custom event per administrative action, which doubles emission cost on-chain and forces downstream indexers to correlate two events where one would do.Proposal
Allow
approve,burn, andclawbackdatato be either:MapwithSymbolkeys whereamount: i128is required (pluslive_until_ledger: u32forapprove), with "other entries allowed as defined by the implementation" — mirroring the language already used fortransferandmint.Backwards compatibility
Although SAC is unaffected and topics are backwards compatible for emitters, existing off-chain consumers (indexers, wallets, explorers) that only handle the scalar/tuple form will need to be upgraded to process the map form once any custom token starts emitting it. That's the same situation we already accepted for
transferandmintin PR #1775, so it's not a new cost.References
Cc @sydneynotthecity
All reactions