Unichain Docs

Deploy an ERC-20 Contract (Using thirdweb)

Learn how to deploy an ERC-20 contract with thirdweb.

Deploying a token on Unichain with thirdweb is as simple as deploying a smart contract. You can choose between two approaches, dependent on how the token intends to be distributed.

  • Use the Token contract when:
    1. You need full control over token minting and distribution.
    2. You want to reward users with tokens for specific actions.

The Token contract is great for when you don't need pre-defined claim conditions or public distribution mechanisms.

  • Use the Token Drop contract when:
    1. You have a known distribution plan
    2. You want users to claim their distribution

The Token Drop contract offers more structured and controlled token distribution, allowing you to set up complex release strategies.

Requirements

ETH on Unichain is required, see thirdweb Unichain Faucet

The guide requires a thirdweb account for deployments. Create one here: thirdweb dashboard

Steps to Deploy

Deploy a thirdweb pre-built contract through UI!

  1. In this example we will be deploying an ERC-20 contract, but this method works for any of thirdweb's prebuilt contracts.

  2. View Contract Page

    You can read some details about the contract as well as see some common uses cases. Click on 'Deploy Now' in the top right corner to deploy the contract.

  3. Fill in Contract Details

    1. Fill in the contract metadata such as Image, Name, and description.
    2. The rest of the details are autofilled and are acceptable for most use cases. If you require any special configurations for recipent addresses or trusted forwarders be sure to apply them here.
    3. When selecting your chain you can either search for Unichain Sepolia Testnet or by chain id 1301
    4. Finally, click on Deploy Now to deploy your contract to the Unichain Sepolia Testnet.

      NOTE: The number next to the Deploy Now button denotes the number of transactions that will occur. All but 1 of the transactions will incur a gas cost.

    5. Click on View Now to be taken to the newly deployed contract in your dashboard.

Set Your Supply

For Token contracts:

  1. Click on Tokens on the left hand menu

  2. Click on the blue Mint button

  3. Specify the amount of tokens you wish to mint and click on Mint tokens

From here you can distribute these tokens through transfer events with the thirdweb sdk or even as reward to users with thirdweb engine!

For Token Drop contracts:

  1. Click on Claim Conditions on the left hand menu

  2. Click on Add Phase

  3. Choose who can mint tokens during this phase. There are 4 different options:

    • Only the contract owner can mint.
    • Public, where anyone can mint.
    • Public (With Allowlist) defines a public mint with some wallet addresses having special rules.
    • Allowlist Only, where only specified wallets are allowed to mint.
  4. Fill in the claim condition fields according to the desired distribution. The "How many tokens will you drop in this phase?" section is where you will be defining your supply. Additional phases will increase the supply too. Additional phases will increase the supply accordingly.

  5. Click on Save Phases

  6. Transferring Tokens (Optional)

    Both contract types allow for token transfers. You can transfer through the contract's transfer function or using the thirdweb sdk

    . If claiming through a Token Drop contract, tokens are minted directly to a user's wallet.

Last updated on

On this page