Skip to main content

Overview

You can create custom conditions for specialized logic beyond what the built-in conditions provide. Build against the ICondition interface and follow the security rules below.

ICondition Rules

From the ICondition.sol NatSpec:
  1. MUST NOT revert: return false to deny, never revert
  2. Return true to allow, false to deny
The operator converts a false return into a PreActionConditionNotMet revert. Prefer view or pure implementations to keep call sites cheap and gas predictable.

Example: TimeOfDayCondition

A condition that only allows actions during specific hours (UTC):
Usage, deploy via a factory and use in operator config:

Security Checklist

Before deploying a custom condition:
  • Returns false instead of reverting on denial
  • Declared as view or pure
  • No external calls to untrusted contracts
  • No state modifications
  • Handles edge cases (zero address, zero amount, uninitialized payments)
  • Full test coverage with Forge tests
Custom conditions with bugs can lead to permanently locked funds (if check() always returns false) or unauthorized access (if check() always returns true). Test on Base Sepolia before mainnet deployment.

Testing

Test custom conditions with Forge:

Next Steps

Conditions Overview

Review the condition system architecture.

Custom Hooks

Build custom state hooks.