> ## Documentation Index
> Fetch the complete documentation index at: https://phylaxsystems-docs-project-incidents.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Assertion Use Cases Index

> Complete catalog of assertion patterns organized by use case category

This section contains assertion patterns organized by use case categories.

## Access Control & Administrative Changes

* [**Implementation Address Change**](/assertions-book/assertions/ass01-impl-addr-change): Protects against unauthorized changes to proxy implementation addresses, preventing attackers from replacing contract logic with malicious code.

* [**KYC Whitelist**](/assertions-book/assertions/ass04-kyc-whitelist): Ensures that only KYC accredited users can interact with a contract based on a unified KYC registry.

* [**Owner Change**](/assertions-book/assertions/ass05-ownership-change): Ensures ownership of a contract cannot be transferred unexpectedly, preventing attackers from gaining administrative control over critical protocol functions.

* [**Timelock Verification**](/assertions-book/assertions/ass09-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**](/assertions-book/assertions/ass06-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**](/assertions-book/assertions/ass15-price-within-ticks): Verifies that concentrated liquidity positions in AMM protocols maintain prices within expected tick boundaries, protecting against price manipulation.

* [**Fee Calculations**](/assertions-book/assertions/ass14-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**](/assertions-book/assertions/ass07-lending-health-factor): Enforces minimum health factor requirements in lending protocols, preventing under-collateralized positions and protecting protocol solvency.

* [**Liquidation Health Factor**](/assertions-book/assertions/ass16-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**](/assertions-book/assertions/ass08-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**](/assertions-book/assertions/ass19-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**](/assertions-book/assertions/ass10-oracle-validation): Verifies that oracle data is fresh and updated within an acceptable time window, preventing the use of stale or manipulated price data.

* [**TWAP Deviation**](/assertions-book/assertions/ass11-twap-deviation): Ensures the time-weighted average price doesn't deviate excessively from previous values, detecting price manipulation attempts or oracle failures.

* [**Intra-Transaction Oracle Deviation**](/assertions-book/assertions/ass28-intra-tx-oracle-deviation): Monitors price oracle readings during a transaction to detect excessive deviations that might indicate flash loan attacks or price manipulation.

## Vault & ERC4626 Security

* [**ERC4626 Assets to Shares**](/assertions-book/assertions/ass12-erc4626-assets-to-shares): Verifies correct conversion between assets and shares in ERC4626 vaults, preventing accounting errors that could lead to fund loss.

* [**ERC4626 Vault Operations**](/assertions-book/assertions/ass13-erc4626-deposit-withdraw): Ensures all ERC4626 operations (deposit, withdraw, mint, redeem) maintain correct accounting, with support for batch transaction validation.

* [**Harvest Increases Balance**](/assertions-book/assertions/ass18-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**](/assertions-book/assertions/ass17-panic-state-validation): Validates critical protocol state variables during panic or emergency modes, ensuring fallback mechanisms work correctly when normal operations are suspended.

## Fund Protection

* [**ERC20 Drain**](/assertions-book/assertions/ass20-erc20-drain): Prevents excessive token outflows in a single transaction, mitigating the impact of potential exploits by limiting how quickly funds can be drained.

* [**Ether Drain**](/assertions-book/assertions/ass21-ether-drain): Monitors and limits ETH outflows from contracts, protecting against unauthorized withdrawals that could deplete protocol reserves.

***

**Next:** Explore [previous hacks analysis](/assertions-book/previous-hacks/) to see how assertions could have prevented real-world exploits.
