← Back
ERC-20 Deploy
Deploy your own ERC-20 token on Base
Deploy Instructions
- Open
smart-contract/directory - Run
npx hardhat run scripts/deploy.js --network baseSepolia - Follow the prompts for name, symbol, supply
- Confirm the deployment transaction in your wallet
Contract Code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract MyToken is ERC20 {
constructor(string memory name, string memory sym, uint256 initialSupply)
ERC20(name, sym) {
_mint(msg.sender, initialSupply * 10 ** decimals());
}
}