vishal rana
2 min readOct 31, 2022

Writing ERC20 Smart contract in 2022

The world has come to a point where web3 is inevitable and people will be using it in everyday life without a doubt.

Today we are going to create a simple ERC20 token using openZeppelin wizard and deploy our contract to Rinkeby testnet. Openzeppelin wizard is by far the simplest way to create a token whether it is ERC20, ERC721(used for NFT), or ERC1155.

In the above screenshot, I’ve created a token with the name “MEDIUMTOKEN” and the symbol “MTK”. By default, we are minting 1 million tokens and sending that to the contract creator. By default, the contract has 18 decimals but you can override the function and change the values accordingly.

We have also added the option to mint and burn the token in order to maintain scarcity.

The onlyOwner modifier makes sure that only the contract creator has access to these public functions that change the state of the contract.

Now we have our contract ready, let’s test the functionality in the remix. You don’t have to copy the above contract and paste it into the remix, just click “Open in remix” button on the top right side. it will open a remix tab with all your code populated.

Compile your contract and simply deploy using the deploy tab.

Select your contract and hit deploy, we have selected Javascript Vm to deploy the contract that will give us free ether accounts for testing as well. BTW, I have changed the contract name to erc20.sol. Once you deploy the contract, you’ll have access to your contract functions and you can start interacting with them.

That’s it, this is how you can simply create your smart contract, configure your requirements, and simply test it on the remix.

Now, we’ll deploy our contract to Rinkeby test net and interact with your contract using web3.

No responses yet