Deploy ERC-20 Token
How to deploy an ERC-20 Token that hooks into the Forte Rules Engine
Introduction
In this guide, you will learn how to deploy an ERC-20 token contract that hooks into the Forte Rules Engine. The approach will leverage Open Zeppelin’s version 4.9.6 contracts package. This guide will deploy to the Base Sepolia testnet, which requires you to have some testnet ETH available.
Get Started
If you’ve already completed the ERC-721 NFT Quickstart, you can skip the next steps and jump to the Deploy ERC-20 Token section.
Create a copy of this template repository in your own github account by navigating here: https://github.com/thrackle-io/fre-tokens-quickstart and clicking the “Use this template” button on GitHub.
Next, clone the freshly created repository to your local machine:
Open in Code Editor
Setting up the .env
File
The project includes a sample.env
to get you started. Copy that to a new file named .env
and fill in the values.
Next, make your environment variables available to the command line for running the scripts to deploy your token contract.
Deploy ERC-20 Token
An example ERC-20 contract named QuickstartERC20.sol
is available in the /src
directory. You can open it up to take a closer look and even apply customizations to meet your needs. Once you’re ready to deploy the contract you can do so with the following command (run from the same terminal window you sourced the .env file within).
This will deploy the contract to the Base Sepolia testnet and publish the source code for it to https://sepolia.basescan.org. The terminal where you run the above command will include output similar to the following:
Notice the highlighted line that indicates the deployed contract address. You can search that on the testnet explorer and even interact with it via the contract tab.
Test the Mint Function
The mint function is only callable by the TOKEN_ADMIN
you previously set in the environment file. Test out calling this function and minting yourself some test tokens.
Check Balance
You’ll see some output in the terminal indicating the status of the contract call. When successful you can refresh the transactions tab on the testnet explorer to see your transaction indexed there as well.
Check the balance of your wallet to ensure those tokens were minted:
Next Steps
Now that you have a rules ready ERC-20 token deployed it’s time to deploy the client specific contracts that connect this token to the Forte Rules Engine!