From ab7c9c51a34bf49470d7016d37091a31a79693f9 Mon Sep 17 00:00:00 2001 From: n3wbie Date: Tue, 17 Dec 2024 20:01:18 +0900 Subject: [PATCH] chore: remove `filename__function()` in error msg template --- position/_RPC_api.gno | 76 +++++++--------- position/liquidity_management.gno | 2 +- position/position.gno | 87 +++++++++---------- ..._TEST_position_increase_decrease_test.gnoA | 2 +- ...T_position_reposition_grc20_pair_test.gnoA | 6 +- position/wrap_unwrap.gno | 2 +- 6 files changed, 77 insertions(+), 98 deletions(-) diff --git a/position/_RPC_api.gno b/position/_RPC_api.gno index 9a914764a..ce33ed9b0 100644 --- a/position/_RPC_api.gno +++ b/position/_RPC_api.gno @@ -74,7 +74,7 @@ func ApiGetPositions() string { // RESPONSE (ARRAY) NODE responses := json.ArrayNode("", []*json.Node{}) for _, position := range r.Response { - _positionNode := json.ObjectNode("", map[string]*json.Node{ + positionNode := json.ObjectNode("", map[string]*json.Node{ "lpTokenId": json.NumberNode("lpTokenId", float64(position.LpTokenId)), "burned": json.BoolNode("burned", position.Burned), "owner": json.StringNode("owner", gnft.OwnerOf(tokenIdFrom(position.LpTokenId)).String()), @@ -92,7 +92,7 @@ func ApiGetPositions() string { "fee0Unclaimed": json.StringNode("fee0Unclaimed", position.FeeUnclaimed0), "fee1Unclaimed": json.StringNode("fee1Unclaimed", position.FeeUnclaimed1), }) - responses.AppendArray(_positionNode) + responses.AppendArray(positionNode) } node := json.ObjectNode("", map[string]*json.Node{ @@ -128,7 +128,7 @@ func ApiGetPosition(lpTokenId uint64) string { } // STAT NODE - _stat := json.ObjectNode("", map[string]*json.Node{ + stat := json.ObjectNode("", map[string]*json.Node{ "height": json.NumberNode("height", float64(std.GetHeight())), "timestamp": json.NumberNode("timestamp", float64(time.Now().Unix())), }) @@ -136,7 +136,7 @@ func ApiGetPosition(lpTokenId uint64) string { // RESPONSE (ARRAY) NODE responses := json.ArrayNode("", []*json.Node{}) for _, position := range r.Response { - _positionNode := json.ObjectNode("", map[string]*json.Node{ + positionNode := json.ObjectNode("", map[string]*json.Node{ "lpTokenId": json.NumberNode("lpTokenId", float64(position.LpTokenId)), "burned": json.BoolNode("burned", position.Burned), "owner": json.StringNode("owner", gnft.OwnerOf(tokenIdFrom(position.LpTokenId)).String()), @@ -154,11 +154,11 @@ func ApiGetPosition(lpTokenId uint64) string { "fee0Unclaimed": json.StringNode("fee0Unclaimed", position.FeeUnclaimed0), "fee1Unclaimed": json.StringNode("fee1Unclaimed", position.FeeUnclaimed1), }) - responses.AppendArray(_positionNode) + responses.AppendArray(positionNode) } node := json.ObjectNode("", map[string]*json.Node{ - "stat": _stat, + "stat": stat, "response": responses, }) @@ -192,7 +192,7 @@ func ApiGetPositionsByPoolPath(poolPath string) string { } // STAT NODE - _stat := json.ObjectNode("", map[string]*json.Node{ + stat := json.ObjectNode("", map[string]*json.Node{ "height": json.NumberNode("height", float64(std.GetHeight())), "timestamp": json.NumberNode("timestamp", float64(time.Now().Unix())), }) @@ -200,7 +200,7 @@ func ApiGetPositionsByPoolPath(poolPath string) string { // RESPONSE (ARRAY) NODE responses := json.ArrayNode("", []*json.Node{}) for _, position := range r.Response { - _positionNode := json.ObjectNode("", map[string]*json.Node{ + positionNode := json.ObjectNode("", map[string]*json.Node{ "lpTokenId": json.NumberNode("lpTokenId", float64(position.LpTokenId)), "burned": json.BoolNode("burned", position.Burned), "owner": json.StringNode("owner", gnft.OwnerOf(tokenIdFrom(position.LpTokenId)).String()), @@ -218,11 +218,11 @@ func ApiGetPositionsByPoolPath(poolPath string) string { "fee0Unclaimed": json.StringNode("fee0Unclaimed", position.FeeUnclaimed0), "fee1Unclaimed": json.StringNode("fee1Unclaimed", position.FeeUnclaimed1), }) - responses.AppendArray(_positionNode) + responses.AppendArray(positionNode) } node := json.ObjectNode("", map[string]*json.Node{ - "stat": _stat, + "stat": stat, "response": responses, }) @@ -255,7 +255,7 @@ func ApiGetPositionsByAddress(address std.Address) string { } // STAT NODE - _stat := json.ObjectNode("", map[string]*json.Node{ + stat := json.ObjectNode("", map[string]*json.Node{ "height": json.NumberNode("height", float64(std.GetHeight())), "timestamp": json.NumberNode("timestamp", float64(time.Now().Unix())), }) @@ -263,7 +263,7 @@ func ApiGetPositionsByAddress(address std.Address) string { // RESPONSE (ARRAY) NODE responses := json.ArrayNode("", []*json.Node{}) for _, position := range r.Response { - _positionNode := json.ObjectNode("", map[string]*json.Node{ + positionNode := json.ObjectNode("", map[string]*json.Node{ "lpTokenId": json.NumberNode("lpTokenId", float64(position.LpTokenId)), "burned": json.BoolNode("burned", position.Burned), "owner": json.StringNode("owner", gnft.OwnerOf(tokenIdFrom(position.LpTokenId)).String()), @@ -281,11 +281,11 @@ func ApiGetPositionsByAddress(address std.Address) string { "fee0Unclaimed": json.StringNode("fee0Unclaimed", position.FeeUnclaimed0), "fee1Unclaimed": json.StringNode("fee1Unclaimed", position.FeeUnclaimed1), }) - responses.AppendArray(_positionNode) + responses.AppendArray(positionNode) } node := json.ObjectNode("", map[string]*json.Node{ - "stat": _stat, + "stat": stat, "response": responses, }) @@ -309,7 +309,7 @@ func ApiGetPositionsUnclaimedFee() string { } // STAT NODE - _stat := json.ObjectNode("", map[string]*json.Node{ + stat := json.ObjectNode("", map[string]*json.Node{ "height": json.NumberNode("height", float64(std.GetHeight())), "timestamp": json.NumberNode("timestamp", float64(time.Now().Unix())), }) @@ -317,16 +317,16 @@ func ApiGetPositionsUnclaimedFee() string { // RESPONSE (ARRAY) NODE responses := json.ArrayNode("", []*json.Node{}) for _, unclaimedFee := range rpcUnclaimedFee { - _unclaimedFeeNode := json.ObjectNode("", map[string]*json.Node{ + unclaimedFeeNode := json.ObjectNode("", map[string]*json.Node{ "lpTokenId": json.NumberNode("lpTokenId", float64(unclaimedFee.LpTokenId)), "fee0": json.StringNode("fee0", unclaimedFee.Fee0), "fee1": json.StringNode("fee1", unclaimedFee.Fee1), }) - responses.AppendArray(_unclaimedFeeNode) + responses.AppendArray(unclaimedFeeNode) } node := json.ObjectNode("", map[string]*json.Node{ - "stat": _stat, + "stat": stat, "response": responses, }) @@ -349,7 +349,7 @@ func ApiGetPositionUnclaimedFeeByLpTokenId(lpTokenId uint64) string { }) // STAT NODE - _stat := json.ObjectNode("", map[string]*json.Node{ + stat := json.ObjectNode("", map[string]*json.Node{ "height": json.NumberNode("height", float64(std.GetHeight())), "timestamp": json.NumberNode("timestamp", float64(time.Now().Unix())), }) @@ -357,16 +357,16 @@ func ApiGetPositionUnclaimedFeeByLpTokenId(lpTokenId uint64) string { // RESPONSE (ARRAY) NODE responses := json.ArrayNode("", []*json.Node{}) for _, unclaimedFee := range rpcUnclaimedFee { - _unclaimedFeeNode := json.ObjectNode("", map[string]*json.Node{ + unclaimedFeeNode := json.ObjectNode("", map[string]*json.Node{ "lpTokenId": json.NumberNode("lpTokenId", float64(unclaimedFee.LpTokenId)), "fee0": json.StringNode("fee0", unclaimedFee.Fee0), "fee1": json.StringNode("fee1", unclaimedFee.Fee1), }) - responses.AppendArray(_unclaimedFeeNode) + responses.AppendArray(unclaimedFeeNode) } node := json.ObjectNode("", map[string]*json.Node{ - "stat": _stat, + "stat": stat, "response": responses, }) @@ -426,8 +426,8 @@ func unclaimedFee(tokenId uint64) (*i256.Int, *i256.Int) { position := MustGetPosition(tokenId) - _liquidity := position.liquidity - liquidity := i256.FromUint256(_liquidity) + liquidityU256 := position.liquidity + liquidity := i256.FromUint256(liquidityU256) tickLower := position.tickLower tickUpper := position.tickUpper @@ -437,29 +437,17 @@ func unclaimedFee(tokenId uint64) (*i256.Int, *i256.Int) { currentTick := pool.Slot0Tick() - _feeGrowthGlobal0X128 := pool.FeeGrowthGlobal0X128() // u256 - feeGrowthGlobal0X128 := i256.FromUint256(_feeGrowthGlobal0X128) // i256 - - _feeGrowthGlobal1X128 := pool.FeeGrowthGlobal1X128() // u256 - feeGrowthGlobal1X128 := i256.FromUint256(_feeGrowthGlobal1X128) // i256 - - _tickUpperFeeGrowthOutside0X128 := pool.GetTickFeeGrowthOutside0X128(tickUpper) // u256 - tickUpperFeeGrowthOutside0X128 := i256.FromUint256(_tickUpperFeeGrowthOutside0X128) // i256 - - _tickUpperFeeGrowthOutside1X128 := pool.GetTickFeeGrowthOutside1X128(tickUpper) // u256 - tickUpperFeeGrowthOutside1X128 := i256.FromUint256(_tickUpperFeeGrowthOutside1X128) // i256 - - _tickLowerFeeGrowthOutside0X128 := pool.GetTickFeeGrowthOutside0X128(tickLower) // u256 - tickLowerFeeGrowthOutside0X128 := i256.FromUint256(_tickLowerFeeGrowthOutside0X128) // i256 + feeGrowthGlobal0X128 := i256.FromUint256(pool.GetFeeGrowthGlobal0X128()) + feeGrowthGlobal1X128 := i256.FromUint256(pool.GetFeeGrowthGlobal1X128()) - _tickLowerFeeGrowthOutside1X128 := pool.GetTickFeeGrowthOutside1X128(tickLower) // u256 - tickLowerFeeGrowthOutside1X128 := i256.FromUint256(_tickLowerFeeGrowthOutside1X128) // i256 + tickUpperFeeGrowthOutside0X128 := i256.FromUint256(pool.GetTickFeeGrowthOutside0X128(tickUpper)) + tickUpperFeeGrowthOutside1X128 := i256.FromUint256(pool.GetTickFeeGrowthOutside1X128(tickUpper)) - _feeGrowthInside0LastX128 := position.feeGrowthInside0LastX128 - feeGrowthInside0LastX128 := i256.FromUint256(_feeGrowthInside0LastX128) + tickLowerFeeGrowthOutside0X128 := i256.FromUint256(pool.GetTickFeeGrowthOutside0X128(tickLower)) + tickLowerFeeGrowthOutside1X128 := i256.FromUint256(pool.GetTickFeeGrowthOutside1X128(tickLower)) - _feeGrowthInside1LastX128 := position.feeGrowthInside1LastX128 - feeGrowthInside1LastX128 := i256.FromUint256(_feeGrowthInside1LastX128) + feeGrowthInside0LastX128 := i256.FromUint256(position.feeGrowthInside0LastX128) + feeGrowthInside1LastX128 := i256.FromUint256(position.feeGrowthInside1LastX128) var tickLowerFeeGrowthBelow0, tickLowerFeeGrowthBelow1, tickUpperFeeGrowthAbove0, tickUpperFeeGrowthAbove1 *i256.Int diff --git a/position/liquidity_management.gno b/position/liquidity_management.gno index d700bfb33..d9a77d0fe 100644 --- a/position/liquidity_management.gno +++ b/position/liquidity_management.gno @@ -49,7 +49,7 @@ func addLiquidity(params AddLiquidityParams) (*u256.Uint, *u256.Uint, *u256.Uint if !(amount0Cond && amount1Cond) { panic(addDetailToError( errSlippage, - ufmt.Sprintf("liquidity_management.gno__addLiquidity() || LM_Price Slippage Check(amount0(%s) >= params.amount0Min(%s), amount1(%s) >= params.amount1Min(%s))", amount0Uint.ToString(), params.amount0Min.ToString(), amount1Uint.ToString(), params.amount1Min.ToString()), + ufmt.Sprintf("LM_Price Slippage Check(amount0(%s) >= params.amount0Min(%s), amount1(%s) >= params.amount1Min(%s))", amount0Uint.ToString(), params.amount0Min.ToString(), amount1Uint.ToString(), params.amount1Min.ToString()), )) } diff --git a/position/position.gno b/position/position.gno index 13cace9fa..a2d1cd0ae 100644 --- a/position/position.gno +++ b/position/position.gno @@ -54,7 +54,7 @@ func Mint( if !(isUserCalled || isStakerCalled) { panic(addDetailToError( errNoPermission, - ufmt.Sprintf("position.gno__Mint() || only user or staker can call isUserCalled(%t) || isStakerCalled(%t), but called from %s", isUserCalled, isStakerCalled, prev.Addr().String()), + ufmt.Sprintf("only user or staker can call isUserCalled(%t) || isStakerCalled(%t), but called from %s", isUserCalled, isStakerCalled, prev.Addr().String()), )) } } @@ -153,7 +153,7 @@ func handleNativeToken(token0IsNative, token1IsNative bool, caller std.Address) if (newUserWugnotBalance - oldUserWugnotBalance) != ugnotSent { panic(addDetailToError( errWrapUnwrap, - ufmt.Sprintf("position.gno__Mint() || ugnot sent(%d) != wugnot received(%d)", ugnotSent, newUserWugnotBalance-oldUserWugnotBalance), + ufmt.Sprintf("ugnot sent(%d) != wugnot received(%d)", ugnotSent, newUserWugnotBalance-oldUserWugnotBalance), )) } } @@ -297,7 +297,7 @@ func increaseLiquidity(params IncreaseLiquidityParams) (uint64, *u256.Uint, *u25 if !exists(params.tokenId) { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("position.gno__increaseLiquidity() || tokenId(%d) doesn't exist", params.tokenId), + ufmt.Sprintf("tokenId(%d) doesn't exist", params.tokenId), )) } @@ -308,7 +308,7 @@ func increaseLiquidity(params IncreaseLiquidityParams) (uint64, *u256.Uint, *u25 if owner != caller { panic(addDetailToError( errNoPermission, - ufmt.Sprintf("position.gno__increaseLiquidity() || only owner(%s) can increase liquidity for tokenId(%d), but called from %s", owner, params.tokenId, caller), + ufmt.Sprintf("only owner(%s) can increase liquidity for tokenId(%d), but called from %s", owner, params.tokenId, caller), )) } @@ -358,7 +358,7 @@ func increaseLiquidity(params IncreaseLiquidityParams) (uint64, *u256.Uint, *u25 if !updated { panic(addDetailToError( errPositionDoesNotExist, - ufmt.Sprintf("position(%d) doesn't exist", params.tokenId), + ufmt.Sprintf("can not increase liquidity for non-existent position(%d)", params.tokenId), )) } @@ -384,7 +384,7 @@ func DecreaseLiquidity( if !isNormalRange { panic(addDetailToError( errOutOfRange, - ufmt.Sprintf("position.gno__decreaseLiquidity() || liquidityRatio(%d) should be in range 1 ~ 100", liquidityRatio), + ufmt.Sprintf("liquidityRatio(%d) should be in range 1 ~ 100", liquidityRatio), )) } @@ -445,7 +445,7 @@ func decreaseLiquidity(params DecreaseLiquidityParams) (uint64, *u256.Uint, *u25 if positionLiquidity.IsZero() { panic(addDetailToError( errZeroLiquidity, - ufmt.Sprintf("position.gno__decreaseLiquidity() || position(tokenId:%d) has 0 liquidity", params.tokenId), + ufmt.Sprintf("position(tokenId:%d) has 0 liquidity", params.tokenId), )) } @@ -489,8 +489,10 @@ func decreaseLiquidity(params DecreaseLiquidityParams) (uint64, *u256.Uint, *u25 position.liquidity = new(u256.Uint).Sub(positionLiquidity, liquidityToRemove) updated := setPosition(params.tokenId, position) if !updated { - // TODO: - panic("position should be updated, not newly created") + panic(addDetailToError( + errPositionDoesNotExist, + ufmt.Sprintf("can not decrease liquidity for non-existent position(%d)", params.tokenId), + )) } // GIVE BACK TO USER @@ -517,11 +519,7 @@ func decreaseLiquidity(params DecreaseLiquidityParams) (uint64, *u256.Uint, *u25 if overflow { position.tokensOwed1 = u256.Zero() } - updated = setPosition(params.tokenId, position) - if !updated { - // TODO: - panic("position should be updated, not newly created") - } + setPosition(params.tokenId, position) if position.isClear() { burnPosition(params.tokenId) // just update flag (we don't want to burn actual position) @@ -557,7 +555,7 @@ func Reposition( if !exists(tokenId) { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("position.gno__Reposition() || tokenId(%d) doesn't exist", tokenId), + ufmt.Sprintf("tokenId(%d) doesn't exist", tokenId), )) } @@ -568,7 +566,7 @@ func Reposition( if owner != caller { panic(addDetailToError( errNoPermission, - ufmt.Sprintf("position.gno__Reposition() || only owner(%s) can reposition for tokenId(%d), but called from %s", owner, tokenId, caller), + ufmt.Sprintf("only owner(%s) can reposition for tokenId(%d), but called from %s", owner, tokenId, caller), )) } @@ -580,7 +578,7 @@ func Reposition( if !(position.isClear()) { panic(addDetailToError( errNotClear, - ufmt.Sprintf("position.gno__Reposition() || position(%d) isn't clear(liquidity:%s, tokensOwed0:%s, tokensOwed1:%s)", tokenId, position.liquidity.ToString(), position.tokensOwed0.ToString(), position.tokensOwed1.ToString()), + ufmt.Sprintf("position(%d) isn't clear(liquidity:%s, tokensOwed0:%s, tokensOwed1:%s)", tokenId, position.liquidity.ToString(), position.tokensOwed0.ToString(), position.tokensOwed1.ToString()), )) } @@ -640,8 +638,10 @@ func Reposition( updated := setPosition(tokenId, position) if !updated { - // TODO: - panic("position should be updated, not newly created") + panic(addDetailToError( + errPositionDoesNotExist, + ufmt.Sprintf("can not reposition non-existent position(%d)", tokenId), + )) } poolSqrtPriceX96 := pl.PoolGetSlot0SqrtPriceX96(position.poolKey) @@ -678,7 +678,7 @@ func CollectFee(tokenId uint64, unwrapResult bool) (uint64, string, string, stri if !exists(tokenId) { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("position.gno__CollectFee() || tokenId(%d) doesn't exist", tokenId), + ufmt.Sprintf("tokenId(%d) doesn't exist", tokenId), )) } @@ -748,8 +748,10 @@ func CollectFee(tokenId uint64, unwrapResult bool) (uint64, string, string, stri updated := setPosition(tokenId, position) if !updated { - // TODO: - panic("position should be updated, not newly created") + panic(addDetailToError( + errPositionDoesNotExist, + ufmt.Sprintf("can not collect fee for non-existent position(%d)", tokenId), + )) } // handle withdrawal fee @@ -803,35 +805,22 @@ func updateTokensOwed( return new(u256.Uint).Add(tokensOwed, add) } -func burnNFT(tokenId uint64) { - isAuthorizedForToken(tokenId) - - position := MustGetPosition(tokenId) - - if !(position.isClear()) { - panic(addDetailToError( - errNotClear, - ufmt.Sprintf("position.gno__burnNFT() || position(%d) isn't clear(liquidity:%s, tokensOwed0:%s, tokensOwed1:%s)", tokenId, position.liquidity.ToString(), position.tokensOwed0.ToString(), position.tokensOwed1.ToString()), - )) - } - removePosition(tokenId) - gnft.Burn(tokenIdFrom(tokenId)) -} - func burnPosition(tokenId uint64) { position := MustGetPosition(tokenId) if !(position.isClear()) { panic(addDetailToError( errNotClear, - ufmt.Sprintf("position.gno__burnPosition() || position(%d) isn't clear(liquidity:%s, tokensOwed0:%s, tokensOwed1:%s)", tokenId, position.liquidity.ToString(), position.tokensOwed0.ToString(), position.tokensOwed1.ToString()), + ufmt.Sprintf("position(%d) isn't clear(liquidity:%s, tokensOwed0:%s, tokensOwed1:%s)", tokenId, position.liquidity.ToString(), position.tokensOwed0.ToString(), position.tokensOwed1.ToString()), )) } position.burned = true updated := setPosition(tokenId, position) if !updated { - // TODO: - panic("position should be updated, not newly created") + panic(addDetailToError( + errDataNotFound, + ufmt.Sprintf("can not burn non-existent position(%d)", tokenId), + )) } } @@ -839,7 +828,7 @@ func isAuthorizedForToken(tokenId uint64) { if !(isOwnerOrOperator(std.PrevRealm().Addr(), tokenId)) { panic(addDetailToError( errNoPermission, - ufmt.Sprintf("position.gno__isAuthorizedForToken() || caller(%s) is not approved or owner of tokenId(%d)", std.PrevRealm().Addr(), tokenId), + ufmt.Sprintf("caller(%s) is not approved or owner of tokenId(%d)", std.PrevRealm().Addr(), tokenId), )) } } @@ -848,7 +837,7 @@ func verifyTokenIdAndOwnership(tokenId uint64) { if !exists(tokenId) { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("position.gno__verifyTokenIdAndOwnership() || tokenId(%d) doesn't exist", tokenId), + ufmt.Sprintf("tokenId(%d) doesn't exist", tokenId), )) } @@ -857,7 +846,7 @@ func verifyTokenIdAndOwnership(tokenId uint64) { if owner != caller { panic(addDetailToError( errNoPermission, - ufmt.Sprintf("position.gno__verifyTokenIdAndOwnership() || only owner(%s) can decrease liquidity(tokenId:%d), but called from %s", owner, tokenId, caller), + ufmt.Sprintf("only owner(%s) can decrease liquidity(tokenId:%d), but called from %s", owner, tokenId, caller), )) } } @@ -875,7 +864,7 @@ func verifyBurnedAmounts(burnedAmount0, burnedAmount1, amount0Min, amount1Min *u if !(burnedAmount0.Gte(amount0Min) && burnedAmount1.Gte(amount1Min)) { panic(addDetailToError( errSlippage, - ufmt.Sprintf("position.gno__verifyBurnedAmounts() || burnedAmount0(%s) >= amount0Min(%s) && burnedAmount1(%s) >= amount1Min(%s)", burnedAmount0.ToString(), amount0Min.ToString(), burnedAmount1.ToString(), amount1Min.ToString()), + ufmt.Sprintf("burnedAmount0(%s) >= amount0Min(%s) && burnedAmount1(%s) >= amount1Min(%s)", burnedAmount0.ToString(), amount0Min.ToString(), burnedAmount1.ToString(), amount1Min.ToString()), )) } } @@ -893,7 +882,7 @@ func SetPositionOperator(tokenId uint64, operator std.Address) { if caller != consts.STAKER_PATH { panic(addDetailToError( errNoPermission, - ufmt.Sprintf("position.gno__SetPositionOperator() || caller(%s) is not staker", caller), + ufmt.Sprintf("caller(%s) is not staker", caller), )) } @@ -901,8 +890,10 @@ func SetPositionOperator(tokenId uint64, operator std.Address) { position.operator = operator updated := setPosition(tokenId, position) if !updated { - // TODO: - panic("position should be updated, not newly created") + panic(addDetailToError( + errPositionDoesNotExist, + ufmt.Sprintf("can not set operator for non-existent position(%d)", tokenId), + )) } } @@ -913,7 +904,7 @@ func MustGetPosition(tokenId uint64) Position { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("position.gno__MustGetPosition() || position with tokenId(%d) doesn't exist", tokenId), + ufmt.Sprintf("position with tokenId(%d) doesn't exist", tokenId), )) } return position diff --git a/position/tests/__TEST_position_increase_decrease_test.gnoA b/position/tests/__TEST_position_increase_decrease_test.gnoA index 069f1a077..5abf8059a 100644 --- a/position/tests/__TEST_position_increase_decrease_test.gnoA +++ b/position/tests/__TEST_position_increase_decrease_test.gnoA @@ -200,7 +200,7 @@ func TestDecreaseLiquidityAllThenAgainShouldPanic(t *testing.T) { // decreasing position(with 0 liquidity) should panic uassert.PanicsWithMessage( t, - `[GNOSWAP-POOL-010] zero liquidity || position.gno__positionUpdate() || both liquidityDelta and current position's liquidity are zero`, + `[GNOSWAP-POOL-010] zero liquidity || both liquidityDelta and current position's liquidity are zero`, func() { DecreaseLiquidity( uint64(1), // tokenId diff --git a/position/tests/__TEST_position_reposition_grc20_pair_test.gnoA b/position/tests/__TEST_position_reposition_grc20_pair_test.gnoA index 2e6c60624..44eb7723b 100644 --- a/position/tests/__TEST_position_reposition_grc20_pair_test.gnoA +++ b/position/tests/__TEST_position_reposition_grc20_pair_test.gnoA @@ -226,7 +226,7 @@ func TestRepositionNotOwner(t *testing.T) { std.TestSetRealm(std.NewUserRealm(test1)) uassert.PanicsWithMessage( t, - `[GNOSWAP-POSITION-001] caller has no permission || position.gno__Reposition() || only owner(g17290cwvmrapvp869xfnhhawa8sm9edpufzat7d) can reposition for tokenId(1), but called from g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5`, + `[GNOSWAP-POSITION-001] caller has no permission || only owner(g17290cwvmrapvp869xfnhhawa8sm9edpufzat7d) can reposition for tokenId(1), but called from g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5`, func() { Reposition(uint64(1), -1000, 1000, "500", "500", "0", "0") }) @@ -236,7 +236,7 @@ func TestRepositionOwnerButNowBurned(t *testing.T) { std.TestSetRealm(adminRealm) uassert.PanicsWithMessage( t, - `[GNOSWAP-POSITION-009] position is not clear || position.gno__Reposition() || position(2) isn't clear(liquidity:341464938, tokensOwed0:0, tokensOwed1:0)`, + `[GNOSWAP-POSITION-009] position is not clear || position(2) isn't clear(liquidity:341464938, tokensOwed0:0, tokensOwed1:0)`, func() { Reposition(uint64(2), -1000, 1000, "500", "500", "0", "0") }) @@ -246,7 +246,7 @@ func TestRepositionSlippageTooLarge(t *testing.T) { std.TestSetRealm(adminRealm) uassert.PanicsWithMessage( t, - `[GNOSWAP-POSITION-002] slippage failed || liquidity_management.gno__addLiquidity() || LM_Price Slippage Check(amount0(0) >= params.amount0Min(100000000000), amount1(500) >= params.amount1Min(100000000000))`, + `[GNOSWAP-POSITION-002] slippage failed || LM_Price Slippage Check(amount0(0) >= params.amount0Min(100000000000), amount1(500) >= params.amount1Min(100000000000))`, func() { Reposition(uint64(1), -1000, 1000, "500", "500", "100000000000", "100000000000") }) diff --git a/position/wrap_unwrap.gno b/position/wrap_unwrap.gno index e1c97f9d0..f0fe53955 100644 --- a/position/wrap_unwrap.gno +++ b/position/wrap_unwrap.gno @@ -17,7 +17,7 @@ func wrap(ugnotAmount uint64, to std.Address) { if ugnotAmount < consts.UGNOT_MIN_DEPOSIT_TO_WRAP { panic(addDetailToError( errWugnotMinimum, - ufmt.Sprintf("wrap.gno__wrap() || amount(%d) < minimum(%d)", ugnotAmount, consts.UGNOT_MIN_DEPOSIT_TO_WRAP), + ufmt.Sprintf("amount(%d) < minimum(%d)", ugnotAmount, consts.UGNOT_MIN_DEPOSIT_TO_WRAP), )) }