Deploying Tokens
Tokens are the lifeblood of the web3 economy and with applications they are no different. However sometimes it’s better when you’re more easily able to craft rules for your tokens. The architecture of the Forte rules engine necessitates that when deploying a token, you do so with it connected into what’s called a “token handler”. This handler will connect to your application and simplify the process of adding a variety of rules to your protocol. Once you have a deployed and configured protocol supported token, you’re ready to start applying rules.
Index
Prerequisites
The following steps must already be completed on the target chain:
- The Protocol has been deployed
- You have deployed an Application Manager
- You have created at least one Application Administrator role in the Application Manager.
- You have created an ERC20 Handler
It’s required that your token be a protocol compatible token that adheres to the protocol interface.
ERC20 Integration
-
Ensure the [environment variables][environment-url] are set correctly.
-
Inside the ERC20 contract, import IProtocolToken.sol.
- Add IProtocolToken.sol to the implementation list.
-
Implement the following functions:
- Required:
getHandlerAddress()
- Required:
connectHandlerToToken(address _deployedHandlerAddress)
- Optional: TRANSFER FUNCTION GROUP, only required if you want to set fees.
transfer(address to, uint256 amount)
transferFrom(address from, address to, uint256 amount)
_handleFees(address from, uint256 amount)
NOTE: Function templates can be found in ApplicationERC20
- Required:
-
Open a terminal
-
Compile and deploy the ERC20
- Export the newly deployed ERC20 address to the terminal
- Connect the ERC20 to the ERC20 Handler
- Register the token with the Application Manager
ERC721 Integration
-
Ensure the [environment variables][environment-url] are set correctly.
-
Inside the ERC721 contract, import IProtocolToken.sol.
- Add IProtocolToken.sol to the implementation list.
- Implement the following functions:
- Required:
getHandlerAddress()
- Required:
connectHandlerToToken(address _deployedHandlerAddress)
NOTE: Function templates can be found in ApplicationERC721
- Required:
- Compile and deploy the ERC721
- Export the newly deployed ERC721 address to the terminal
- Connect the ERC721 to the ERC721 Handler
- Register the token with the Application Manager