Policies
Top-level containers that define which rules to run and when. All logic lives inside a policy.
A policy is the central configuration object in the Forte Rules Engine. It defines what rules should be evaluated and what should happen when specific conditions are met (or not met) during a contract call.
Policies are stored on-chain and enforced deterministically. Policies can be reused across different contracts and applications.
Key Attributes of a Policy
- Policy Admin: The only address allowed to configure or update the policy.
- Version: Policies are pinned to a specific version of the Forte Rules Engine.
- Cementing: Policies can be made immutable by cementing them.
- Open or Restricted: Policies can be open to all contracts or limited to a predefined set.
What You Can Configure in a Policy
- A sequence of rules, each with conditions and effects
- A set of trackers for maintaining persistent state
- A list of authorized calling contracts, unless the policy is configured to be open to all contracts
- Policy metadata (off-chain), such as names, descriptions, and labels for readability
Policy Lifecycle
1. Deploy
Deploy a policy to the Forte enforcement engine by specifying:
- A Policy Admin address
- The Forte Rules Engine version to use
2. Update
As the Policy Admin, you can:
- Add, remove, update rules
- Reorder rules
- Create trackers
- Change allowed calling contracts
- Change access permissions for the policy from open to closed
- Cement the policy
- Propose a new Policy Admin
3. Cement
At any point, the Policy Admin may cement the policy. This makes it unchangeable—locking in its rules, trackers, and caller list forever.
Integration
A contract must be listed in a policy’s allowed calling contracts list (or the policy must be open) in order to subscribe to the policy. The policy is invoked explicitly from the contract by calling the Forte Rules Engine on-chain.