Rule Evaluators
Each on-chain rule type is implemented as a separate evaluator contract. ThePolicyEngine dispatches to these contracts during evaluation.
Tier 1: Stateless Rules
AllowTargetsRule
Checks if the transaction target is in a whitelist of allowed addresses.DenyTargetsRule
Checks if the transaction target is NOT in a blacklist of denied addresses.AllowTargetsRule
AllowSelectorsRule
Checks if the function selector (first 4 bytes of calldata) is in a whitelist.DenySelectorsRule
Checks if the function selector is NOT in a blacklist.MaxValueRule
Checks if the ETH value is within the allowed maximum.Tier 2: Stateful Rules
SpendLimitRule
Tracks cumulative token spending within a rolling time window.- Decode the ERC-20
transferortransferFromamount from calldata - Check if the current window has expired; if so, reset
- Add the transfer amount to cumulative spending
- Return
trueif cumulative spend is within the limit
CooldownRule
Enforces a minimum time between transactions.- Check if
block.timestamp - lastTxTimestamp >= cooldownSeconds - Update
lastTxTimestamptoblock.timestamp - Return
trueif enough time has passed
AttestationVerifier
Verifies EIP-712 signed attestations from Lit Protocol PKPs.- Decode the attestation as
(uint256 deadline, uint256 nonce, bytes signature) - Check that
block.timestamp <= deadline(not expired) - Reconstruct the EIP-712 typed data hash
- Recover the signer from the signature
- Check that the signer matches
pkpAddress - Return
trueif all checks pass
Adding Custom On-Chain Rules
To create a custom Tier 1 or Tier 2 rule evaluator:- Implement the evaluator interface:
- Deploy the evaluator contract
- Register it with the
PolicyEngine(requires governance/admin) - Use the custom rule type in your policy

