When to Use Universal Action
Agent handles user funds
Need per-action spending limits
Need cumulative spending caps
Want to restrict recipients
Need parameter validation
Core Concepts
Parameter Rules
Each rule validates one parameter in the function call and maximum of 16 rules can be added per policy.Conditions
Trading Agent Example
Limit per-trade and max spending limit per session:Payment Agent Example
Fixed recipient and amount:Rebalancing Agent Example
Limit rebalance size to % of portfolio:Per-Action vs Cumulative Limits
Per-Action Only
Each individual action must be ≤ limit, but no cumulative tracking:Cumulative Tracking
Track total spent across all actions:Multiple Rules Example
Validate multiple parameters:Finding Parameter Positions:
For a function likeswap(address tokenIn, address tokenOut, uint256 amount):
Common Patterns
Whitelist Single Recipient
Cap Per Transaction Amount
Total Max Spending Limit
Minimum Amount
Debugging Tips
- Check offsets: Use
console.log(encodeFunctionData(...))to see actual calldata - Match decimals: USDC = 6, ETH = 18, etc.
- Test on testnet: Verify rules work before mainnet