From d5ce3fadb826d1e2603a2215110990a4cae6909f Mon Sep 17 00:00:00 2001 From: Jack the Pug Date: Fri, 17 Jan 2025 22:44:04 +0700 Subject: [PATCH] Update `decrease-liquidity.md` to fix a bug in the demo code (#856) --- .../guides/providing-liquidity/decrease-liquidity.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/contracts/v3/guides/providing-liquidity/decrease-liquidity.md b/docs/contracts/v3/guides/providing-liquidity/decrease-liquidity.md index 9696f43e1f..f16611fe84 100644 --- a/docs/contracts/v3/guides/providing-liquidity/decrease-liquidity.md +++ b/docs/contracts/v3/guides/providing-liquidity/decrease-liquidity.md @@ -37,7 +37,16 @@ Here we decrease the liquidity of our position without withdrawing all of it. deadline: block.timestamp }); - (amount0, amount1) = nonfungiblePositionManager.decreaseLiquidity(params); + nonfungiblePositionManager.decreaseLiquidity(params); + + (amount0, amount1) = nonfungiblePositionManager.collect( + INonfungiblePositionManager.CollectParams({ + tokenId: tokenId, + recipient: address(this), + amount0Max: type(uint128).max, + amount1Max: type(uint128).max + }) + ); //send liquidity back to owner _sendToOwner(tokenId, amount0, amount1);