Skip to main content

Smart Account Example

This example demonstrates how to set up a comprehensive policy for an ERC-7579 compatible smart account that interacts with DeFi protocols.

Scenario

You have a smart account that:
  • Trades on Uniswap and lends on Aave
  • Should only interact with trusted protocols
  • Needs spending limits and slippage protection
  • Must simulate transactions before executing

Policy Definition

Deployment

Transaction Flow

When the smart account executes a swap:
  1. The PolicyKit7579Module intercepts the transaction
  2. Tier 1: Checks target is Uniswap, selector is swapExactTokensForTokens, value is under 5 ETH
  3. Tier 2: Checks USDC spending is under 100k/day, and cooldown has elapsed
  4. Tier 3: Lit Protocol checks slippage is under 0.5% and simulates the transaction
  5. If all pass, the transaction executes

Testing