sui
sui copied to clipboard
[framework] Emits coin::CreatedCurrency metadata + compiles book examples
- Implements suggestion from #4551. Now call to
create_currencyemitscoin::CreatedCurrencyevent. - Adds code from examples book to framework tests (this way we make sure they always compile)
Closes #4551
Shouldn't this need to specify the
decimalsforSUIsomewhere?
Nice catch. SUI is created through balance and we don’t have a TC for it, balance::Supply<SUI> is stored inside the SuiSystem.
I wonder if we should eventually instantiate SUI with an OTW but that’s def gonna be tricky.
This change introduces a whole set of questions related to balances (as in not Coins).
But I believe that we should keep these features for Coins while preserving the balance module’s simplicity. Happy to hear your thoughts @sblackshear!
I didn't realize that there is no TC for Sui--I think it's useful to have one + put it inside SuiSystem in case there are future governance proposals that require (e.g.) burning Sui.
In terms of coin vs balance vs supply, I must admit I still don't have a great understanding of when a programmer would use each of these three (probably a good topic for a future doc on coins and fungible tokens). But in the absence of other info, I would imagine that decimals and other token metadata would be relevant for all three of these.
@sblackshear since we know that sui::SUI is a special case in verifier and can be constructed outside initializer, I’ll submit a patch to return TC instead of Supply in a couple days.
@sblackshear Sorry for the delay. SUI is now initialized through coin::create_currency.