diff --git a/test/G3M/unit/Update.t.sol b/test/G3M/unit/Update.t.sol index ce72f589..3b3bed05 100644 --- a/test/G3M/unit/Update.t.sol +++ b/test/G3M/unit/Update.t.sol @@ -9,7 +9,7 @@ contract G3MUpdateTest is G3MSetUp { assertEq(params.swapFee, TEST_SWAP_FEE); uint256 newSwapFee = 0.004 ether; - bytes memory data = solver.prepareFeeUpdate(newSwapFee); + bytes memory data = solver.prepareSwapFeeUpdate(newSwapFee); dfmm.update(POOL_ID, data); params = solver.getPoolParams(POOL_ID); diff --git a/test/LogNormal/LogNormalTest.t.sol b/test/LogNormal/LogNormalTest.t.sol index 40b62fab..6f61b69b 100644 --- a/test/LogNormal/LogNormalTest.t.sol +++ b/test/LogNormal/LogNormalTest.t.sol @@ -11,7 +11,9 @@ import { computeNextLiquidity, computeLGivenX, computeYGivenL, - computeTradingFunction + computeTradingFunction, + computePriceGivenY, + computePriceGivenX } from "src/LogNormal/LogNormalMath.sol"; contract LogNormalTest is Test { @@ -177,8 +179,10 @@ contract LogNormalTest is Test { function test_price_formulas() public basic { (uint256[] memory reserves, uint256 L) = solver.getReservesAndLiquidity(POOL_ID); - uint256 priceGivenX = solver.getPriceGivenXL(POOL_ID, reserves[0], L); - uint256 priceGivenY = solver.getPriceGivenYL(POOL_ID, reserves[1], L); + uint256 priceGivenX = + computePriceGivenX(reserves[0], L, solver.getPoolParams(POOL_ID)); + uint256 priceGivenY = + computePriceGivenY(reserves[1], L, solver.getPoolParams(POOL_ID)); assertApproxEqAbs(priceGivenY, priceGivenX, 100); } diff --git a/test/LogNormal/unit/Init.t.sol b/test/LogNormal/unit/Init.t.sol index 615d0c2c..e740dee5 100644 --- a/test/LogNormal/unit/Init.t.sol +++ b/test/LogNormal/unit/Init.t.sol @@ -3,6 +3,10 @@ pragma solidity ^0.8.13; import "./SetUp.sol"; import "forge-std/Test.sol"; +import { + computePriceGivenY, + computePriceGivenX +} from "src/LogNormal/LogNormalMath.sol"; contract LogNormalInitTest is LogNormalSetUp { function test_LogNormal_init_StoresPoolParameters() public init { @@ -44,8 +48,10 @@ contract LogNormalInitTest is LogNormalSetUp { function test_LogNormal_init_ReturnsPriceOfOne() public init { (uint256[] memory reserves, uint256 L) = solver.getReservesAndLiquidity(POOL_ID); - uint256 priceGivenYL = solver.getPriceGivenYL(POOL_ID, reserves[1], L); - uint256 priceGivenXL = solver.getPriceGivenXL(POOL_ID, reserves[0], L); + uint256 priceGivenYL = + computePriceGivenY(reserves[1], L, solver.getPoolParams(POOL_ID)); + uint256 priceGivenXL = + computePriceGivenX(reserves[0], L, solver.getPoolParams(POOL_ID)); assertApproxEqAbs(priceGivenXL, ONE, 10); assertApproxEqAbs(priceGivenYL, ONE, 10); diff --git a/test/LogNormal/unit/Swap.t.sol b/test/LogNormal/unit/Swap.t.sol index f7e8907e..a9409531 100644 --- a/test/LogNormal/unit/Swap.t.sol +++ b/test/LogNormal/unit/Swap.t.sol @@ -77,7 +77,8 @@ contract LogNormalSwapTest is LogNormalSetUp { uint256 ry = reserves[1] + amountIn; uint256 L = startL + deltaLiquidity; - uint256 approxPrice = solver.getPriceGivenYL(POOL_ID, ry, L); + uint256 approxPrice = + computePriceGivenY(ry, L, solver.getPoolParams(POOL_ID)); uint256 rx = solver.getNextReserveX(POOL_ID, ry, L, approxPrice); diff --git a/test/LogNormal/unit/Update.t.sol b/test/LogNormal/unit/Update.t.sol index 7a77df0a..1fa68505 100644 --- a/test/LogNormal/unit/Update.t.sol +++ b/test/LogNormal/unit/Update.t.sol @@ -9,7 +9,7 @@ contract LogNormalUpdateTest is LogNormalSetUp { assertEq(params.swapFee, TEST_SWAP_FEE); uint256 newSwapFee = 0.004 ether; - bytes memory data = solver.prepareFeeUpdate(newSwapFee); + bytes memory data = solver.prepareSwapFeeUpdate(newSwapFee); dfmm.update(POOL_ID, data); params = solver.getPoolParams(POOL_ID);