Skip to content

Commit 5e00770

Browse files
authored
Merge pull request #145 from gnoswap-labs/GSW-783-fix-reduce-iteration-time
[GSW-783] fix: reduce iteration time
2 parents 79f419b + 317732c commit 5e00770

23 files changed

+2459
-1514
lines changed

_test/_TEST_scenario_01_test.gnoa renamed to _test/_TEST_scenario_01_full_happy_case_test.gno

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ func TestRouterSwapRouteBarBazExactOut(t *testing.T) {
430430
shouldEQ(t, swapResult, bigint(5000))
431431

432432
shouldEQ(t, balanceOf(barObj, tr01), 99895000)
433-
shouldEQ(t, balanceOf(bazObj, tr01), 102099834)
433+
shouldEQ(t, balanceOf(bazObj, tr01), 102099835)
434434

435435
std.TestSkipHeights(2)
436436
}
@@ -488,7 +488,7 @@ func TestRouterSwapRouteWgnotFooBazBarExactIn(t *testing.T) {
488488
"100", // quoteArr
489489
300000, // tokenAmountLimit
490490
)
491-
shouldEQ(t, swapResult, bigint(199900))
491+
shouldEQ(t, swapResult, bigint(9984))
492492

493493
shouldEQ(t, balanceOf(barObj, tr01), 99894999)
494494
shouldEQ(t, wugnotBalanceOf(tr01), 99995)
@@ -502,7 +502,7 @@ func TestPositionCollectFeeLpTokenId_1(t *testing.T) {
502502
tokenId, amount0, amount1, poolPath := pos.CollectFee(1)
503503
shouldEQ(t, tokenId, uint64(1))
504504
shouldEQ(t, amount0, bigint(19))
505-
shouldEQ(t, amount1, bigint(198))
505+
shouldEQ(t, amount1, bigint(200))
506506
shouldEQ(t, poolPath, "gno.land/r/demo/bar:gno.land/r/demo/baz:100")
507507

508508
std.TestSkipHeights(1)
@@ -516,7 +516,7 @@ func TestPositionCollectFeeLpTokenId_4(t *testing.T) {
516516
tokenId, amount0, amount1, poolPath := pos.CollectFee(4)
517517
shouldEQ(t, tokenId, uint64(4))
518518
shouldEQ(t, amount0, bigint(199))
519-
shouldEQ(t, amount1, bigint(18))
519+
shouldEQ(t, amount1, bigint(20))
520520
shouldEQ(t, poolPath, "gno.land/r/demo/baz:gno.land/r/demo/foo:100")
521521

522522
std.TestSkipHeights(1)
@@ -548,8 +548,8 @@ func TestStakerUnstake(t *testing.T) {
548548
// it will return unstaked position's poolPath, amount0, amount1 ( not reward )
549549
poolPath, amount0, amount1 := stk.UnstakeToken(1)
550550
shouldEQ(t, poolPath, "gno.land/r/demo/bar:gno.land/r/demo/baz:100")
551-
shouldEQ(t, amount0, bigint(604921))
552-
shouldEQ(t, amount1, bigint(7900364))
551+
shouldEQ(t, amount0, bigint(604922))
552+
shouldEQ(t, amount1, bigint(7900345))
553553

554554
std.TestSkipHeights(1)
555555
}
@@ -558,8 +558,8 @@ func TestPositionBurnUnstakedPosition(t *testing.T) {
558558
tokenId, liquidity, amount0, amount1, poolPath := pos.Burn(1)
559559
shouldEQ(t, tokenId, uint64(1))
560560
shouldEQ(t, liquidity, bigint(4473213901))
561-
shouldEQ(t, amount0, bigint(604921))
562-
shouldEQ(t, amount1, bigint(7900364))
561+
shouldEQ(t, amount0, bigint(604922))
562+
shouldEQ(t, amount1, bigint(7900345))
563563
shouldEQ(t, poolPath, "gno.land/r/demo/bar:gno.land/r/demo/baz:100")
564564

565565
std.TestSkipHeights(1)

_test/_TEST_scenario_02_FAIL_too_small_amount_test.gno renamed to _test/_TEST_scenario_02_FAIL_too_small_amount_test.gnoa

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func TestRouterDrySwapBarBazExactIn(t *testing.T) {
175175
"gno.land/r/demo/bar:gno.land/r/demo/baz:100,gno.land/r/demo/bar:gno.land/r/demo/baz:100", // strRouteArr
176176
"95,5", // quoteArr
177177
)
178-
shouldEQ(t, dryResult, bigint(160))
178+
shouldEQ(t, dryResult, bigint(-1))
179179
}
180180

181181
func TestRouterSwapBarBazExactIn(t *testing.T) {

_test/_TEST_scenario_03_FAIL_liquidity_test.gno renamed to _test/_TEST_scenario_03_FAIL_liquidity_test.gnoa

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
pl "gno.land/r/demo/pool"
1515
pos "gno.land/r/demo/position"
16-
rou "gno.land/r/demo/router"
16+
rou "gno.land/r/demo/router"
1717

1818
"gno.land/r/demo/bar"
1919
"gno.land/r/demo/baz"
@@ -175,7 +175,7 @@ func TestRouterDrySwapBarBazExactIn(t *testing.T) {
175175
"gno.land/r/demo/bar:gno.land/r/demo/baz:100,gno.land/r/demo/bar:gno.land/r/demo/baz:100", // strRouteArr
176176
"95,5", // quoteArr
177177
)
178-
shouldEQ(t, dryResult, bigint(160))
178+
shouldEQ(t, dryResult, bigint(-1))
179179
}
180180

181181
func TestRouterSwapBarBazExactIn(t *testing.T) {

0 commit comments

Comments
 (0)