Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
r3v4s committed Jan 22, 2025
1 parent c5123e7 commit aed9cbc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions contract/r/gnoswap/position/position.gno
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ func DecreaseLiquidity(
// If unwrapResult is true and the position involves WUGNOT, any leftover WUGNOT will be
// unwrapped to GNOT at the end of the operation.
// Returns tokenId, liquidity, fee0, fee1, amount0, amount1, poolPath
func decreaseLiquidity(params DecreaseLiquidityParams) (uint64, *u256.Uint, *u256.Uint, *u256.Uint, *u256.Uint, *u256.Uint, string) {
func decreaseLiquidity(params DecreaseLiquidityParams) (uint64, *u256.Uint, *u256.Uint, *u256.Uint, *u256.Uint, *u256.Uint, string)
verifyTokenIdAndOwnership(params.tokenId)

// BEFORE DECREASE LIQUIDITY, COLLECT FEE FIRST
Expand All @@ -828,6 +828,10 @@ func decreaseLiquidity(params DecreaseLiquidityParams) (uint64, *u256.Uint, *u25
}

caller := getPrevAddr()
// NOTE: XXX
// Currently, wugnot is using users.AddressOrName so we have no choice but to change type for it.
// When, wugnot is using std.Address, we can remove converting.
// This applies to every wugnot related calls.
beforeWugnotBalance := wugnot.BalanceOf(common.AddrToUser(caller)) // before unwrap

pToken0, pToken1, pFee := splitOf(position.poolKey)
Expand Down Expand Up @@ -906,7 +910,7 @@ func decreaseLiquidity(params DecreaseLiquidityParams) (uint64, *u256.Uint, *u25
handleUnwrap(pToken0, pToken1, params.unwrapResult, beforeWugnotBalance, caller)

return params.tokenId, liquidityToRemove, fee0, fee1, collectAmount0, collectAmount1, position.poolKey
}


// CollectFee collects swap fee from the position
// Returns tokenId, afterFee0, afterFee1, poolPath, origFee0, origFee1
Expand Down

0 comments on commit aed9cbc

Please sign in to comment.