VOLUME_POLICY
Per-transaction min and/or max amount limits per token denom. Used for dust prevention and single-tx caps.
Enforces per-transaction min/max amount limits for one or more token denoms. Each transaction is evaluated independently against the limits — no rolling window, no cumulative tracking. For period-based cumulative limits, see PERIODIC_VOLUME_POLICY.
Solidity struct + ABI
From
IPcl.sol:struct VolumeUnitPolicy {
uint256 minLimit; // 0 means no minimum limit
uint256 maxLimit; // type(uint256).max means no maximum limit
}
struct VolumePolicy {
string[] tokens; // denom names, e.g. "aokrw"
VolumeUnitPolicy[] limits; // parallel array — limits[i] applies to tokens[i]
} ABI tuple shorthand:
Encode for
(string[] tokens, (uint256 minLimit, uint256 maxLimit)[] limits).Encode for
PolicySet.policy:VolumeUnitPolicy[] memory limits = new VolumeUnitPolicy[](1);
limits[0] = VolumeUnitPolicy({
minLimit: 0,
maxLimit: 1_000_000 ether // 1,000,000 OKRW cap per tx (10^6 * 10^18 aokrw)
});
string[] memory toks = new string[](1);
toks[0] = "aokrw";
VolumePolicy memory vp = VolumePolicy({ tokens: toks, limits: limits });
bytes memory policyBytes = abi.encode(vp); Evaluation
For each token transferred in the transaction, PCL looks up the matching
VolumeUnitPolicy (by index in the parallel tokens / limits arrays) and checks the amount. If amount < minLimit → reject; if amount > maxLimit → reject. Multi-denom transactions are evaluated denom-by-denom.ReasonCodes on rejection
VolumeBelowMinLimit(uint256 minLimit, uint256 value)—minLimitnot met. Wallet UX: suggest a higher amount or block.VolumeAboveMaxLimit(uint256 maxLimit, uint256 value)—maxLimitexceeded. Wallet UX: suggest splitting the transfer or block.
Typical usage
- Single-tx caps for safety: a max of e.g. 1,000,000 OKRW per individual transfer to limit damage from key compromise.
- Dust prevention: a small
minLimitblocks tiny denial-of-service style transfers that target state bloat. - Combine with
PERIODIC_VOLUME_POLICYfor daily/monthly caps spanning multiple transactions.