feat: Support Bebop quote through IndicativelyPriced state
Made a new feature gate (test-utils) for MockRFQState Took 2 hours 19 minutes
This commit is contained in:
@@ -514,3 +514,36 @@ contract TychoRouterSequentialSwapTest is TychoRouterTestSetup {
|
||||
assertEq(balanceAfter - balanceBefore, 1404194006633772805);
|
||||
}
|
||||
}
|
||||
|
||||
contract TychoRouterSequentialSwapTestForBebop is TychoRouterTestSetup {
|
||||
function getForkBlock() public pure override returns (uint256) {
|
||||
return 23139046;
|
||||
}
|
||||
|
||||
function testUSV3BebopIntegration() public {
|
||||
// Performs a sequential swap from WETH to WBTC through USDC using USV3 and Bebop RFQ
|
||||
//
|
||||
// WETH ──(USV3)──> USDC ───(Bebop RFQ)──> WBTC
|
||||
|
||||
// The Bebop order expects:
|
||||
// - 2021750881 USDC input -> 1672307 WBTC output
|
||||
|
||||
uint256 amountIn = 1 ether;
|
||||
uint256 expectedAmountOut = 1672307;
|
||||
deal(WETH_ADDR, BOB, amountIn);
|
||||
uint256 balanceBefore = IERC20(WBTC_ADDR).balanceOf(BOB);
|
||||
|
||||
vm.startPrank(BOB);
|
||||
IERC20(WETH_ADDR).approve(tychoRouterAddr, type(uint256).max);
|
||||
bytes memory callData = loadCallDataFromFile("test_uniswap_v3_bebop");
|
||||
(bool success,) = tychoRouterAddr.call(callData);
|
||||
|
||||
vm.stopPrank();
|
||||
|
||||
uint256 balanceAfter = IERC20(WBTC_ADDR).balanceOf(BOB);
|
||||
|
||||
assertTrue(success, "Call Failed");
|
||||
assertEq(balanceAfter - balanceBefore, expectedAmountOut);
|
||||
assertEq(IERC20(WETH_ADDR).balanceOf(tychoRouterAddr), 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user