Skip to content

Commit

Permalink
fix: rounding error
Browse files Browse the repository at this point in the history
  • Loading branch information
r3v4s committed May 3, 2024
1 parent e9254ba commit f10f0a9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
17 changes: 9 additions & 8 deletions position/_TEST_/z1_position_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ func mint01InRange() {
if amount0 != "18394892" {
panic("expected amount0 18394892")
}
if amount1 != "49999999" {
panic("expected amount1 49999999")
if amount1 != "50000000" {
panic("expected amount1 50000000")
}
}

Expand Down Expand Up @@ -278,8 +278,8 @@ func mint02LowerRange() {
if amount0 != "0" {
panic("expected amount0 0")
}
if amount1 != "49999999" {
panic("expected amount1 49999999")
if amount1 != "50000000" {
panic("expected amount1 50000000")
}
}

Expand Down Expand Up @@ -347,8 +347,8 @@ func collectFeeAfterSwap() {
if tokenId != 1 {
panic("expected tokenId 1")
}
if fee0 != "610" {
panic("expected fee0 610")
if fee0 != "611" {
panic("expected fee0 611")
}
if fee1 != "0" {
panic("expected fee1 0")
Expand All @@ -364,10 +364,11 @@ func decreaseLiquidityUpperPosition() {
panic("expected tokenId 3")
}
if amount0 != "49999999" {
panic("expected liquidity 49999999")
panic(amount0)
panic("expected amount0 49999999")
}
if amount1 != "0" {
panic("expected liquidity 0")
panic("expected amount1 0")
}

}
12 changes: 6 additions & 6 deletions position/_TEST_/z2_position_increase_decrease_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ func mint() {
if amount0 != "18394892" {
panic("expected amount0 18394892")
}
if amount1 != "49999999" {
panic("expected amount1 49999999")
if amount1 != "50000000" {
panic("expected amount1 50000000")
}
}

Expand All @@ -274,8 +274,8 @@ func increase() {
if amount0 != "3678979" {
panic("expected liquidity 3678979")
}
if amount1 != "9999999" {
panic("expected liquidity 9999999")
if amount1 != "10000000" {
panic("expected liquidity 10000000")
}

newLiquidity := pool.PoolGetLiquidity()
Expand Down Expand Up @@ -362,8 +362,8 @@ func decreaseFull() {
max_timeout, // deadline
false, // unwrapResult
)
if fee0 != "610" {
panic("expected fee0 610")
if fee0 != "611" {
panic("expected fee0 611")
}
if fee1 != "0" {
panic("expected fee1 0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ func mint01Wide() {
if amount0 != "18394892" {
panic("expected amount0 18394892")
}
if amount1 != "49999999" {
panic("expected amount1 49999999")
if amount1 != "50000000" {
panic("expected amount1 50000000")
}
}

Expand Down Expand Up @@ -283,8 +283,8 @@ func mint02Tight() {
if amount0 != "18394892" {
panic("expected amount0 18394892")
}
if amount1 != "49999999" {
panic("expected amount1 49999999")
if amount1 != "50000000" {
panic("expected amount1 50000000")
}
}

Expand Down Expand Up @@ -326,8 +326,8 @@ func collect02() {
bar.Approve(a2u(consts.POOL_ADDR), consts.UINT64_MAX) // COLLECT_FEE

tokenId, fee0, fee1, poolPath := pn.CollectFee(2)
if fee0 != "485" {
panic("expected fee0 485")
if fee0 != "486" {
panic("expected fee0 486")
}
if fee1 != "0" {
panic("expected fee1 0")
Expand Down

0 comments on commit f10f0a9

Please sign in to comment.