ERC4626BaseAssertion
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, address _asset)
ERC4626BaseAssertion(_vault, _asset)
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
Accepts the asset address explicitly so the constructor never reads from the adopter.
The Credible Layer’s assertion-deploy runtime is isolated from the calling test state,
so a vault.asset() call inside the constructor would revert with EXTCODESIZE = 0.
constructor(address _vault, address _asset) ;
Parameters
| Name | Type | Description |
|---|---|---|
_vault | address | The ERC-4626 vault being monitored (assertion adopter). |
_asset | address | The vault’s underlying ERC-20 asset. |
_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);