From 34f30e802522febd6795c5cd93defcb24a2eaa9a Mon Sep 17 00:00:00 2001 From: "A.L." Date: Fri, 29 Nov 2024 12:52:46 +0800 Subject: [PATCH] test: fix overlapping pairs --- test/__fixtures/BaseTest.t.sol | 6 +++--- test/unit/ReservoirPriceOracle.t.sol | 12 +++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/test/__fixtures/BaseTest.t.sol b/test/__fixtures/BaseTest.t.sol index 6a2b3d2..8ab1e97 100644 --- a/test/__fixtures/BaseTest.t.sol +++ b/test/__fixtures/BaseTest.t.sol @@ -57,14 +57,14 @@ contract BaseTest is Test { _tokenB.mint(address(_pair), 10_189e18); _pair.mint(address(this)); - _pairBC = ReservoirPair(_createPair(address(_tokenB), address(_tokenC), 0)); + _pairBC = ReservoirPair(_createPair(address(_tokenB), address(_tokenC), 1)); _tokenB.mint(address(_pairBC), 102_303e18); _tokenC.mint(address(_pairBC), 292e10); _pairBC.mint(address(this)); _pairCD = ReservoirPair(_createPair(address(_tokenC), address(_tokenD), 0)); - _tokenC.mint(address(_pairCD), 991_102_221e10); - _tokenD.mint(address(_pairCD), 937_991_222e6); + _tokenC.mint(address(_pairCD), 100 * 10 ** _tokenC.decimals()); + _tokenD.mint(address(_pairCD), 200 * 10 ** _tokenD.decimals()); _pairCD.mint(address(this)); } diff --git a/test/unit/ReservoirPriceOracle.t.sol b/test/unit/ReservoirPriceOracle.t.sol index 2af3f8e..74b7eb2 100644 --- a/test/unit/ReservoirPriceOracle.t.sol +++ b/test/unit/ReservoirPriceOracle.t.sol @@ -658,29 +658,23 @@ contract ReservoirPriceOracleTest is BaseTest { _oracle.setRoute(lStart, lEnd, lRoute, lRewardThreshold); ReservoirPair lAC = ReservoirPair(_createPair(address(_tokenA), address(_tokenC), 0)); - ReservoirPair lCD = ReservoirPair(_createPair(address(_tokenC), address(_tokenD), 0)); ReservoirPair lBD = ReservoirPair(_createPair(address(_tokenB), address(_tokenD), 0)); _tokenA.mint(address(lAC), 200 * 10 ** _tokenA.decimals()); _tokenC.mint(address(lAC), 100 * 10 ** _tokenC.decimals()); lAC.mint(address(this)); - _tokenC.mint(address(lCD), 100 * 10 ** _tokenC.decimals()); - _tokenD.mint(address(lCD), 200 * 10 ** _tokenD.decimals()); - lCD.mint(address(this)); - _tokenB.mint(address(lBD), 100 * 10 ** _tokenB.decimals()); _tokenD.mint(address(lBD), 200 * 10 ** _tokenD.decimals()); lBD.mint(address(this)); _oracle.designatePair(lStart, lIntermediate1, lAC); - _oracle.designatePair(lIntermediate2, lIntermediate1, lCD); _oracle.designatePair(lIntermediate2, lEnd, lBD); skip(1); _pair.sync(); lAC.sync(); - lCD.sync(); + _pairCD.sync(); lBD.sync(); skip(_oracle.twapPeriod()); @@ -706,8 +700,8 @@ contract ReservoirPriceOracleTest is BaseTest { _tokenA.mint(address(lAC), lSwapAmt * 10 ** _tokenA.decimals()); lAC.swap(int256(lSwapAmt * 10 ** _tokenA.decimals()), true, address(this), ""); - _tokenC.mint(address(lCD), lSwapAmt * 10 ** _tokenC.decimals()); - lCD.swap(int256(lSwapAmt * 10 ** _tokenC.decimals()), true, address(this), ""); + _tokenC.mint(address(_pairCD), lSwapAmt * 10 ** _tokenC.decimals()); + _pairCD.swap(int256(lSwapAmt * 10 ** _tokenC.decimals()), true, address(this), ""); _tokenB.mint(address(lBD), lSwapAmt * 10 ** _tokenB.decimals()); lBD.swap(int256(lSwapAmt * 10 ** _tokenB.decimals()), true, address(this), "");