Skip to main content

DAO Guard Example

This example demonstrates how to set up a policy guard for a DAO treasury that enforces spending controls and restricts interactions to approved protocols.

Scenario

You have a DAO treasury that:
  • Holds significant assets in a smart account
  • Executes proposals approved by governance
  • Needs on-chain spending limits as a safety net
  • Should only interact with pre-approved protocols

Policy Definition

Integration with DAO Governance

The custom rule check-governance-approval verifies on-chain that:
  1. A governance proposal exists for this exact transaction
  2. The proposal passed with sufficient quorum
  3. The voting period was at least 2 days
  4. The timelock delay has elapsed
This ensures that even if a privileged key is compromised, it cannot bypass governance.

Deployment

Security Considerations

Defense in Depth

This policy provides multiple layers of protection:
  1. Target allowlist — Can only interact with approved protocols
  2. Value limits — Caps per-transaction ETH amount
  3. Spending limits — Daily caps on token outflows
  4. Cooldown — Prevents rapid sequential executions
  5. Slippage protection — Prevents sandwich attacks on swaps
  6. Simulation — Catches reverts before execution
  7. Governance check — Verifies on-chain approval

Fail Mode

The treasury uses closed fail mode. If Lit Protocol is unavailable:
  • Off-chain rules (slippage, simulation, governance check) cannot be evaluated
  • Transactions are blocked until Lit is available again
  • This is the correct choice for a treasury — availability is less important than security

Upgrading the Policy

To update the policy (e.g., adding a new approved protocol):
  1. Build the new policy with PolicyBuilder
  2. Have the DAO vote to approve the policy update
  3. Deploy the new policy using pk.updatePolicy()