Let's deploy a basic demo ERC20 contract that comes integrated with the CLI on our Avalanche L1.
avalanche contract deploy erc20
and follow this configuration:
✔ Local Network✔ Avalanche L1 myblockchainA private key is needed to pay for the contract deploy fees.It will also be considered the owner address of the contract, beign able to callthe contract methods only available to owners.Use the arrow keys to navigate: ↓ ↑ → ←? Which private key do you want to use to deploy the contract?:✔ Use the private key of the Genesis Allocated address 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FCWhich is the token symbol?Token symbol: TOKWhich is the total token supply?Token supply: 1000000Which address should receive the supply?✔ Use the Genesis Allocated address 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FCToken Address: 0x52C84043CD9c865236f11d9Fc9F56aa003c1f922ERC20 Contract Successfully Deployed!
Notice how we are setting the value to 0 since the --value command works for sending the native token, and in this case we are really interacting with a function of the ERC20 standard called transfer and will be the one in charge of modifying the balances mapping in the TOK state. Notice the amount that transfer receives needs to be set in wei, except if you use the word ether to convert units automatically.