A simple tutorial to make an ERC20 token on the AVAX network
- MetaMask Extension (https://metamask.io) connected to the Avalanche network. (instructions here https://pangolin.exchange/tutorials/getting-started)
- A bit of AVAX in your wallet for gas.
- Access to https://remix.ethereum.org/ Got all that? OK, let's go!
- Open /contract20.sol
- Copy the WHOLE file's content.
- Open https://remix.ethereum.org/
- Make a new file in Remix called
Token.sol. - Paste the code in the file.
- Search for
contract Consts {. - That defines the parameters for your token, and is pretty easy to understand, but I'll explain.
7.1)uint public constant TOKEN_DECIMALS = 18;Is the token's decimals
7.2)uint8 public constant TOKEN_DECIMALS_UINT8 = 18;Is the token's decimals in uint8 form
7.3)uint public constant TOKEN_DECIMAL_MULTIPLIER = 10 ** TOKEN_DECIMALS;Is the decimals multiplier
7.4)string public constant TOKEN_NAME = "YourToken";<-- This is important, it's your token's name.
7.5)string public constant TOKEN_SYMBOL = "YOUR";<-- Also important, your token's symbol. Normally 2-5 alphanumberical characters.
7.6)bool public constant PAUSED = false;Is your token paused?
7.7)address public constant TARGET_USER = 0x3e522051A9B1958Aa1e828AC24Afba4a551DF37d;<-- IMPORTANT, your address. If you don't change that you're basically saying that the initial supply is mine :)
7.8)bool public constant CONTINUE_MINTING = true;Allow minting? - OK, customisation done.
- Click the solidity icon (second down from the top left)
- Select solidity 0.4.24 from the drop-down.
- Click 'Compile Token.sol'
- Now, select the tab underneath the Solidity icon
- You should see a dropdown with JavaScript VM (London) as the default.
- Change that to Injected Web3 and allow metamask to connect.
- Select 'MainToken (Token.sol)' from the list below 'CONTRACT' (should be 'BasicToken (Token.sol)' by default).
- Then, click the 'Deploy' button and approve the transaction.
- Done!
Your ERC20 token is on the Avalanche network! You can choose to mint new tokens, burn some of the supply, etc. You can grow your project, and build a network. You can build a website or more! You can build a payment system! Build the future!
- The initial supply is determined by the first mint.
- If
CONTINUE_MINTINGis false, the first mint will be the only mint. - Too low of a gas fee will result in a transaction faliure.
I'm entering the dev contest here: https://medium.com/avalancheavax/avalanche-launches-developer-tutorial-contest-with-50k-in-prizes-7d8b4422399f, but feel free to donate directly here! 0x3e522051A9B1958Aa1e828AC24Afba4a551DF37d