Files
tycho-execution/foundry/test/TychoRouterProtocolIntegration.t.sol
Diana Carvalho e09789f347 test: Refactor tests
- Move encoding integration tests to integration test folder (in the rust project)
- Move protocol integration tests be inside the protocol file. This way we can change the block without any problems and it is easier for integrators

Took 6 minutes

Took 6 minutes


Took 17 minutes
2025-06-23 15:02:20 +01:00

30 lines
1015 B
Solidity

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
import "./TychoRouterTestSetup.sol";
import "./protocols/UniswapV4Utils.sol";
contract TychoRouterTestProtocolIntegration is TychoRouterTestSetup {
function testMultiProtocolIntegration() public {
// Test created with calldata from our router encoder.
//
// DAI ─(USV2)─> WETH ─(bal)─> WBTC ─(curve)─> USDT ─(ekubo)─> ETH ─(USV4)─> USDC
deal(DAI_ADDR, ALICE, 1500 ether);
uint256 balanceBefore = address(ALICE).balance;
// Approve permit2
vm.startPrank(ALICE);
IERC20(DAI_ADDR).approve(PERMIT2_ADDRESS, type(uint256).max);
bytes memory callData = loadCallDataFromFile("test_multi_protocol");
(bool success,) = tychoRouterAddr.call(callData);
vm.stopPrank();
uint256 balanceAfter = address(ALICE).balance;
assertTrue(success, "Call Failed");
assertEq(balanceAfter - balanceBefore, 732214216964381330);
}
}