feat: Refactor callback to use transient storage
With this, we don't need the univ3 specific method in the router contract. This should be flexible enough for most protocols that integrate TODO: is this safe enough?? --- don't change below this line --- ENG-4411 Took 1 hour 52 minutes Took 4 minutes Took 5 minutes
This commit is contained in:
@@ -563,8 +563,6 @@ mod tests {
|
||||
"6982508145454ce325ddbe47a25d4ec3d2311933",
|
||||
// zero for one
|
||||
"00",
|
||||
// executor address
|
||||
"f62849f9a0b5bf2913b396098f7c7019b51a820a",
|
||||
// first pool intermediary token (ETH)
|
||||
"0000000000000000000000000000000000000000",
|
||||
// fee
|
||||
@@ -1019,9 +1017,9 @@ mod tests {
|
||||
|
||||
let expected_swaps = String::from(concat!(
|
||||
// length of ple encoded swaps without padding
|
||||
"000000000000000000000000000000000000000000000000000000000000008c",
|
||||
"0000000000000000000000000000000000000000000000000000000000000078",
|
||||
// ple encoded swaps
|
||||
"008a", // Swap length
|
||||
"0076", // Swap length
|
||||
"00", // token in index
|
||||
"01", // token out index
|
||||
"000000", // split
|
||||
@@ -1031,7 +1029,6 @@ mod tests {
|
||||
"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // group token in
|
||||
"6982508145454ce325ddbe47a25d4ec3d2311933", // group token in
|
||||
"00", // zero2one
|
||||
"f62849f9a0b5bf2913b396098f7c7019b51a820a", // executor address
|
||||
// First pool params
|
||||
"0000000000000000000000000000000000000000", // intermediary token (ETH)
|
||||
"000bb8", // fee
|
||||
@@ -1040,7 +1037,7 @@ mod tests {
|
||||
"6982508145454ce325ddbe47a25d4ec3d2311933", // intermediary token (PEPE)
|
||||
"0061a8", // fee
|
||||
"0001f4", // tick spacing
|
||||
"0000000000000000000000000000000000000000" // padding
|
||||
"0000000000000000" // padding
|
||||
));
|
||||
|
||||
let hex_calldata = encode(&calldata);
|
||||
|
||||
@@ -196,21 +196,11 @@ impl SwapEncoder for UniswapV4SwapEncoder {
|
||||
let group_token_out_address = bytes_to_address(&encoding_context.group_token_out)?;
|
||||
|
||||
let zero_to_one = Self::get_zero_to_one(token_in_address, token_out_address);
|
||||
let callback_executor =
|
||||
bytes_to_address(&Bytes::from_str(&self.executor_address).map_err(|_| {
|
||||
EncodingError::FatalError("Invalid UniswapV4 executor address".into())
|
||||
})?)?;
|
||||
|
||||
let pool_params =
|
||||
(token_out_address, pool_fee_u24, pool_tick_spacing_u24).abi_encode_packed();
|
||||
|
||||
let args = (
|
||||
group_token_in_address,
|
||||
group_token_out_address,
|
||||
zero_to_one,
|
||||
callback_executor,
|
||||
pool_params,
|
||||
);
|
||||
let args = (group_token_in_address, group_token_out_address, zero_to_one, pool_params);
|
||||
|
||||
Ok(args.abi_encode_packed())
|
||||
}
|
||||
@@ -785,8 +775,6 @@ mod tests {
|
||||
"dac17f958d2ee523a2206206994597c13d831ec7",
|
||||
// zero for one
|
||||
"01",
|
||||
// executor address
|
||||
"f62849f9a0b5bf2913b396098f7c7019b51a820a",
|
||||
// pool params:
|
||||
// - intermediary token
|
||||
"dac17f958d2ee523a2206206994597c13d831ec7",
|
||||
@@ -950,8 +938,6 @@ mod tests {
|
||||
"2260fac5e5542a773aa44fbcfedf7c193bc2c599",
|
||||
// zero for one
|
||||
"01",
|
||||
// executor address
|
||||
"f62849f9a0b5bf2913b396098f7c7019b51a820a",
|
||||
// pool params:
|
||||
// - intermediary token USDT
|
||||
"dac17f958d2ee523a2206206994597c13d831ec7",
|
||||
|
||||
Reference in New Issue
Block a user