Skip to main content
Use this page as a reference catalog when you already know the class of risk you want to cover and need a matching assertion pattern. If you want to understand a historical exploit first, use the hack case studies.

Access Control & Administrative Changes

  • Implementation Address Change: Protects against unauthorized changes to proxy implementation addresses, preventing attackers from replacing contract logic with malicious code.
  • KYC Whitelist: Ensures that only KYC accredited users can interact with a contract based on a unified KYC registry.
  • Owner Change: Ensures ownership of a contract cannot be transferred unexpectedly, preventing attackers from gaining administrative control over critical protocol functions.
  • Timelock Verification: Verifies that administrative actions are executed only after the required timelock period, preventing rushed or malicious changes to protocol parameters.

Liquidity Pool & AMM Security

  • Constant Product: Ensures the constant product formula (k = x * y) is maintained in AMM pools, preventing price manipulation attacks and unauthorized token drains.
  • Price Within Ticks: Verifies that concentrated liquidity positions in AMM protocols maintain prices within expected tick boundaries, protecting against price manipulation.
  • Fee Calculations: Ensures trading fees are correctly calculated and distributed, preventing fee theft or unexpected losses in AMM protocols.

Lending Protocol Safety

  • Lending Health Factor: Enforces minimum health factor requirements in lending protocols, preventing under-collateralized positions and protecting protocol solvency.
  • Liquidation Health Factor: Ensures liquidations only occur when health factors fall below the liquidation threshold, protecting borrowers from premature or incorrect liquidations.
  • Sum of All Positions: Verifies that the sum of all user positions matches the total asset balance, detecting accounting errors or unauthorized fund movements.
  • Tokens Borrowed Invariant: Enforces that the relationship between borrowed tokens and collateral remains within safe protocol limits, preventing critical invariant violations.

Oracle Security

  • Oracle Liveness Validation: Verifies that oracle data is fresh enough for protocol operations that rely on it.
  • TWAP Deviation: Compares pre-transaction and post-transaction TWAP values and tracks intra-transaction price changes.
  • Intra-tx Oracle Deviation: Checks that oracle price updates stay within an allowed deviation range during a transaction.

Circuit Breakers

Native Asset Protection

  • Ether Drain: Limits sudden ETH outflows and requires trusted destinations for large withdrawals.

Vault & ERC4626 Security

  • ERC4626 Assets to Shares: Verifies correct conversion between assets and shares in ERC4626 vaults, preventing accounting errors that could lead to fund loss.
  • ERC4626 Deposit and Withdraw Share Price: Checks that deposit and withdraw calls do not reduce the vault share price across matched call snapshots.
  • Harvest Increases Balance: Verifies that yield-generating operations like harvests always increase the total balance of vaults, preventing value extraction attacks.

Emergency & Special Mode Protection

  • Panic State Validation: Validates critical protocol state variables during panic or emergency modes, ensuring fallback mechanisms work correctly when normal operations are suspended.

Next: Explore previous hacks analysis to see how assertions could have prevented real-world exploits.