sui icon indicating copy to clipboard operation
sui copied to clipboard

[framework] Emits coin::CreatedCurrency metadata + compiles book examples

Open damirka opened this issue 3 years ago • 3 comments

  • Implements suggestion from #4551. Now call to create_currency emits coin::CreatedCurrency event.
  • Adds code from examples book to framework tests (this way we make sure they always compile)

Closes #4551

damirka avatar Sep 11 '22 21:09 damirka

Shouldn't this need to specify the decimals for SUI somewhere?

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.

damirka avatar Sep 12 '22 08:09 damirka

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!

damirka avatar Sep 12 '22 08:09 damirka

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 avatar Sep 12 '22 15:09 sblackshear

@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.

damirka avatar Sep 18 '22 22:09 damirka

@sblackshear Sorry for the delay. SUI is now initialized through coin::create_currency.

damirka avatar Sep 28 '22 12:09 damirka