Policy Management Contracts
The Policy Management contracts handle on-chain policy enforcement for ACE-compatible contracts. The source code and full documentation are available in the policy-management package of the chainlink-ace repository (Business Source License 1.1).
Core interfaces
Interface | Description |
|---|---|
| IPolicyEngine | Central orchestrator that manages policies, extractors, and mappers for protected contracts. Receives calls from PolicyProtected targets, runs the policy chain, and returns allow/reject decisions. |
| IPolicyProtected | Base interface for any contract that wants policy enforcement. Provides the runPolicy modifier, the connection to a PolicyEngine, and context handling for passing off-chain data to policies. |
| IPolicy | Standard interface for all policy contracts. Each policy implements run (read-only evaluation that returns allow/continue/reject) and optionally postRun (state changes after execution, such as updating volume counters). |
| IExtractor | Parses transaction calldata into named parameters (e.g., to and value from an ERC-20 transfer) so policies can evaluate them. One extractor is registered per function signature. |
| IMapper | Optional interface for transforming or combining extracted parameters before they reach a policy. Only needed for advanced scenarios where a policy expects a different parameter shape than the extractor provides. |
Pre-built policies
ACE provides a library of audited, ready-to-use policy implementations covering common compliance scenarios โ allowlists, volume limits, role-based access, pause controls, and more. See the policies source code for implementation details, or the Policy Library page for configuration and usage.
Reference token implementations
The repository includes reference token contracts that demonstrate full ACE integration:
- ERC-20 Compliance Token โ A policy-protected ERC-20 with frozen token handling.
- ERC-3643 Compliance Token โ A compliant implementation of the ERC-3643 T-REX standard.
Repository documentation
The policy-management docs folder contains detailed guides:
- Concepts โ Architecture, policy flow, extractors, mappers, and context handling
- API Guide โ Task-oriented guide with code examples for common operations
- API Reference โ Complete interface specifications with function signatures and events
- Custom Policies Tutorial โ End-to-end walkthrough for building a custom policy contract
- Policy Ordering Guide โ How evaluation order affects transaction outcomes
- Security Considerations โ Trust model, gas considerations, and context handling
Related pages
- Architecture โ How PolicyEngine contracts fit into the ACE system
- Policy Management โ Conceptual overview of policy chains and evaluation
- Policy Library โ Pre-built policy implementations with configuration details