Skip to content

Commit

Permalink
test: fix overlapping pairs
Browse files Browse the repository at this point in the history
  • Loading branch information
xenide committed Nov 29, 2024
1 parent 470c615 commit 34f30e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
6 changes: 3 additions & 3 deletions test/__fixtures/BaseTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
12 changes: 3 additions & 9 deletions test/unit/ReservoirPriceOracle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand All @@ -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), "");
Expand Down

0 comments on commit 34f30e8

Please sign in to comment.