How new fungible token is minted?

When I mint A fungible token is a new object created or has the property of the fungible token object (like address to balance mapping) changed?

3 Likes

Hi @tahlil, the answer is (kind of) both!

If you mint a new Coin<C> for some type C that you own the TreasuryCap<C> for, you will both get a new Coin<C> object and you will update the total supply field in TreasuryCap<C>. This is done using coin::mint:

There’s also a variant of this function – coin::mint_balance – which updates the total supply field, but creates a Balance<C> value, instead of Coin<C>, which is not an Object. You can later convert that balance into a coin, if you like.

Note that the only thing that we are updating in the centralised TreasuryCap<C> is the total supply – there is no global address to balance mapping.

3 Likes