How to deploy a ERC-20 token on Avalanche with OpenZeppelin

1. Setting up Metamask

  • 0xa869 for Fuji Testnet
  • 0xa86a for Mainnet

2. Acquiring faucet tokens

In order to operate on C-CHAIN, you will need to acquire C-AVAX tokens from the faucet. Simple visit the link, provide your Ethereum address and click “REQUEST 10 AVAX”. Next, go to your Metamask and you will see updated balance. Tokens from this faucet are only for testing purposes and don’t represent any value.

3. Creating ERC-20 token with Remix

Now it’s time to create our ERC-20 token! Visit Remix, click “SOLIDITY” and “New file”. After that, navigate to the Workspaces section (files under the logo) and see a blank file, which you should rename. In this case we name it avaerc.

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
  • the ability for holders to burn (destroy) their tokens
  • a minter role that allows for token minting (creation)
  • a minter role that allows to stop all token transfers

4. Deployment

In this section, choose Injected Web3 environment and connect your Metamask account with C-AVAX funds we requested from the faucet. In the “CONTRACT” field, select ERC20PresetMinterPauser.sol as it’s the main contract.

5. Minting tokens

Return to the Deploy and run transactions section and click under “Deployed contracts”. Here you can see some functions of the contract. You can refer to OpenZeppelin documention in order to find out more about smartcontract functions. We will focus on one that allows minting.

6. Adding NFT token to Metamask

Open your Metamask Assets and click “Add token”. Insert the contract address we previously found out (in our case — 0x7ADc290F0098a8A7641e76238E86AfA5AA646e70), token symbol — AVAE and since NFT is non-fungible — leave decimals at 0.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ivan Staker

Ivan Staker

12 Followers

Professional validator, taking part in major testnets and running mainnets.