test: Change some addresses to match contract test

- Use Alice's PK to match our router test, set her as the receiver too
- Component id should be a usv2 pool
- Use our router test's router address as the test's router address
- Use our test's contract (address(this)) as the sender
This commit is contained in:
TAMARA LIPOWSKI
2025-01-30 23:25:11 -05:00
committed by Diana Carvalho
parent 5d6f0c1673
commit b01fa4cf04

View File

@@ -299,14 +299,14 @@ mod tests {
fn test_split_swap_strategy_encoder() { fn test_split_swap_strategy_encoder() {
// Set up a mock private key for signing // Set up a mock private key for signing
let private_key = let private_key =
"4c0883a69102937d6231471b5dbb6204fe512961708279feb1be6ae5538da033".to_string(); "0x123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234".to_string();
let weth = Bytes::from_str("0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2").unwrap(); let weth = Bytes::from_str("0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2").unwrap();
let dai = Bytes::from_str("0x6b175474e89094c44da98b954eedeac495271d0f").unwrap(); let dai = Bytes::from_str("0x6b175474e89094c44da98b954eedeac495271d0f").unwrap();
let swap = Swap { let swap = Swap {
component: ProtocolComponent { component: ProtocolComponent {
id: "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640".to_string(), id: "0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11".to_string(),
protocol_system: "uniswap_v2".to_string(), protocol_system: "uniswap_v2".to_string(),
..Default::default() ..Default::default()
}, },
@@ -323,19 +323,19 @@ mod tests {
checked_token: dai, checked_token: dai,
expected_amount: BigUint::from_str("3_000_000000000000000000").unwrap(), expected_amount: BigUint::from_str("3_000_000000000000000000").unwrap(),
check_amount: None, check_amount: None,
sender: Bytes::from_str("0x2c6A3cd97c6283b95Ac8C5A4459eBB0d5Fd404F4").unwrap(), sender: Bytes::from_str("0x7FA9385bE102ac3EAc297483Dd6233D62b3e1496").unwrap(),
receiver: Bytes::from_str("0x2c6A3cd97c6283b95Ac8C5A4459eBB0d5Fd404F4").unwrap(), receiver: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(),
swaps: vec![swap], swaps: vec![swap],
..Default::default() ..Default::default()
}; };
let router_address = Bytes::from_str("0x2c6A3cd97c6283b95Ac8C5A4459eBB0d5Fd404F4").unwrap(); let router_address = Bytes::from_str("0x3Ede3eCa2a72B3aeCC820E955B36f38437D01395").unwrap();
let (calldata, _) = encoder let (calldata, _) = encoder
.encode_strategy(solution, router_address) .encode_strategy(solution, router_address)
.unwrap(); .unwrap();
let expected_input = String::from(concat!( let expected_input = String::from(concat!(
"e73e3baa", "4860f9ed",
"0000000000000000000000000000000000000000000000000de0b6b3a7640000", // amount out "0000000000000000000000000000000000000000000000000de0b6b3a7640000", // amount out
"000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // token in "000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // token in
"0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f", // token out "0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f", // token out
@@ -343,7 +343,7 @@ mod tests {
"0000000000000000000000000000000000000000000000000000000000000000", // wrap "0000000000000000000000000000000000000000000000000000000000000000", // wrap
"0000000000000000000000000000000000000000000000000000000000000000", // unwrap "0000000000000000000000000000000000000000000000000000000000000000", // unwrap
"0000000000000000000000000000000000000000000000000000000000000002", // tokens length "0000000000000000000000000000000000000000000000000000000000000002", // tokens length
"0000000000000000000000002c6a3cd97c6283b95ac8c5a4459ebb0d5fd404f4", // receiver "000000000000000000000000cd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc2", // receiver
)); ));
// after this there is the permit and because of the deadlines (that depend on block time) // after this there is the permit and because of the deadlines (that depend on block time)
// it's hard to assert // it's hard to assert
@@ -377,8 +377,8 @@ mod tests {
"5c2f5a71f67c01775180adc06909288b4c329308", // executor address "5c2f5a71f67c01775180adc06909288b4c329308", // executor address
"bd0625ab", // selector "bd0625ab", // selector
"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // token in "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // token in
"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", // component id "a478c2975ab1ea89e8196811f51a7b7ade33eb11", // component id
"2c6a3cd97c6283b95ac8c5a4459ebb0d5fd404f4", // receiver "3ede3eca2a72b3aecc820e955b36f38437d01395", // receiver
"00", // zero2one "00", // zero2one
"00", // exact out "00", // exact out
"000000", // padding "000000", // padding