diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 44705ce5..fea6023e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,3 +56,11 @@ jobs: export PROTOCOL_FEE=50 forge test -vvv --via-ir id: test2 + + - name: Run forge tests with usingEth (true) + run: | + export USING_ETH=TRUE + export FEE=0 + export PROTOCOL_FEE=0 + forge test -vvv --via-ir + id: test3 diff --git a/test/unit/EarlyExit.t.sol b/test/unit/EarlyExit.t.sol index e9a13551..c21c5a32 100644 --- a/test/unit/EarlyExit.t.sol +++ b/test/unit/EarlyExit.t.sol @@ -16,6 +16,8 @@ import {PoolManager} from "v4-core/src/PoolManager.sol"; import {PoolSwapTest} from "v4-core/src/test/PoolSwapTest.sol"; import {MaximumProceedsReached} from "src/Doppler.sol"; import {PoolModifyLiquidityTest} from "v4-core/src/test/PoolModifyLiquidityTest.sol"; +import {Quoter, IQuoter} from "v4-periphery/src/lens/Quoter.sol"; +import {CustomRouter} from "test/shared/CustomRouter.sol"; import "forge-std/console.sol"; using PoolIdLibrary for PoolKey; @@ -71,11 +73,17 @@ contract EarlyExitTest is BaseTest { // Note: Only used to validate that liquidity can't be manually modified modifyLiquidityRouter = new PoolModifyLiquidityTest(manager); - // Approve the router to spend tokens on behalf of the test contract - TestERC20(token0).approve(address(swapRouter), type(uint256).max); + if (token0 != address(0)) { + // Approve the router to spend tokens on behalf of the test contract + TestERC20(token0).approve(address(swapRouter), type(uint256).max); + TestERC20(token0).approve(address(modifyLiquidityRouter), type(uint256).max); + } TestERC20(token1).approve(address(swapRouter), type(uint256).max); - TestERC20(token0).approve(address(modifyLiquidityRouter), type(uint256).max); TestERC20(token1).approve(address(modifyLiquidityRouter), type(uint256).max); + + quoter = new Quoter(manager); + + router = new CustomRouter(swapRouter, quoter, key, isToken0, usingEth); } function test_swap_RevertsIfMaximumProceedsReached() public { diff --git a/test/unit/Swap.sol b/test/unit/Swap.sol index 29155690..30ab00d2 100644 --- a/test/unit/Swap.sol +++ b/test/unit/Swap.sol @@ -73,16 +73,7 @@ contract SwapTest is BaseTest { int256 minimumProceeds = int256(hook.getMinimumProceeds()); - swapRouter.swap( - // Swap numeraire to asset - // If zeroForOne, we use max price limit (else vice versa) - key, - IPoolManager.SwapParams( - !isToken0, -minimumProceeds * 11 / 10, !isToken0 ? MIN_PRICE_LIMIT : MAX_PRICE_LIMIT - ), - PoolSwapTest.TestSettings(true, false), - "" - ); + buy(-minimumProceeds * 11 / 10); vm.warp(hook.getEndingTime() + 1); // 1 second after the end time