ERC4626CumulativeOutflowAssertion
Inherits: ERC4626BaseAssertion
Title: ERC4626CumulativeOutflowAssertion
Author: Phylax Systems
Circuit breaker that triggers when cumulative ERC-20 outflow from the vault exceeds a percentage threshold within a rolling time window. Invariant covered:
- Cumulative outflow cap: the net outflow of the vault’s underlying asset must not
exceed
outflowThresholdBpsof the TVL snapshot within a rollingoutflowWindowDuration.
Uses watchCumulativeOutflow trigger registration — the executor handles all persistent
state tracking, TVL snapshots, and threshold enforcement internally. The assertion
function fires only when the threshold is breached.
Override assertCumulativeOutflow for smart breaker logic (e.g. deposit/repay-only mode).
The default implementation unconditionally reverts (hard breaker).
Constants
outflowThresholdBps
Maximum cumulative outflow as basis points of the TVL snapshot. 1000 = 10%.
uint256 public immutable outflowThresholdBps
outflowWindowDuration
Rolling window length in seconds.
uint256 public immutable outflowWindowDuration
Functions
constructor
constructor(uint256 _thresholdBps, uint256 _windowDuration) ;
_registerCumulativeOutflowTriggers
Register the cumulative outflow circuit breaker trigger.
Call this inside your triggers().
function _registerCumulativeOutflowTriggers() internal view;
assertCumulativeOutflow
Called when cumulative outflow exceeds the threshold.
Default is a hard breaker (unconditional revert). Override for smart breaker
logic — e.g. allow deposits but block withdrawals using ph.outflowContext()
and _matchingCalls().
function assertCumulativeOutflow() external virtual;