feat: Implement SplitSwapStrategyEncoder
The strategy works as follows: - Manage approvals needed - Compute min amount (if check amount is any): - if slippage is defined, apply slippage on the expected amount and take the min value between that and the check amount - if not, it's just the check amount - Iterate through the swaps - call the corresponding swap encoder to encode the swap - add swap header (tokens indexes and split) - ple encode the swaps - Add extra inputs (amounts, token addresses, min amount, (un)wrap, number of tokens and receiver) Misc: - Move executor address and selector encoding inside the SwapEncoder - Add default executor_selector to SwapEncoder - Pass router address inside the SplitSwapStrategyEncoder - Move Permit2 inside the SplitSwapStrategyEncoder. It is a responsibility and a specificity of the strategy to need permit2 approvals --- don't change below this line --- ENG-4081 Took 1 hour 21 minutes
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
use std::{str::FromStr, sync::Arc};
|
||||
|
||||
use alloy::{
|
||||
primitives::{aliases::U48, Address, Bytes as AlloyBytes, TxKind, U160},
|
||||
primitives::{aliases::U48, Address, Bytes as AlloyBytes, ChainId, TxKind, U160, U256},
|
||||
providers::{Provider, RootProvider},
|
||||
rpc::types::{TransactionInput, TransactionRequest},
|
||||
signers::{local::PrivateKeySigner, SignerSync},
|
||||
transports::BoxTransport,
|
||||
};
|
||||
use alloy_primitives::{ChainId, Signature, U256};
|
||||
#[allow(deprecated)]
|
||||
use alloy_primitives::Signature;
|
||||
use alloy_sol_types::{eip712_domain, sol, SolStruct, SolValue};
|
||||
use chrono::Utc;
|
||||
use num_bigint::BigUint;
|
||||
@@ -108,6 +109,7 @@ impl Permit2 {
|
||||
}
|
||||
}
|
||||
/// Creates permit single and signature
|
||||
#[allow(deprecated)]
|
||||
pub fn get_permit(
|
||||
&self,
|
||||
spender: &Bytes,
|
||||
|
||||
Reference in New Issue
Block a user