Deploy an ERC-20 Contract
Learn how to deploy an ERC-20 contract on Unichain
Deploying an ERC-20 contract on Unichain is as simple as deploying a smart contract. For additional reading, developers should see deploy a smart contract
Summary
Deploy an ERC-20 token contract, minting 1,000,000 tokens to the deployer
Requirements
ETH on Unichain is required, see Funding a Wallet
-
The guide uses foundry for deployments. Install it by running:
-
Add Unichain to your
foundry.toml
-
Additionally, an ERC-20 implementation from solmate
Other community implementations are available such as:
Steps
-
Define the Token Contract
Most tokens inherit an existing ERC-20 implementation. For this guide, solmate's ERC-20 implementation is used.
In the example, the deployer is minted 1,000,000 EXT tokens. Developers can configure:
-
Token name, i.e.
ExampleToken
-
Token symbol, i.e.
EXT
-
Token decimal precision, i.e.
18
-
Minting mechanisms
It is best practice to create tokens with 18 decimals of precision. A significant majority of tokens adhere to this, and most protocols and apps expect this standard.
-
-
Deploy the Token
Deploy the token (smart contract) with foundry:
See deploy a smart contract for more information
-
Transferring Tokens (Optional)
Upon creation of the token, the deployer is the owner of all 1,000,000 tokens. To transfer the tokens, use the
transfer
function:The
transfer
function is callable from a block explorer, a web framework, or a backend language such as typescript, python, or rust. To transfer tokens using cast: -
Create a Trading Pool on Uniswap v4
This step is also optional, but developers enable trading of their new token on Uniswap v4:
Last updated on