Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

AnomalyGatedOutflowAssertion

Git Source

Inherits: AnomalyGatedBaseAssertion

Title: AnomalyGatedOutflowAssertion

Author: Phylax Systems

Reverts only when the transaction is anomalous AND drains at least outflowFracBps of a reserve token from the fund-holding contract. Either condition alone passes. Invariant covered:

  • Gated drain: an anomalous transaction may not move a large fraction of the watched reserve out of the contract that holds it. The gate suppresses the false positive a bare drain check produces on a large but benign withdrawal.

The reserve custody contract (outflowTarget) is named separately from the anomaly focal (target): a lending pool is scored while its aToken holds the drained reserve.

Constants

outflowTarget

The contract whose reserve balance the outflow is measured from.

address internal immutable outflowTarget

outflowToken

The reserve token whose net outflow corroborates a drain.

address internal immutable outflowToken

outflowFracBps

Net outflow over pre-transaction balance, in bps, at or above which the drain heuristic corroborates. Must be in [1, 10_000]: net outflow is capped by the pre-transaction balance, so a larger fraction can never corroborate.

uint256 internal immutable outflowFracBps

Functions

constructor

constructor(address _outflowTarget, address _token, uint256 _fracBps) ;

_registerOutflowTrigger

Register the anomaly trigger for the gated drain check. Call this inside triggers().

function _registerOutflowTrigger() internal view;

_outflowCorroborates

Whether the drain heuristic corroborates on this transaction.

Overridable so the composite and adopters can reuse the corroboration alone.

function _outflowCorroborates() internal view virtual returns (bool);

assertAnomalousOutflow

Reverts only when the transaction is anomalous and drains the reserve.

function assertAnomalousOutflow() external view;

Errors

AnomalousOutflow

error AnomalousOutflow();