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

ERC4626BaseAssertion

Git Source

Inherits: Assertion

Title: ERC4626BaseAssertion

Author: Phylax Systems

Base contract for ERC-4626 vault assertions (V2 syntax).

Provides vault-specific state accessors on top of the shared Assertion helpers. Inherit from this (and one or more invariant contracts), then implement triggers(). Example – combine share-price, preview, and outflow invariants:

contract MyVaultAssertion is ERC4626SharePriceAssertion, ERC4626PreviewAssertion, ERC4626CumulativeOutflowAssertion {
constructor(address _vault)
ERC4626BaseAssertion(_vault)
ERC4626SharePriceAssertion(50) // 50 bps tolerance
ERC4626CumulativeOutflowAssertion(1_000, 24 hours) // 10% in 24h
{}
function triggers() external view override {
_registerSharePriceTriggers();
_registerPreviewTriggers();
_registerCumulativeOutflowTriggers();
}
}

Constants

vault

The ERC-4626 vault being monitored (assertion adopter).

address internal immutable vault

asset

The underlying ERC-20 asset of the vault.

address internal immutable asset

Functions

constructor

constructor(address _vault) ;

_totalAssetsAt

function _totalAssetsAt(PhEvm.ForkId memory fork) internal view returns (uint256);

_totalSupplyAt

function _totalSupplyAt(PhEvm.ForkId memory fork) internal view returns (uint256);

_shareBalanceAt

function _shareBalanceAt(address account, PhEvm.ForkId memory fork) internal view returns (uint256);

_assetBalanceAt

Uses the same balanceOf(address) selector — valid for any ERC-20.

function _assetBalanceAt(address account, PhEvm.ForkId memory fork) internal view returns (uint256);