Skip to main content
This recipe deploys DemoToken, a fixed-supply ERC-20 token built on OpenZeppelin Contracts. Standard ERC-20 contracts work on Sei without changes.

Before you start

  • A Sei Testnet account that holds some SEI for gas. Get testnet SEI from the faucet. Use a throwaway account that holds only testnet funds.
  • For Foundry, the account’s private key in the PRIVATE_KEY environment variable.
  • For Hardhat, the private key in the Hardhat keystore, as the Hardhat guide shows.
  • For Remix, a browser wallet such as MetaMask.

The contract

DemoToken.sol
The constructor mints 1,000,000 DEMO to the account that deploys the contract. decimals() returns 18, so the contract stores the supply as 1,000,000 × 1018 base units.

Deploy the contract

Create a project and install OpenZeppelin Contracts:
Save the contract as src/DemoToken.sol. Then deploy it:
Foundry prints the token address after Deployed to:.
Without --broadcast, forge create only simulates the deployment. It prints the transaction, but it does not send it.
For project settings, tests, and deploy scripts, see the Foundry guide.

Verify the source

Verification publishes your source code on Seiscan, so that anyone can read the contract. Sourcify verification does not need an API key. Replace 0xYourTokenAddress with the deployed address:
For Remix and the other verification options, see Verify contracts.

Read the token back

Read the token’s metadata and your balance to confirm the deployment. Replace 0xYourTokenAddress with the token address and 0xYourAddress with the deployer address.
You are done when you see:
ethers prints 1000000.0, because formatUnits in ethers always includes a decimal place.