test: fix executor tests after removing the effectiveTrader field

This commit is contained in:
adrian
2025-08-21 11:20:06 +02:00
committed by Adrian Benavides
parent 52c91a12b8
commit f4d3fe75e8
4 changed files with 147 additions and 143 deletions

View File

@@ -711,110 +711,6 @@ fn test_uniswap_v3_bebop() {
write_calldata_to_file("test_uniswap_v3_bebop", hex_calldata.as_str());
}
#[test]
fn test_hashflow() {
// Note: This test does not assert anything. It is only used to obtain
// integration test data for our router solidity test.
//
// Performs a swap from USDC to WBTC using Hashflow RFQ
//
// USDC ───(Hashflow RFQ)──> WBTC
let usdc = usdc();
let wbtc = wbtc();
// USDC -> WBTC via Hashflow RFQ using real order data
let quote_amount_out = BigUint::from_str("3714751").unwrap();
let hashflow_state = MockRFQState {
quote_amount_out,
quote_data: HashMap::from([
(
"pool".to_string(),
Bytes::from_str("0x478eca1b93865dca0b9f325935eb123c8a4af011").unwrap(),
),
(
"external_account".to_string(),
Bytes::from_str("0xbee3211ab312a8d065c4fef0247448e17a8da000").unwrap(),
),
(
"trader".to_string(),
Bytes::from_str("0xcd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc2").unwrap(),
),
(
"base_token".to_string(),
Bytes::from_str("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48").unwrap(),
),
(
"quote_token".to_string(),
Bytes::from_str("0x2260fac5e5542a773aa44fbcfedf7c193bc2c599").unwrap(),
),
(
"base_token_amount".to_string(),
Bytes::from(biguint_to_u256(&BigUint::from(4308094737_u64)).to_be_bytes::<32>().to_vec()),
),
(
"quote_token_amount".to_string(),
Bytes::from(biguint_to_u256(&BigUint::from(3714751_u64)).to_be_bytes::<32>().to_vec()),
),
("quote_expiry".to_string(), Bytes::from(biguint_to_u256(&BigUint::from(1755610328_u64)).to_be_bytes::<32>().to_vec())),
("nonce".to_string(), Bytes::from(biguint_to_u256(&BigUint::from(1755610283723_u64)).to_be_bytes::<32>().to_vec())),
(
"tx_id".to_string(),
Bytes::from_str(
"0x125000064000640000001747eb8c38ffffffffffffff0029642016edb36d0000",
)
.unwrap(),
),
("signature".to_string(), Bytes::from_str("0x6ddb3b21fe8509e274ddf46c55209cdbf30360944abbca6569ed6b26740d052f419964dcb5a3bdb98b4ed1fb3642a2760b8312118599a962251f7a8f73fe4fbe1c").unwrap()),
]),
};
let hashflow_component = ProtocolComponent {
id: String::from("hashflow-rfq"),
protocol_system: String::from("rfq:hashflow"),
..Default::default()
};
let swap_usdc_wbtc = SwapBuilder::new(hashflow_component, usdc.clone(), wbtc.clone())
.estimated_amount_in(BigUint::from_str("4308094737").unwrap())
.protocol_state(&hashflow_state)
.build();
let encoder = get_tycho_router_encoder(UserTransferType::TransferFrom);
let solution = Solution {
exact_out: false,
given_token: usdc,
given_amount: BigUint::from_str("4308094737").unwrap(),
checked_token: wbtc,
checked_amount: BigUint::from_str("3714751").unwrap(),
sender: alice_address(),
receiver: alice_address(),
swaps: vec![swap_usdc_wbtc],
..Default::default()
};
let encoded_solution = encoder
.encode_solutions(vec![solution.clone()])
.unwrap()[0]
.clone();
let calldata = encode_tycho_router_call(
eth_chain().id(),
encoded_solution,
&solution,
&UserTransferType::TransferFrom,
&eth(),
None,
)
.unwrap()
.data;
let hex_calldata = encode(&calldata);
write_calldata_to_file("test_hashflow", hex_calldata.as_str());
}
#[test]
#[ignore]
fn test_uniswap_v3_hashflow() {