How to Interact with the ERC-20 Smart Contract

In this tutorial we are going to run the ERC-20 smart contract deployment on the Rinkeby chain and see the actual token created in our Metamask wallet. After you create and deploy your ERC-20 smart contract, you will be able to see that this token is added on the Rinkeby Etherscan, and by adding the address and specifications of the token, you can add it to your wallet and also you will be able to do the same on Uniswap afterward to be able to swap your token with other tokens.

ERC-20 Smart Contract

In our last related article on how to create an ERC-20 token, we learned how to create a token with the ERC-20 standard. Moreover, we showed how to run it via Ganache-CLI. In this tutorial, we are going to run the very same deployment on the Rinkeby network, and see the actual token created in our Metamask wallet. After you create and deploy your ERC-20 smart contract, you will be able to see that this token is added to the Rinkeby Etherscan. Then, by adding the address and specifications of the token, you can add it to your wallet. Also, you will be able to do the same on Uniswap afterward to be able to swap your token with other tokens (notice that swapping your token is only possible on Mainnet but not on the Rinkeby test network).

Deploying on Rinkeby Testnet

To begin with the deployment of our ERC-20 token, type the following command in the terminal:

brownie run scripts/1_deploy_token.py --network rinkeby

Result:

Brownie v1.18.1 - Python development framework for EthereumCompiling contracts... Solc version: 0.6.12 Optimizer: Enabled Runs: 200 EVM Version: Istanbul Generating build data... - TokenERC20 - tokenRecipientCompiling contracts... Solc version: 0.8.13 Optimizer: Enabled Runs: 200 EVM Version: Istanbul Generating build data... - OpenZeppelin/[email protected]/ERC20 - OpenZeppelin/[email protected]/IERC20 - OpenZeppelin/[email protected]/IERC20Metadata - OpenZeppelin/[email protected]/Context - OurTokenMytokenProject is the active project.Running 'scripts/1_deploy_token.py::main'... Transaction sent: 0xa85a8d1595d290657f726f1533d105c2d2b6604e051409dc0c2e4d9a74bf547e Gas price: 1.000000019 gwei Gas limit: 745852 Nonce: 62 TokenERC20.constructor confirmed Block: 10468341 Gas used: 678048 (90.91%) TokenERC20 deployed at: 0xDD7f08A04c3d66beD75aFFA5f0e70e46de4567eb

Finding the token on Rinkeby Etherscan:

By copying and pasting the 0xDD7f08A04c3d66beD75aFFA5f0e70e46de4567eb into the Rinkeby Etherscan, you will be able to see that we have indeed created a token called Token:

Adding the token to the Metamask:

Now, let’s head over to our Metamask, and in the Rinkeby network, import our new token by entering the address of the contract deployment:

ERC-20 smart contract

Adding the token to the Metamask:

Now, let’s head over to our Metamask, and in the Rinkeby network, import our new token by entering the address of the contract deployment:

ERC-20 smart contract

ERC-20 smart contract

And you will see that our initial supply which was 1000 has been multiplied by 10 to power our decimals (which was 18). As a result, you can see 21 zeros after one as the total supply (All of which are in our account).

ERC-20 smart contract

Transferring the tokens:

Now, we can send these tokens to other accounts. For example, here we transfer our TKN token to account 2.

ERC-20 smart contract

Importing the token in Uniswap:

We can also go to Uniswap and see if we can add our token to it.

ERC

let’s first connect to our Metamask wallet:

ERC

Then, press the Select A Token button. And in order to add your token in Uniswap, you should first enter your address in the box and you should be able to find the TKN token. Press import:

ERC

And we have our token in Uniswap!

ERC

Last Thought on ERC-20 Smart Contract

In this article, we have managed to run the deployment of the ERC-20 smart contract on the Rinkeby chain test network. Then, we copied the address of the deployed contract in the Rinkeby Etherscan and found our created token there. Afterward, we entered the specifications of the token in the add token section of the Metamask wallet and added the created token to it. Finally, we imported our token into the Uniswap Rinkeby Testnet.

Download this Article in PDF format

3d websites

Care to Know Us More?

In Arashtad, we have gathered a professional team of developers who are working in fields such as 3D websites, 3D games, metaverses, and other types of WebGL and 3D applications.

Arashtad Services
Drop us a message and tell us about your ideas.
Request a Quote
Blockchain Development