Deploy gas-optimized ERC20 tokens on Base Mainnet for under $0.001 using EIP-1167 minimal proxies.
| ~55k gas per token |
~$0.001 at 1 gwei |
EIP-1167 minimal clones |
No allowance mapping removed |
- Factory (
contracts/sources/TokenFactory.sol) deploys ERC20 tokens viacreate2-style minimal proxies. - Each token is a clone of a single implementation contract (
TokenImpl.sol), keeping deployment costs negligible. - The contract is aggressively optimized — hardcoded
decimals = 18, noallowancemapping, Solidity optimizer at 100k runs.
| Contract | Purpose |
|---|---|
TokenImpl.sol |
Minimal ERC20 implementation (name, symbol, totalSupply, transfer, decimals) |
TokenFactory.sol |
Factory that clones TokenImpl for each user request, collects a creation fee |
The factory is deployed on Base Mainnet at 0x94577897a3DaD59bD62c2F47c218e8bB2A02477b.
A Next.js 16 app with wagmi + viem for wallet connection and contract interaction.
| Route | Description |
|---|---|
/ |
Landing page |
/token-factory |
Connect wallet, choose network, and deploy a token in one click |
- Connect via MetaMask (or any injected wallet)
- Switch between Base Mainnet / Base Sepolia
- Deploy a token with name, symbol, and total supply
- View all tokens deployed from your account
- Copy contract address / open on BaseScan
git clone <repo-url>
cd nbase
npm installcp .env.example .env.localFill in your factory address and optional database URL:
NEXT_PUBLIC_FACTORY_ADDRESS=0x94577897a3DaD59bD62c2F47c218e8bB2A02477b
DATABASE_URL=postgresql://user:password@host:5432/db
npm run dev -- --webpack # Windows (Turbopack not supported)
npm run dev # Linux / macOSnpm run build- Open
contracts/sources/TokenImpl.solin Remix - Compile with Solidity
0.8.24, optimizer enabled (100k runs) - Deploy
TokenFactory.solwith your chosen creation fee (e.g. 0.000001 ETH = 1000000000000 wei)
cd contracts
npm install
npx hardhat run scripts/deploy.js --network baseUpdate the resulting factory address in .env.local → NEXT_PUBLIC_FACTORY_ADDRESS.
# Push to Vercel
vercel --prod --yes
# Rename project (optional)
vercel project rename <old-name> <new-name>The app automatically reads NEXT_PUBLIC_FACTORY_ADDRESS at build time.
nbase/
├── contracts/
│ ├── sources/
│ │ ├── TokenImpl.sol # Minimal ERC20 implementation
│ │ └── TokenFactory.sol # EIP-1167 clone factory
│ ├── hardhat.config.js
│ └── scripts/deploy.js
├── src/
│ ├── app/
│ │ ├── api/ # Serverless API routes
│ │ ├── token-factory/ # Token factory page
│ │ └── layout.tsx # Root layout with nav
│ ├── components/
│ │ ├── providers/ # Wagmi + Web3 providers
│ │ └── token-factory.tsx # Main factory component
│ └── lib/
│ ├── deployment.ts # ABIs, chain config, factory address
│ └── wagmi.ts # Wagmi configuration
├── .env.example
└── README.md
MIT