What conditions do
Conditions are swappable contracts that control who can perform actions on a PaymentOperator. Each operator has 5 condition slots, one per action:| Slot | Controls |
|---|---|
AUTHORIZE_PRE_ACTION_CONDITION | Who can create payments |
CHARGE_PRE_ACTION_CONDITION | Who can charge partial amounts |
CAPTURE_PRE_ACTION_CONDITION | Who can capture funds from escrow |
VOID_PRE_ACTION_CONDITION | Who can refund during escrow |
REFUND_PRE_ACTION_CONDITION | Who can refund after capture |
ICondition Interface
paymentInfo, The payment information structamount, The amount involved in the action (0 for authorization-only checks like refund request status updates)caller, The address attempting the actiondata, Arbitrary data forwarded from the caller (signatures, proofs, attestations)
true if the caller can proceed, false otherwise.
Default Behavior
Condition slot =address(0): always returns true (allow). The action has no restrictions.
You only need to set conditions for slots you want to restrict. Leave the rest as address(0).
Singleton vs Per-Deployment
| Type | Examples | Deploy Strategy |
|---|---|---|
| Singleton | PayerCondition, ReceiverCondition, AlwaysTrueCondition | Deployed once, reuse everywhere |
| Per-deployment | StaticAddressCondition, EscrowPeriod, Freeze | Deploy per use case via factories |
| Composable | And/Or/Not | Combine existing conditions via factories |
Security Rules
- Conditions should be
vieworpureto prevent reentrancy attacks - Never make external state-changing calls inside a condition
- Cover edge cases in tests. Bugs in authorization logic can lock funds
Configuration Patterns
Conditions compose to create flexible authorization policies. Here are common patterns:Open Authorization, Restricted Capture
Payer-Only Actions
Arbiter-Controlled
Gas Optimization
Singleton Reuse
All operators reuse the same singleton conditions. Reference the existing addresses, don’t deploy new instances:Stateless Conditions
Prefer stateless conditions when possible:Next Steps
Hooks
Learn about the state recording system.
Combinators
Compose conditions with And/Or/Not logic.
Custom Conditions
Build your own condition contracts.
Examples
See complete configuration examples.
