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:
Diana Carvalho
2025-08-14 12:56:03 +01:00
parent 6d88d0a144
commit 22920617eb
10 changed files with 474 additions and 56 deletions

View File

@@ -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);
}
}