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_KEYenvironment 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
decimals() returns 18, so the contract stores the supply as 1,000,000 × 1018 base units.
Deploy the contract
- Foundry
- Hardhat
- Remix
Create a project and install OpenZeppelin Contracts:Save the contract as Foundry prints the token address after For project settings, tests, and deploy scripts, see the Foundry guide.
src/DemoToken.sol. Then deploy it:Deployed to:.Without
--broadcast, forge create only simulates the deployment. It prints the transaction, but it does not send it.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. Replace0xYourTokenAddress with the deployed address:
Read the token back
Read the token’s metadata and your balance to confirm the deployment. Replace0xYourTokenAddress with the token address and 0xYourAddress with the deployer address.
1000000.0, because formatUnits in ethers always includes a decimal place.
Related recipes
- ERC-20 interaction: transfers, approvals, and allowances
- Listen to events: stream the token’s
Transferevents - Deploy and verify: deploy any contract with viem, ethers, Foundry, or Hardhat