Skip to content
Discussion options

You must be logged in to vote

The intent is to ensure that a coin can ever be initialized once as that is how all the capabilities (burn, freeze, mint) are generated.

Specifically,

assert!(
    coin_address<CoinType>() == account_addr,
    error::invalid_argument(ECOIN_INFO_ADDRESS_MISMATCH),
);

prevents anyone other than the actual account that publishes CoinType from initializing it.

The next bit of code ensures it can only be initialized once:

assert!(
    !exists<CoinInfo<CoinType>>(account_addr),
    error::already_exists(ECOIN_INFO_ALREADY_PUBLISHED),
);

Replies: 1 comment

Comment options

0x-j
Mar 6, 2024
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by 0x-j
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
move Questions related to the Move Language
1 participant