Documentation Index
Fetch the complete documentation index at: https://policykit.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Smart Contracts Overview
PolicyKit’s on-chain layer consists of Solidity contracts built with Foundry. These contracts store policy configurations, evaluate on-chain rules, and verify off-chain attestations.
The contracts are published as @policy-kit/contracts on npm, so you can import them directly in your own Solidity projects:
pnpm add @policy-kit/contracts
import { IPolicyEngine } from "@policy-kit/contracts/src/core/IPolicyEngine.sol";
import { IRuleEvaluator } from "@policy-kit/contracts/src/rules/IRuleEvaluator.sol";
Contract Architecture
Core Contracts
| Contract | Description |
|---|
PolicyEngine | Central registry and evaluation dispatcher |
PolicyGuard | Guard hook for smart accounts |
PolicyKit7579Module | ERC-7579 validation module |
AttestationVerifier | EIP-712 attestation verification |
Rule Evaluators
| Contract | Tier | Description |
|---|
AllowTargetsRule | 1 | Whitelist contract addresses |
DenyTargetsRule | 1 | Blacklist contract addresses |
AllowSelectorsRule | 1 | Whitelist function selectors |
DenySelectorsRule | 1 | Blacklist function selectors |
MaxValueRule | 1 | Cap ETH value per transaction |
SpendLimitRule | 2 | Token spending limits with time windows |
CooldownRule | 2 | Minimum time between transactions |
Libraries
| Library | Description |
|---|
PolicyCodec | Encode/decode policy rules for on-chain storage |
CalldataParser | Parse transaction calldata (target, selector, params) |
Deployment
Contracts are deployed using Foundry’s deployment scripts:
cd contracts
forge script script/Deploy.s.sol --rpc-url $RPC_URL --broadcast
Development
Build
Test
Gas Report