Section 9 of 18
Pool: Removing Liquidity (burn and collect)
Key takeaway: Removing liquidity from V3 is a two-phase exit.
burnismintwith the sign flipped — it calls_modifyPositionwith a negative liquidity delta, and instead of transferring the freed tokens it credits them (principal plus any settled fees) toposition.tokensOwed.collectis the only function in the entire pool through which position funds leave: it clamps the requested amounts to what is actually owed, decrements first, transfers second. The split gives the protocol one auditable exit door and gives LPs a free primitive:burn(tickLower, tickUpper, 0)— the "poke" — forces fee settlement without touching liquidity.
What You Are Building
Two functions: burn, which un-does what mint did and accrues what you are owed, and collect, which pays it out. _modifyPosition and _updatePosition from section 8 are included as working code — burn's entire job is to call them with a negative sign and book the result.
Your Code
Requirements
Sign up free — keep reading + earn 15 Lynx
Zealynx Academy is free. Track your progress, earn Lynx, and climb the leaderboard.
Sign up free to continueAlready have an account? Log in