VolumePolicy
The VolumePolicy enforces minimum and maximum value constraints on individual transactions. It compares a value extracted from the transaction against configured bounds and rejects if the value falls outside the allowed range.
Configuration
Both bounds are set when the policy is first deployed and can be updated independently afterward by the policy owner.
Minimum amount
The minimum defines the lowest acceptable value for the extracted parameter. Any transaction where the extracted value is below this number will be rejected.
Setting the minimum to 0 effectively disables the lower bound — all values will pass the minimum check.
Maximum amount
The maximum defines the highest acceptable value for the extracted parameter. Any transaction where the extracted value exceeds this number will be rejected.
Setting the maximum to 0 disables the upper bound — there will be no ceiling on the value.
Runtime behavior
The policy expects exactly one parameter from the extractor:
| Parameter | Type | Description |
|---|---|---|
amount | uint256 | The value to check against the configured bounds. |
run()— Reverts ifamount < minor (whenmax != 0)amount > max. ReturnsContinueotherwise.postRun()— No state changes.
API reference
Setter functions
setMin(uint256 minAmount)— Updates the minimum. Must be strictly less than the current maximum (unless max is0). Reverts if the new value is the same as the current minimum.setMax(uint256 maxAmount)— Updates the maximum. Must be strictly greater than the current minimum (unless setting to0). Reverts if the new value is the same as the current maximum.
View functions
getMin()— Returns the current minimum.getMax()— Returns the current maximum.
Use cases
- Transfer range limits — Require transfers to fall within a minimum and maximum amount.
- Anti-dust protection — Reject extremely small transactions that could be disruptive.