Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,6 @@ func (p *nextPriceAmount0RemoveParams) IsValid() bool {
return false
}

// Check: amountToRemove cannot be zero (line 63: division by zero in quotientCheck)
if amount.IsZero() {
return false
}

// Check: liquidityShifted > amountTimesSqrtPrice (line 64)
liquidityShifted := u256.Zero().Lsh(liquidity, Q96_RESOLUTION)
amountTimesSqrtPrice := u256.Zero().Mul(amount, currentSqrt)
Expand Down
12 changes: 11 additions & 1 deletion contract/p/gnoswap/gnsmath/sqrt_price_math_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package gnsmath
import (
"testing"

"gno.land/p/nt/uassert"
i256 "gno.land/p/gnoswap/int256"
u256 "gno.land/p/gnoswap/uint256"
"gno.land/p/nt/uassert"
)

// Test data constants
Expand Down Expand Up @@ -207,6 +207,16 @@ func TestSqrtPriceMath_getNextPriceAmount0Remove(t *testing.T) {
shouldPanic: true,
panicMsg: errInvalidPoolSqrtPrice.Error(),
},
{
name: "zero_amount_pass",
current: u256.NewUint(0),
liquidity: u256.NewUint(6416),
amountToRemove: u256.NewUint(0),
shouldPanic: false,
validate: func(t *testing.T, before, after *u256.Uint) {
uassert.True(t, after.IsZero(), "removal should return zero")
},
},
}

for _, tt := range tests {
Expand Down
38 changes: 0 additions & 38 deletions contract/p/gnoswap/int256/absolute.gno

This file was deleted.

184 changes: 0 additions & 184 deletions contract/p/gnoswap/int256/absolute_test.gno

This file was deleted.

Loading
Loading