Deploy an ERC-20 Token
OpenZeppelin provides secure, community-vetted smart contract templates that follow best practices.- Deployment with Foundry
- Deployment with Hardhat
Step 0: Setup Foundry
If your foundry project isn’t setup yet please go to foundry setup section before proceeding.Step 1: Create the ERC-20 Contract
Create a contract script insrc/MyERC20.sol. Run:- Inherits from OpenZeppelin’s
ERC20contract - Sets the token name to “MyToken” and symbol to “MTK”
- Mints 1,000,000 tokens to the deployer address upon deployment
Step 2: Compile the Contract
Compile your contract:Step 3: Prepare Signer for Deployment
This tutorial uses the Foundry Keystore for increased security. Create a new keystore:Provide a password to encrypt the keystore file when running the above command. If you forget this password, you will not be able to recover it.
Step 4: Deploy the Contract
Deploy your ERC-20 token to SKALE:The
--legacy flag is required for SKALE Chains. For more information, see Troubleshooting.Step 5: Verify Your Smart Contract
Verify your smart contract on the block explorer:<DEPLOYED_ADDRESS> with your deployed contract address.Next Steps
Congratulations! You’ve successfully deployed an ERC-20 token on SKALE. You can now:- Transfer tokens to other addresses
- Approve spending allowances
- Integrate the token into your dApp
