Complete technical reference for the JSON structure used to define policies. For ready-to-use templates, see Policy Templates.Documentation Index
Fetch the complete documentation index at: https://docs.forterulesengine.io/llms.txt
Use this file to discover all available pages before exploring further.
Policy Structure
Validation Requirements
- All calling functions referenced in rules must exist in
CallingFunctions - All foreign calls referenced in rules must exist in
ForeignCalls - All trackers referenced in rules must exist in
TrackersorMappedTrackers - Foreign call names only need to be unique per calling function
CallingFunctions
Defines which smart contract functions will invoke the policy. See Calling Contracts for detailed explanation.| Property | Type | Description |
|---|---|---|
Name | string | Unique identifier (used in rule references) |
FunctionSignature | string | Must exactly match contract function signature |
EncodedValues | string | Comma-separated parameters sent to Rules Engine |
uint256, address, bool, bytes, string, and array variants (uint256[], address[], etc.)
ForeignCalls
External contract interactions. See Foreign Contracts for detailed explanation.| Property | Type | Description |
|---|---|---|
Name | string | Unique identifier |
Address | address | External contract address (checksummed) |
Function | string | Function signature to call |
ReturnType | string | Return type (supported Solidity types) |
ValuesToPass | string | Comma-separated parameters (can reference calling function params or literals) |
MappedTrackerKeyValues | string | Keys for mapped tracker operations |
CallingFunction | string | Associated calling function |
FC:YourForeignCallName
Trackers
Persistent on-chain state variables. See Trackers for detailed explanation.| Property | Type | Description |
|---|---|---|
Name | string | Unique identifier |
Type | string | Data type |
InitialValue | string | array | Starting value |
uint256, address, bool, bytes, string, and array variants
Reference in rules:
- Read:
TR:YourTracker - Update:
TRU:YourTracker = value
MappedTrackers
Key-value storage for per-address or per-key state. See Trackers for detailed explanation.| Property | Type | Description |
|---|---|---|
Name | string | Unique identifier |
KeyType | string | Type of keys |
ValueType | string | Type of values |
InitialKeys | array | Starting keys (must be unique) |
InitialValues | array | Starting values (same length as InitialKeys) |
uint256, address, string, bool, bytesValue Types: Same as Tracker types (including arrays) Reference in rules:
- Read:
TR:YourMappedTracker(key) - Update:
TRU:YourMappedTracker(key) = value
Rules
Rule definitions with conditions and effects. See Rules for detailed explanation.| Property | Type | Description |
|---|---|---|
Name | string | Rule name (optional) |
Description | string | Rule description (optional) |
Condition | string | Boolean expression |
PositiveEffects | array | Effects when condition is true |
NegativeEffects | array | Effects when condition is false |
CallingFunction | string | Which calling function triggers this rule |
Order | number | Execution order (optional, must be unique if used) |
Condition Syntax
Available Values:- Calling function parameters (from
EncodedValues) - Static values:
1000,"admin",0x...,true - Trackers:
TR:trackerName - Mapped trackers:
TR:trackerName(key) - Foreign calls:
FC:foreignCallName - Global variables:
GV:BLOCK_TIMESTAMP,GV:MSG_SENDER(see Global Variables)
| Category | Operators |
|---|---|
| Logical | AND, OR, NOT |
| Comparison | ==, !=, >, <, >=, <= |
| Arithmetic | +, -, *, / |
| Assignment (effects only) | =, +=, -=, *=, /= |
| Grouping | () |
- Logical operators must be ALL CAPS
- Parentheses required for multiple conditions:
(a > 5) AND (b < 10) - Cannot mix AND/OR at same level without grouping
- String literals use double quotes:
"admin"
Effects
Revert:revert("message") or revertStop the transaction (32 byte message limit) Emit:
emit Event messageEmit a generic event with the message Tracker Update:
TRU:tracker = valueTRU:tracker += valueTRU:mappedTracker(key) = value
FC:ForeignCallNameExecute external contract call
If a revert effect triggers, no other effects execute.