ERC20 practices in Solidity

Solidity Programming Language
2 min readMar 3, 2022

Aim: To make ERC20 practices

Code:

4 People

You can see in solidity code.

We would like to fix the max token amount for all user. For example, the max amount will be 10000 tokens.

Go to the code.

We use transfer function for limiting the users’ token amounts.

Could you see that in practice ?

Compile and Deploy it.

You must be the owner . Please control ACCOUNT section

owner is 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4

Click the transfer function and put the Alice’s address and value.

Remember our requirements

require(balances[to] <= 10000);

require(balances[to] + value < 10000);

You can not sent 5000 tokens.

You try to sent 4999 tokens to Alice.

It is working. Alice is happy. Alice has 9999 tokens.

Dr.Engin YILMAZ

Ankara

2022

--

--

Solidity Programming Language

Solidity basics for beginners: Learn the fundamentals of smart contract development and build your first DApp! #Solidity #Foundry #Ethereum #Opcodes #DApps