Custom Tokens should emit a mint event when the token is minted #1584
Replies: 8 comments 17 replies
-
Should we define a new Currently the SEP proposes we only require the |
Beta Was this translation helpful? Give feedback.
-
In the proposal it states that SEP-41 Tokens include a sep0011_asset:String, however that is not part of SEP-41, but is a bespoke part of CAP-46-6 that is specific to SAC tokens. I think this proposal should remove the sep0011_asset from what's required in the mint function. The SAC may add additional Stellar Asset specific details to the mint function as it does today, but tokens shouldn't be required to provide it just as they are not required to provide it for transfer and burn events. |
Beta Was this translation helpful? Give feedback.
-
After doing some research I've found that all non SAC custom tokens currently do emit the PR updating SEP-41 |
Beta Was this translation helpful? Give feedback.
-
SEP-41 purposefully doesn't specify the admin interface. Adding the mint event to it is currently meaningless, as it doesn't define the mint function in the first place. If we want to go for the admin-driven interface, it should probably be specified in a new SEP, with all the functions and events. That said, please do keep in mind that not every token can/will implement it - e.g. a token can be minted automatically based on certain conditions (e.g. mint NFT once on initialization), or require a quorum of admins to mint it etc. This is the reason for why minting is not a part of SEP-41. In the hindsight it seems like it might have been better to not have admin in the mint event at all. That would make it compatible with pretty much any minting procedure. But I'm not sure if we can fix this now. |
Beta Was this translation helpful? Give feedback.
-
StellarExpert currently supports We tried rely purely on events for balances calculation, but it proved to be a bad idea -- people tend to generate whatever events they like, disregarding the internal logic. This leads to negative balances or some impossible numbers, not fitting into u256. |
Beta Was this translation helpful? Give feedback.
-
that is a good insight on current day challenge for downstream ingestion to accurately process contract events, as downstream ingestion depends on contracts adhering to the larger expected event lifecycle of an app protocol, otherwise the events are less valuable.
As contract growth takes place, more of these events are coming, exacerbating the challenge for application ingestion to understand how to parse them accurately. There is a separate CAP discussion #1596, would be great if you have chance to review/share insights further. It is exploring ideas for how contract code can assert the app protocol(s) it implements by |
Beta Was this translation helpful? Give feedback.
-
It seems like the discussion has slowed down. Are we in favor of adding a
|
Beta Was this translation helpful? Give feedback.
-
Each token standard should define its own set of events. If SEP-41 doesn't have an event w.r.t. mint, then it seems like a gap in SEP-41. That |
Beta Was this translation helpful? Give feedback.
-
Preamble
Simple Summary
Custom smart contract tokens should be required to send a
mint
contract event when the new token is minted/initialized. Same as the SAC token minting.Dependencies
Related to
Motivation
Currently custom smart contract tokens have a token interface defined in SEP-41. This interface defines the standard for functions such as transferring and burning the token but does not define a function nor set a standard for minting the token. There is currently no requirement to emit the
mint
event like how SACs do. This means that a contract can create a token without a definitive "source" contract event. Without this event it becomes difficult to track the full history of the custom tokens movement as well as the initial amount of the token.The only events required are
transfer
andburn
from SEP-41Without the
mint
event there would be no guaranteed way to know the initial balance of the minted token in the addressIt is possible to look up the
to:Address
through the contract data entries but it is not guaranteed that entry amount without invoking thebalance()
function. This is problematic becausebalance()
may have never been called and the way the balance is stored in the contract data entry is not standardized.With the
mint
event it is easy to track the full history of custom token balances from inception. This would be similar to how Ethereum ERC20 balances are tracked with traces (Dune's balance calculation methodology).The end goal is to have a history of events like so:
With these events you can clearly track the custom token balance for
Address1
,Address2
,Address3
, andAddress4
.Abstract
Enable balance tracking of smart contract custom tokens through contract events by requiring
mint
events on custom token mint wherever the contract decides to do the minting (this SEP does not define a new interface function for minting).Specification
The
mint
event is unchanged and follows the same format as currently defined:The
mint
event must be emitted when the custom token is minted/initialized. Similarly to how themint()
function from cap-46-06 emits the eventDesign Rationale
This SEP has purposely not added an
mint()
norinit_asset()
function to give contracts more flexibility. The theory is that a contract should be free to define how they want to mint a new custom token. There doesn't need to be an standard single initialization function. There are existing contracts that have aninitialize()
function that does emit themint
event. By not adding a minting function to the interface, these existing contracts with be compliant with this SEP without changes.Alternatively this SEP can propose a
mint()
or some initialization function. Or this can be proposed in a future SEP when a clear need is found.Security Concerns
N/A
Changelog
v0.1.0
: Initial draft.Beta Was this translation helpful? Give feedback.
All reactions