Introduction
In this guide, you will learn how to deploy an ERC-721 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-721 Token Contract
An example ERC-721 contract namedQuickstartERC721.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
There are two mint functions on this token contract. The first namedadminMint 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.
mint function that is callable by anyone, but does require paying. The default price in the contract is 0.0001 ETH. You can also try this function out by calling it from account different than the token admin.