Open vkomenda opened 3 years ago
Can we make the token amount a u128
in the program? Why is it currently a u64
?
Is there a reason the token program allows creating Mint accounts with 18 decimals? The supply
being an u64
does not leave too much room for practical application of such a token.
I am trying to ming token with decimal 18 and total supply 100,000,000,000. command is not working correctly. There is a same issue!
I am trying to ming token with decimal 18 and total supply 100,000,000,000. command is not working correctly. There is a same issue!
As mentioned above, the token supply
is implemented as a u64
. It can represent at most 18,446,744,073,709,551,615
base units, so if you want 100B total supply, the largest decimals
you can use is 8
Seems like as a start, the CLI could error by default if you're trying to mint more than the max supply, with some sort of yolo
flag to get rid of the check if someone wants to overmint. And at least print a correct message.
Made a pull request to fix this issue: https://github.com/solana-labs/solana-program-library/pull/3275
Does this issue still need to be worked on?
My understanding is that specifying --decimals x
means that the base unit of the token is $\mathbf{10^{-x}}$, which means 1 token is made up of $\mathbf{10^{x}}$ base units. Let $\mathbf{T}$ denote the max tokens that can be minted. We get $\mathbf{2^{64} - 1 = T \times 10^{x}}$, which gives us $\mathbf{T = \frac{2^{64} - 1}{10^{x} } }$. Is my understanding correct?
The command with decimals is working well on current version!
The confusing behavior is still there unfortunately. You can "over-mint" tokens with the "mint" command, try running the commands in the first post and you'll see that you only get 18.44... tokens even though you ask to mint 1000
Here are devnet transactions:
Similar commands work fine with other tokens that have less decimal digits.