This repository contains an EVM-based protocol called the Forte Rules Engine. This protocol lets you easily define powerful, flexible, composable on-chain policies without hardcoding rules into your smart contracts.
Check out our docs and quickstart guide here!
Please visit our Contributor Guide.
This guide assumes the following tools are installed and configured correctly. Please see each tool's installation instructions for more details:
To build and install dependencies, run the following commands:
npm install
forge soldeer install
forge buildIn order to run the full test suite, there are some other requirements. First, a python virtual environment is needed to install the python requirements. We'll also set the env source now.
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txt
source .envOnce everything is ready to go, we'll run the test suite:
forge test -vv --ffiThe following section will run through the deployment process of the Forte Rules Engine, as well as how to utilize a local deployment of the FRE. The main deployment script is located at script/deployment/DeployRulesDiamond.s.sol.
Before deploying, configure your environment variables in the .env file:
# Deployment Configuration
DEPLOYER_PRIVATE_KEY=0x1234567890abcdef... # Private key of the deploying account
DESIRED_DEPLOYMENT_ADDRESS=0x742d35Cc6634C0532925a3b8D400414004C07f5F # Target deployment address
ETH_RPC_URL=https://mainnet.infura.io/v3/your-project-id # RPC URL for target chain
GAS_NUMBER=20000000000 # Gas price in wei (optional)Important:
- Set
DEPLOYER_PRIVATE_KEYto the private key of the account that will deploy the contracts - Set
DESIRED_DEPLOYMENT_ADDRESSto your preferred deployment address - Set
ETH_RPC_URLto the RPC endpoint of your target blockchain network - Ensure the deployer account has sufficient funds for gas fees
For local development and testing, you can use Anvil to create a persistent state:
Method 1: Manual Anvil State Creation
# Start Anvil with state dumping
anvil --dump-state diamondDeployedAnvilState.jsonMethod 2: Automated State Generation
# Use the automated script to deploy and save Anvil state
./script/deployment/generateAnvilSavedDiamondState.shThis will:
- Start Anvil in the background with
--dump-state diamondDeployedAnvilState.json - Deploy the Rules Engine Diamond to the local network
- Save the deployment state to
diamondDeployedAnvilState.json - Clean up the Anvil process
Loading Saved State
The saved state file contains the complete blockchain state after deployment, allowing you to resume development with pre-deployed contracts.
# Source environment variables
source .envDirect Forge Deployment Using the bash script
bash script/deployment/SimpleDeploy.shOr using forge script directly
forge script script/deployment/DeployRulesDiamond.s.sol \
--ffi \
--broadcast \
-vvv \
--non-interactive \
--rpc-url=$ETH_RPC_URL \
--gas-price $GAS_NUMBER \
--legacyThe primary license for Forte Protocol Rules Engine is the Business Source License 1.1 (BUSL-1.1), see LICENSE. However, some files are dual licensed under GPL-2.0-or-later:
- All files in
src/example/may also be licensed underGPL-2.0-or-later(as indicated in their SPDX headers), seesrc/example/LICENSE
- All files in
lib/are licensed underMIT(as indicated in its SPDX header), seelib/LICENSE_MIT - All files in
src/example/may also be licensed underGPL-2.0-or-later(as indicated in their SPDX headers), see src/example/LICENSE Other Exceptions