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
Create a copy of this template repository in your own github account by navigating here: https://github.com/forte-service-company-ltd/fre-tokens-quickstart and clicking the “Use this template” button on GitHub.
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.
.env
Environment variable details
Environment variable details
ETH_RPC_URL - You can get this from a platform such as Alchemy or Infura. For this demo you’ll need an RPC that points to the Base Sepolia testnet.PRIV_KEY - This is the private key of a development wallet you control with some testnet ETH on the Base Sepolia network.TOKEN_ADMIN - This is the public wallet address of an account that will have admin privileges on the token contract you deploy. For simplicity this could be the public address that is paired with the
PRIV_KEY variable above.ETHERSCAN_API_KEY - This is optional, but is easy to obtain and enables some easier website based interaction with your token contract. You can create a free API key by logging into https://basescan.org/ and navigating to the API Keys section.Deploy ERC-20 Token
An example ERC-20 contract namedQuickstartERC20.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).
example output
Test the Mint Function
The mint function is only callable by theTOKEN_ADMIN you previously set in the environment file. Test out calling this function and minting yourself some test tokens.