From 7a5e12cb3e53d7311d698efe746666013f26fd5f Mon Sep 17 00:00:00 2001 From: n3wbie Date: Wed, 13 Dec 2023 21:57:13 +0900 Subject: [PATCH] GSW-679 fix: position liquidity --- position/position.gno | 15 +++------------ position/type.gno | 8 +++----- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/position/position.gno b/position/position.gno index 48d552d6..31b9044e 100644 --- a/position/position.gno +++ b/position/position.gno @@ -158,16 +158,12 @@ func increaseLiquidity(params IncreaseLiquidityParams) (bigint, bigint, bigint) func DecreaseLiquidity( tokenId uint64, liquidity bigint, - amount0Min bigint, - amount1Min bigint, deadline bigint, ) (bigint, bigint) { decreaseLiquidityParams := DecreaseLiquidityParams{ - tokenId: tokenId, - liquidity: liquidity, - amount0Min: amount0Min, - amount1Min: amount1Min, - deadline: deadline, + tokenId: tokenId, + liquidity: liquidity, + deadline: deadline, } return decreaseLiquidity(decreaseLiquidityParams) @@ -184,9 +180,6 @@ func decreaseLiquidity(params DecreaseLiquidityParams) (bigint, bigint) { position := positions[params.tokenId] positionLiquidity := position.liquidity - // r3v4_xxx - // panic or remove entire liquidity(for now) - // require(positionLiquidity >= params.liquidity, ufmt.Sprintf("[POSITION] position.gno__decreaseLiquidity() || positionLiquidity(%s) >= params.liquidity(%s)", positionLiquidity, params.liquidity)) if positionLiquidity < params.liquidity { // remove entire liquidity params.liquidity = positionLiquidity @@ -197,8 +190,6 @@ func decreaseLiquidity(params DecreaseLiquidityParams) (bigint, bigint) { amount0, amount1 := p.Burn(pToken0, pToken1, pFee, position.tickLower, position.tickUpper, params.liquidity) - require(amount0 >= params.amount0Min && amount1 >= params.amount1Min, ufmt.Sprintf("[POSITION] position.gno__decreaseLiquidity() || amount0(%s) >= params.amount0Min(%s) && amount1(%s) >= params.amount1Min(%s)", amount0, params.amount0Min, amount1, params.amount1Min)) - positionKey := positionKeyCompute(GetOrigPkgAddr(), position.tickLower, position.tickUpper) feeGrowthInside0LastX128, feeGrowthInside1LastX128 := pool.PoolGetPositionFeeGrowthInside0LastX128(positionKey), pool.PoolGetPositionFeeGrowthInside1LastX128(positionKey) diff --git a/position/type.gno b/position/type.gno index 52428b94..2c66f29e 100644 --- a/position/type.gno +++ b/position/type.gno @@ -58,11 +58,9 @@ type IncreaseLiquidityParams struct { } type DecreaseLiquidityParams struct { - tokenId uint64 - liquidity bigint - amount0Min bigint - amount1Min bigint - deadline bigint + tokenId uint64 + liquidity bigint + deadline bigint } type CollectParams struct {