test: (WIP) Router integration tests
TODO it don't pass Took 14 seconds Took 12 minutes
This commit is contained in:
committed by
Diana Carvalho
parent
07020e3f6e
commit
a9c68a4de0
@@ -671,4 +671,23 @@ contract TychoRouterTest is TychoRouterTestSetup {
|
|||||||
uint256 finalBalance = IERC20(DAI_ADDR).balanceOf(tychoRouterAddr);
|
uint256 finalBalance = IERC20(DAI_ADDR).balanceOf(tychoRouterAddr);
|
||||||
assertGe(finalBalance, expAmountOut);
|
assertGe(finalBalance, expAmountOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testSingleSwapIntegration() public {
|
||||||
|
// Test created with calldata from our router encoder
|
||||||
|
// Tests swapping WETH -> DAI on a USV2 pool
|
||||||
|
vm.rollFork(21740300);
|
||||||
|
deal(WETH_ADDR, tychoRouterAddr, 1 ether);
|
||||||
|
uint256 balancerBefore = IERC20(DAI_ADDR).balanceOf(ALICE);
|
||||||
|
|
||||||
|
// Encoded solution generated using `test_split_swap_strategy_encoder` with
|
||||||
|
// Alice's private key
|
||||||
|
(bool success,) = tychoRouterAddr.call(
|
||||||
|
hex"e73e3baa0000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000002c6a3cd97c6283b95ac8c5a4459ebb0d5fd404f4000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000067c38a9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c6a3cd97c6283b95ac8c5a4459ebb0d5fd404f400000000000000000000000000000000000000000000000000000000679c0498000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000041eea332470b38c64899045460469146ef146969d3ed5f64fc58f25f58bc709dfb172ef15397b7591fcfd6642cd5a50509702c39a39d87ab79575d5c5388203e3b1b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005c005a01000000005c2f5a71f67c01775180adc06909288b4c329308bd0625abc02aaa39b223fe8d0a0e5c4f27ead9083c756cc288e6a0c2ddd26feeb64f039a2c41296fcb3f56402c6a3cd97c6283b95ac8c5a4459ebb0d5fd404f40000000000"
|
||||||
|
);
|
||||||
|
uint256 balancerAfter = IERC20(DAI_ADDR).balanceOf(ALICE);
|
||||||
|
|
||||||
|
assertTrue(success, "Call Failed");
|
||||||
|
assertGt(balancerAfter, balancerBefore);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user