Deploy and Transfer an ERC-20 Token
Transfer an ERC-20 token between accounts
Deploy ERC-20
Let's deploy a basic demo ERC20 contract that comes integrated with the CLI on our Avalanche L1.
and follow this configuration:
Get Recepient Address
Before transfering the assets you need to make sure you have at least one extra account created so you can transfer funds to it:
You will get an output like this:
Export the address of the EWOQ account in the table above to an environment variable:
Transfer ERC-20 Token
Now, lets transfer some TOK from the ewoq address to the myAddress address.
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.
Verify transfer
Again, you can verify the transfer was performed correctly by retrieving the balances of each token in the Avalanche L1.