DEV Community

Cover image for How to Create an ERC20 Token in Solidity

How to Create an ERC20 Token in Solidity

Abdul Maajid on October 29, 2021

Let’s start with the basics Understanding: What is a Token? Tokens can represent virtually anything in Ethereum: reputation points in...
Collapse
 
milo123459 profile image
Milo

Can you make a post about making a token on the Vite network? Better yet: With solidity++ (github.com/vitelabs/soliditypp)

Collapse
 
abdulmaajid profile image
Abdul Maajid

I will check this out..

Collapse
 
milo123459 profile image
Milo

Thank you!

Collapse
 
barnazaka profile image
my name

Hello Sir, Im having some errors, below is the screenshot.
Image description

Collapse
 
abdulmaajid profile image
Abdul Maajid

Hello!
May be you changed something in code because there is no error in code.
Update your code in remix and try to compile again.

Collapse
 
suhakim profile image
sadiul hakim

Can you create post about how to create a ERC721 token?

Collapse
 
abdulmaajid profile image
Abdul Maajid

Already created Check it out.
dev.to/abdulmaajid/how-to-create-a...

Collapse
 
roni_sommerfeld profile image
RoNi Sommerfeld

Hello, is it possible to use an ERC20 token inside a function of an ERC721 token?
To better explain what I want to do is as follows.
Before minting an ERC721 token (Item of my game) I want to check if the player has my token (ERC20) in his wallet, if he has he could mint it...
Is it possible to do that? Thanks.

Collapse
 
abdulmaajid profile image
Abdul Maajid

Hey

If you want to access/use ERC20 Token in any contract Just create an interface of ERC20 Token. And pass your erc20 contract address in this interface then you can access.
e.g. IERC20 token = IERC20(address)

Collapse
 
alx90s profile image
Alexander Härdrich • Edited

Hey man, when I created a new ERC20 token with a total token supply of 1000. Then I add 1000 more tokens via the _mint function to any address. Now I reach the limit of 1000 coins and we have a new amount of 2000. Is that possible ? Or is the _totalSuply just the initial amount and not the maximum ?

Collapse
 
abdulmaajid profile image
Abdul Maajid

Yes but you have to add function mint. which will mint new tokens for specific users.