ERC20 Token Interface – How To Create Your Own ERC20 Cryptocurrency Token in 2021

Table of Contents
token interface
Table of Contents

Welcome to lesson 8!

You keep hearing ERC20 but you don’t know what it is? Don’t get left out! In this video, we will introduce the ERC20 standard token to you! We will also show you the ERC Token Standard Interface and the functions and events that have to be implemented in order for the ERC20 token to become compliant. Sounds like something that you would like to do? Then you came to the right place, watch our video to find out more, or read the article below:

 

https://www.youtube.com/watch?v=aLmHja7FM7o&t=2s

 

Welcome to the lesson 8! In this lesson, we will have a look at ERC20 token standard. The ERC20 token standard simply describes the functions and events that an Ethereum token contract has to implement. So if you are familiar with Java for example and know what an interface is. ERC20 token standard is essentially just that, an interface that you have to implement so that the token you create becomes an ERC20 compliant token. 

In other words, you have to implement all the functions that are described in ERC tokens standard interface and make them visible to the public. This is what your token users will interact with and that is what essentially makes a token. 

The reason this standard exists is so that every token that implements this standard follows the same naming convention and by doing so makes it easy for developers to interact with different coins. It also makes it easier for wallets to handle different coins as they know that once a token is ERC20 compliant it will follow certain convention and thus will behave in predictable ways.

Now let’s have a look at the ERC20 Token Standard Interface and the function and events that need to be implemented so that a token becomes ERC20 compliant.

Token Supply

So the first function that needs to be implemented is the token supply which simply returns the total token supply in circulation, then we have balanceOf() function which accepts an address of an owner of a certain wallet and returns the balance of that owner.

Transfer Function

Then we have a transfer function which accepts an address and a value and returns whether the transfer to that address of a certain value was successful or not. 

transferFrom Function

Then we have a transferFrom function where we transfer funds from a given address to another address of a given value and then we also return whether the transaction was successful or not.

Approve Function

Then we have another interesting function approve which allows a spender which is the first parameter here to withdraw from an account multiple times up to the value amount which was passed as the second parameter. If this function is called again it overwrites the current allowance with new value and then we return whether the transaction should be approved or not by returning this success Boolean.

Allowance

The final function to implement is allowance which returns the amount which spender is still allowed to withdraw from owner. Then we have two events that we need to implement. The first one is triggered when tokens are transferred to and the value is the amount which were sent. 

Approval

And then the final event is approval which is triggered whenever approved is called and it accepts three parameters. So owner of the address of which was approved on and then the spender which has been allowed to spend that money and in value is the amount which has been approved to be spent.

So this is it. As you can see it’s not a really big long interface and not many functions and events that need to be implemented. In the next lesson, we will do just that, implement all these functions and events and make our own ERC20 compliant token.

See you there!