I want to create an ERC20 on Solidity.
I want 1000 TOKENS of MAX SUPPLY (Like the 21m of bitcoin).
PERSON A: Mint to his wallet 700 Tokens. (Thats okey)
Only 300 Tokens are available.
PERSON B: Mint to his wallet 400 Tokens. (¡Error!)
How can i do it?
Thanks!
Best Answer
Keep
MAX_SUPPLY
as a variable in your Smart Contract that stores the maximum number of tokens that you wanna sell.Also keep a
TOKENS_SOLD
variable in the Smart Contract that keeps track of how man tokens have been sold so far.Before someone tries to mint some tokens, do the below
This should serve your purpose.