Three-Tier Rule System
PolicyKit organizes rules into three tiers based on where and how they are evaluated. This tiered approach balances security, cost, and capability.Overview
Rules are evaluated sequentially: Tier 1 first, then Tier 2, then Tier 3. If any rule fails at any tier, the transaction is rejected immediately.Tier 1: Stateless On-Chain Rules
Stateless rules are the simplest and cheapest. They only look at the current transaction parameters — no storage reads needed.ALLOW_TARGETS
Whitelist specific contract addresses that the account can interact with.DENY_TARGETS
Blacklist specific contract addresses.If both
ALLOW_TARGETS and DENY_TARGETS are set, ALLOW_TARGETS is evaluated first. A transaction must be in the allow list AND not in the deny list.ALLOW_SELECTORS
Whitelist specific function selectors (first 4 bytes of calldata).DENY_SELECTORS
Blacklist specific function selectors.MAX_VALUE
Set a maximum ETH value per transaction.Tier 2: Stateful On-Chain Rules
Stateful rules use on-chain storage to track state across transactions. They cost more gas but enable time-based and cumulative constraints.SPEND_LIMIT
Limit how much of a specific token can be spent within a rolling time window.COOLDOWN
Enforce a minimum time between transactions.Tier 3: Off-Chain Rules (Lit Protocol)
Off-chain rules are evaluated by the Lit Protocol network. They can access external data, perform simulations, and run arbitrary logic that would be impractical on-chain.MAX_SLIPPAGE_BPS
Check that a swap transaction doesn’t exceed a maximum slippage tolerance.REQUIRE_SIMULATION
Require that the transaction succeeds when simulated.CUSTOM
Define custom rule logic hosted on IPFS.Choosing the Right Tier
| Consideration | Tier 1 | Tier 2 | Tier 3 |
|---|---|---|---|
| Gas cost | Lowest | Medium | None (off-chain) |
| Trust model | Trustless | Trustless | Decentralized TEE |
| Latency | Instant | Instant | ~1-3 seconds |
| External data | No | No | Yes |
| State tracking | No | Yes | Yes |
| Custom logic | No | No | Yes |
- Use Tier 1 for simple access control (targets, selectors, value limits)
- Use Tier 2 when you need time-based or cumulative constraints
- Use Tier 3 when you need external data, simulation, or custom logic

