PolicyEngine
ThePolicyEngine is the central contract that stores policy configurations and coordinates rule evaluation. It serves as the registry for all account policies and the dispatcher for rule evaluation.
Overview
Policy Set Structure
Functions
setPolicySet
Register or update the caller’s policy set.
| Parameter | Type | Description |
|---|---|---|
policyCID | bytes32 | IPFS CID (truncated to 32 bytes) |
pkpAddress | address | Lit Protocol PKP address |
encodedRules | bytes | Binary-encoded on-chain rules |
failMode | uint8 | 0 = CLOSED, 1 = OPEN |
requiresAttestation | bool | Whether off-chain attestation is needed |
removePolicySet
Remove the caller’s policy set and stop enforcement.
evaluate
Evaluate a transaction against the caller’s registered policy. Called by PolicyGuard or PolicyKit7579Module.
| Parameter | Type | Description |
|---|---|---|
target | address | Transaction destination |
value | uint256 | ETH value in wei |
data | bytes | Transaction calldata |
attestation | bytes | EIP-712 signed attestation (empty if no Tier 3) |
bool — Whether the transaction is allowed.
getPolicySet
Read the policy set for an account.
Events
Encoding Format
On-chain rules are encoded using thePolicyCodec library into a compact binary format:
PolicyEncoder handles encoding and decoding automatically.
