@@ -1370,16 +1370,16 @@ func (s *KeeperTestSuite) TestFunctional_SpreadRewards_Swaps() {
13701370 }
13711371
13721372 // Swap multiple times USDC for ETH, therefore increasing the spot price
1373- ticksActivatedAfterEachSwap , totalSpreadRewardsExpected , _ , _ := s .swapAndTrackXTimesInARow (clPool .GetId (), DefaultCoin1 , ETH , types .MaxSpotPrice , positions .numSwaps )
1373+ ticksActivatedAfterEachSwap , totalSpreadRewardsExpected , _ , _ := s .swapAndTrackXTimesInARow (clPool .GetId (), DefaultCoin1 , ETH , types .MaxSpotPriceBigDec , positions .numSwaps )
13741374 s .CollectAndAssertSpreadRewards (s .Ctx , clPool .GetId (), totalSpreadRewardsExpected , positionIds , [][]int64 {ticksActivatedAfterEachSwap }, onlyUSDC , positions )
13751375
13761376 // Swap multiple times ETH for USDC, therefore decreasing the spot price
1377- ticksActivatedAfterEachSwap , totalSpreadRewardsExpected , _ , _ = s .swapAndTrackXTimesInARow (clPool .GetId (), DefaultCoin0 , USDC , types .MinSpotPrice , positions .numSwaps )
1377+ ticksActivatedAfterEachSwap , totalSpreadRewardsExpected , _ , _ = s .swapAndTrackXTimesInARow (clPool .GetId (), DefaultCoin0 , USDC , types .MinSpotPriceBigDec , positions .numSwaps )
13781378 s .CollectAndAssertSpreadRewards (s .Ctx , clPool .GetId (), totalSpreadRewardsExpected , positionIds , [][]int64 {ticksActivatedAfterEachSwap }, onlyETH , positions )
13791379
13801380 // Do the same swaps as before, however this time we collect spread rewards after both swap directions are complete.
1381- ticksActivatedAfterEachSwapUp , totalSpreadRewardsExpectedUp , _ , _ := s .swapAndTrackXTimesInARow (clPool .GetId (), DefaultCoin1 , ETH , types .MaxSpotPrice , positions .numSwaps )
1382- ticksActivatedAfterEachSwapDown , totalSpreadRewardsExpectedDown , _ , _ := s .swapAndTrackXTimesInARow (clPool .GetId (), DefaultCoin0 , USDC , types .MinSpotPrice , positions .numSwaps )
1381+ ticksActivatedAfterEachSwapUp , totalSpreadRewardsExpectedUp , _ , _ := s .swapAndTrackXTimesInARow (clPool .GetId (), DefaultCoin1 , ETH , types .MaxSpotPriceBigDec , positions .numSwaps )
1382+ ticksActivatedAfterEachSwapDown , totalSpreadRewardsExpectedDown , _ , _ := s .swapAndTrackXTimesInARow (clPool .GetId (), DefaultCoin0 , USDC , types .MinSpotPriceBigDec , positions .numSwaps )
13831383 totalSpreadRewardsExpected = totalSpreadRewardsExpectedUp .Add (totalSpreadRewardsExpectedDown ... )
13841384
13851385 // We expect all positions to have both denoms in their spread reward accumulators except USDC for the overlapping range position since
@@ -1413,15 +1413,15 @@ func (s *KeeperTestSuite) TestFunctional_SpreadRewards_LP() {
14131413 s .FundAcc (owner , fundCoins )
14141414
14151415 // Errors since no position.
1416- _ , _ , _ , err := s .App .ConcentratedLiquidityKeeper .SwapOutAmtGivenIn (s .Ctx , owner , pool , sdk .NewCoin (ETH , osmomath .OneInt ()), USDC , pool .GetSpreadFactor (s .Ctx ), types .MaxSpotPrice )
1416+ _ , _ , _ , err := s .App .ConcentratedLiquidityKeeper .SwapOutAmtGivenIn (s .Ctx , owner , pool , sdk .NewCoin (ETH , osmomath .OneInt ()), USDC , pool .GetSpreadFactor (s .Ctx ), types .MaxSpotPriceBigDec )
14171417 s .Require ().Error (err )
14181418
14191419 // Create position in the default range 1.
14201420 positionDataOne , err := concentratedLiquidityKeeper .CreatePosition (ctx , pool .GetId (), owner , DefaultCoins , osmomath .ZeroInt (), osmomath .ZeroInt (), DefaultLowerTick , DefaultUpperTick )
14211421 s .Require ().NoError (err )
14221422
14231423 // Swap once.
1424- ticksActivatedAfterEachSwap , totalSpreadRewardsExpected , _ , _ := s .swapAndTrackXTimesInARow (pool .GetId (), DefaultCoin1 , ETH , types .MaxSpotPrice , 1 )
1424+ ticksActivatedAfterEachSwap , totalSpreadRewardsExpected , _ , _ := s .swapAndTrackXTimesInARow (pool .GetId (), DefaultCoin1 , ETH , types .MaxSpotPriceBigDec , 1 )
14251425
14261426 // Withdraw half.
14271427 halfLiquidity := positionDataOne .Liquidity .Mul (osmomath .NewDecWithPrec (5 , 1 ))
@@ -1446,7 +1446,7 @@ func (s *KeeperTestSuite) TestFunctional_SpreadRewards_LP() {
14461446 fullLiquidity := positionDataTwo .Liquidity
14471447
14481448 // Swap once in the other direction.
1449- ticksActivatedAfterEachSwap , totalSpreadRewardsExpected , _ , _ = s .swapAndTrackXTimesInARow (pool .GetId (), DefaultCoin0 , USDC , types .MinSpotPrice , 1 )
1449+ ticksActivatedAfterEachSwap , totalSpreadRewardsExpected , _ , _ = s .swapAndTrackXTimesInARow (pool .GetId (), DefaultCoin0 , USDC , types .MinSpotPriceBigDec , 1 )
14501450
14511451 // This should claim under the hood for position 2 since full liquidity is removed.
14521452 balanceBeforeWithdraw := s .App .BankKeeper .GetBalance (ctx , owner , ETH )
@@ -1542,7 +1542,7 @@ func (s *KeeperTestSuite) tickStatusInvariance(ticksActivatedAfterEachSwap [][]i
15421542
15431543// swapAndTrackXTimesInARow performs `numSwaps` swaps and tracks the tick activated after each swap.
15441544// It also returns the total spread rewards collected, the total token in, and the total token out.
1545- func (s * KeeperTestSuite ) swapAndTrackXTimesInARow (poolId uint64 , coinIn sdk.Coin , coinOutDenom string , priceLimit osmomath.Dec , numSwaps int ) (ticksActivatedAfterEachSwap []int64 , totalSpreadRewards sdk.Coins , totalTokenIn sdk.Coin , totalTokenOut sdk.Coin ) {
1545+ func (s * KeeperTestSuite ) swapAndTrackXTimesInARow (poolId uint64 , coinIn sdk.Coin , coinOutDenom string , priceLimit osmomath.BigDec , numSwaps int ) (ticksActivatedAfterEachSwap []int64 , totalSpreadRewards sdk.Coins , totalTokenIn sdk.Coin , totalTokenOut sdk.Coin ) {
15461546 // Retrieve pool
15471547 clPool , err := s .App .ConcentratedLiquidityKeeper .GetPoolById (s .Ctx , poolId )
15481548 s .Require ().NoError (err )
0 commit comments