Section 10 of 10

Final Build
+50 Lynx

Ship Your CLM Protocol

Final Build

Submit your complete protocol and run the full test suite. Earn the "clm-builder" badge on completion.

Ship Your Concentrated Liquidity Manager

What You Have Built

Over the past four sections, you have built a complete Uniswap V3 style concentrated liquidity protocol from scratch:

  1. Tick library: The Tick.Info struct with liquidityGross, liquidityNet, and feeGrowthOutside tracking. The update() function that manages liquidity changes at tick boundaries with correct sign conventions. The cross() function that flips fee growth accounting when the price crosses an initialized tick.

  2. Position library: Unique position keys computed from (owner, tickLower, tickUpper). The update() function that calculates earned fees from fee growth snapshots and manages liquidity changes. The tokensOwed accumulator for deferred withdrawals.

  3. Pool contract with swap loop: The computeSwapStep() function that handles fee deduction, price movement within a single tick range, and output calculation. The main swap() function with its while loop that processes trades across multiple tick boundaries, accumulates fees into feeGrowthGlobal, and crosses ticks when the price reaches their boundary.

  4. Position Manager: The mint/burn/collect lifecycle. Position creation with tick range validation and token amount calculation based on current price. The two-step burn then collect pattern that separates accounting from transfers.

  5. Oracle: Ring buffer observation storage with tickCumulative tracking. The write() function for recording observations during swaps. The observe() function for querying time-weighted average prices.

What the Test Suite Checks

The final build test verifies that your complete protocol includes:

  • Both the Tick and Position libraries with their core data structures
  • Tick crossing logic that correctly flips fee growth values
  • The sqrtPriceX96 state variable and active liquidity tracking
  • Global fee growth counters for both tokens
  • A swap function with the iterative loop for crossing tick boundaries
  • The computeSwapStep function with proper fee tier deduction
  • Position lifecycle functions: mint, burn, and collect
  • Oracle observations with tickCumulative for TWAP queries
  • Access control or reentrancy protection
  • Events for all key operations (Swap, PositionMinted, LiquidityBurned, FeesCollected)

Validation

Paste your complete protocol code below and run the full test suite. All contracts and libraries should be in a single submission.

What Comes Next

You now have a working implementation of the architecture that powers over $1 billion in daily trading volume across DeFi. From here you can:

  • Deploy to a testnet and verify the contracts on a block explorer
  • Add a full ERC-721 implementation to the Position Manager for NFT composability
  • Implement the TickBitmap for gas efficient tick traversal (the production V3 approach)
  • Build a periphery Router with multicall support and deadline enforcement
  • Add flash loan support through the swap callback pattern
  • Run the Zealynx Krait security checklist against your code for a thorough security review
  • Study Beefy CLM vaults to understand how yield aggregators build on top of concentrated liquidity positions

This protocol is real. You understand every data structure, every sign convention, every fee accounting trick. That is the difference between reading documentation and building from scratch.

Your Complete Protocol

Solution.sol
Solidity
Loading editor...