Skip to main content

When to Use This Pattern

Ensures prices remain within valid tick boundaries in concentrated liquidity AMMs, preventing price manipulation and maintaining protocol mathematical validity. Critical for AMMs using concentrated liquidity models (Uniswap V3, PancakeSwap V3), protocols with tick-based price calculations, DeFi protocols interacting with tick-based AMMs, and cross-chain bridges using tick-based price feeds. If attackers could push prices outside valid tick ranges, they could execute trades at invalid prices, manipulate liquidity positions, or cause protocol calculations to fail.

What This Pattern Checks

Implements focused tick integrity verification:
  • _preTx() / _postTx() with Reshiram snapshot reads: Capture tick state before and after transaction
  • registerTxEndTrigger(): Monitor changes to tick-related storage slots
  • Verify ticks stay within global bounds (-887272 to 887272)
  • Ensure ticks align with pool’s tick spacing requirements
The assertion maintains proper concentrated liquidity calculations and prevents position management errors by enforcing tick boundaries and spacing rules. For more information about cheatcodes, see the Cheatcodes Documentation.

Assertion Pattern

Full examples and mock protocol code are available in credible-std.