Merge branch 'main' into usx/tnl/ENG-4674-example
This commit is contained in:
24
CHANGELOG.md
24
CHANGELOG.md
@@ -1,3 +1,27 @@
|
|||||||
|
## [0.108.0](https://github.com/propeller-heads/tycho-execution/compare/0.107.0...0.108.0) (2025-07-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Upgrade tycho-common ([8458b46](https://github.com/propeller-heads/tycho-execution/commit/8458b4628e351daaf4d4a639afc5099903107ff6))
|
||||||
|
* Upgrade tycho-common ([effc25c](https://github.com/propeller-heads/tycho-execution/commit/effc25c2d723107a56260190d6f7b5c7b8c42e4e))
|
||||||
|
* Upgrade tycho-common ([cb6042e](https://github.com/propeller-heads/tycho-execution/commit/cb6042ea7974faee93c1a87ca84fc6677c999548))
|
||||||
|
* Use Chain from tycho-core and remove current implementation ([2c25b5a](https://github.com/propeller-heads/tycho-execution/commit/2c25b5a18f06beb61d93530660d9530bf0c46b36))
|
||||||
|
|
||||||
|
## [0.107.0](https://github.com/propeller-heads/tycho-execution/compare/0.106.0...0.107.0) (2025-07-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* (WIP) Handle approvals in UniswapXFiller ([e243667](https://github.com/propeller-heads/tycho-execution/commit/e243667f9ee8ec8e79fc5196da6960b19cd120b7))
|
||||||
|
* Handle native ETH outputs ([3752c15](https://github.com/propeller-heads/tycho-execution/commit/3752c155ea89d4d2d91be98f2c5fa79264a45999))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* silence slither on native address setting ([1b6a24f](https://github.com/propeller-heads/tycho-execution/commit/1b6a24fd75b91de7570f110e87d81ed081639bb7))
|
||||||
|
* use encodePacked to encode if approval needed ([9e2f228](https://github.com/propeller-heads/tycho-execution/commit/9e2f228a470d163b71cac22a0f95116716490772))
|
||||||
|
|
||||||
## [0.106.0](https://github.com/propeller-heads/tycho-execution/compare/0.105.0...0.106.0) (2025-07-09)
|
## [0.106.0](https://github.com/propeller-heads/tycho-execution/compare/0.105.0...0.106.0) (2025-07-09)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
7
Cargo.lock
generated
7
Cargo.lock
generated
@@ -4634,15 +4634,16 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tycho-common"
|
name = "tycho-common"
|
||||||
version = "0.70.7"
|
version = "0.76.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c4da82c4239c76011b8edc19b5d2a2db989c9ff1f74ae6a3dea21486e9b53234"
|
checksum = "e72ed04dc9d41942c886fc3d58af5b0e23a3e4783ac7294ed7cea61e022a5c4d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"bytes",
|
"bytes",
|
||||||
"chrono",
|
"chrono",
|
||||||
"hex",
|
"hex",
|
||||||
|
"num-bigint",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -4658,7 +4659,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tycho-execution"
|
name = "tycho-execution"
|
||||||
version = "0.106.0"
|
version = "0.108.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"alloy",
|
"alloy",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tycho-execution"
|
name = "tycho-execution"
|
||||||
version = "0.106.0"
|
version = "0.108.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Provides tools for encoding and executing swaps against Tycho router and protocol executors."
|
description = "Provides tools for encoding and executing swaps against Tycho router and protocol executors."
|
||||||
repository = "https://github.com/propeller-heads/tycho-execution"
|
repository = "https://github.com/propeller-heads/tycho-execution"
|
||||||
@@ -37,7 +37,7 @@ tokio = { version = "1.38.0", features = ["full"] }
|
|||||||
chrono = "0.4.39"
|
chrono = "0.4.39"
|
||||||
clap = { version = "4.5.3", features = ["derive"] }
|
clap = { version = "4.5.3", features = ["derive"] }
|
||||||
once_cell = "1.20.2"
|
once_cell = "1.20.2"
|
||||||
tycho-common = ">0.66.4"
|
tycho-common = ">0.75.1"
|
||||||
|
|
||||||
alloy = { version = "1.0.6", features = ["providers", "rpc-types-eth", "eip712", "signer-local", "node-bindings"], optional = true }
|
alloy = { version = "1.0.6", features = ["providers", "rpc-types-eth", "eip712", "signer-local", "node-bindings"], optional = true }
|
||||||
|
|
||||||
|
|||||||
@@ -187,10 +187,10 @@ mod tests {
|
|||||||
signers::local::PrivateKeySigner,
|
signers::local::PrivateKeySigner,
|
||||||
};
|
};
|
||||||
use num_bigint::BigUint;
|
use num_bigint::BigUint;
|
||||||
use tycho_common::models::Chain as TychoCommonChain;
|
use tycho_common::models::Chain;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::encoding::{evm::encoding_utils::sign_permit, models::Chain};
|
use crate::encoding::evm::encoding_utils::sign_permit;
|
||||||
|
|
||||||
// These two implementations are to avoid comparing the expiration and sig_deadline fields
|
// These two implementations are to avoid comparing the expiration and sig_deadline fields
|
||||||
// because they are timestamps
|
// because they are timestamps
|
||||||
@@ -224,7 +224,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn eth_chain() -> Chain {
|
fn eth_chain() -> Chain {
|
||||||
TychoCommonChain::Ethereum.into()
|
Chain::Ethereum
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -334,7 +334,7 @@ mod tests {
|
|||||||
let sol_permit: PermitSingle =
|
let sol_permit: PermitSingle =
|
||||||
PermitSingle::try_from(&permit).expect("Failed to convert to PermitSingle");
|
PermitSingle::try_from(&permit).expect("Failed to convert to PermitSingle");
|
||||||
|
|
||||||
let signature = sign_permit(eth_chain().id, &permit, signer).unwrap();
|
let signature = sign_permit(eth_chain().id(), &permit, signer).unwrap();
|
||||||
let encoded =
|
let encoded =
|
||||||
(bytes_to_address(&anvil_account).unwrap(), sol_permit, signature.as_bytes().to_vec())
|
(bytes_to_address(&anvil_account).unwrap(), sol_permit, signature.as_bytes().to_vec())
|
||||||
.abi_encode();
|
.abi_encode();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::{collections::HashMap, str::FromStr};
|
use std::{collections::HashMap, str::FromStr};
|
||||||
|
|
||||||
use alloy::{primitives::B256, signers::local::PrivateKeySigner};
|
use alloy::{primitives::B256, signers::local::PrivateKeySigner};
|
||||||
use tycho_common::{models::Chain as TychoCommonChain, Bytes};
|
use tycho_common::{models::Chain, Bytes};
|
||||||
|
|
||||||
use crate::encoding::{
|
use crate::encoding::{
|
||||||
errors::EncodingError,
|
errors::EncodingError,
|
||||||
@@ -10,7 +10,7 @@ use crate::encoding::{
|
|||||||
swap_encoder::swap_encoder_registry::SwapEncoderRegistry,
|
swap_encoder::swap_encoder_registry::SwapEncoderRegistry,
|
||||||
tycho_encoders::{TychoExecutorEncoder, TychoRouterEncoder},
|
tycho_encoders::{TychoExecutorEncoder, TychoRouterEncoder},
|
||||||
},
|
},
|
||||||
models::{Chain, UserTransferType},
|
models::UserTransferType,
|
||||||
tycho_encoder::TychoEncoder,
|
tycho_encoder::TychoEncoder,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -41,8 +41,8 @@ impl TychoRouterEncoderBuilder {
|
|||||||
user_transfer_type: None,
|
user_transfer_type: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn chain(mut self, chain: TychoCommonChain) -> Self {
|
pub fn chain(mut self, chain: Chain) -> Self {
|
||||||
self.chain = Some(chain.into());
|
self.chain = Some(chain);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,10 +85,10 @@ impl TychoRouterEncoderBuilder {
|
|||||||
if let Some(address) = self.router_address {
|
if let Some(address) = self.router_address {
|
||||||
tycho_router_address = address;
|
tycho_router_address = address;
|
||||||
} else {
|
} else {
|
||||||
let default_routers: HashMap<String, Bytes> =
|
let default_routers: HashMap<Chain, Bytes> =
|
||||||
serde_json::from_str(DEFAULT_ROUTERS_JSON)?;
|
serde_json::from_str(DEFAULT_ROUTERS_JSON)?;
|
||||||
tycho_router_address = default_routers
|
tycho_router_address = default_routers
|
||||||
.get(&chain.name)
|
.get(&chain)
|
||||||
.ok_or(EncodingError::FatalError(
|
.ok_or(EncodingError::FatalError(
|
||||||
"No default router address found for chain".to_string(),
|
"No default router address found for chain".to_string(),
|
||||||
))?
|
))?
|
||||||
@@ -96,7 +96,7 @@ impl TychoRouterEncoderBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let swap_encoder_registry =
|
let swap_encoder_registry =
|
||||||
SwapEncoderRegistry::new(self.executors_file_path.clone(), chain.clone())?;
|
SwapEncoderRegistry::new(self.executors_file_path.clone(), chain)?;
|
||||||
|
|
||||||
let signer = if let Some(pk) = self.swapper_pk {
|
let signer = if let Some(pk) = self.swapper_pk {
|
||||||
let pk = B256::from_str(&pk).map_err(|_| {
|
let pk = B256::from_str(&pk).map_err(|_| {
|
||||||
@@ -141,8 +141,8 @@ impl TychoExecutorEncoderBuilder {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
TychoExecutorEncoderBuilder { chain: None, executors_file_path: None }
|
TychoExecutorEncoderBuilder { chain: None, executors_file_path: None }
|
||||||
}
|
}
|
||||||
pub fn chain(mut self, chain: TychoCommonChain) -> Self {
|
pub fn chain(mut self, chain: Chain) -> Self {
|
||||||
self.chain = Some(chain.into());
|
self.chain = Some(chain);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ impl TychoExecutorEncoderBuilder {
|
|||||||
pub fn build(self) -> Result<Box<dyn TychoEncoder>, EncodingError> {
|
pub fn build(self) -> Result<Box<dyn TychoEncoder>, EncodingError> {
|
||||||
if let Some(chain) = self.chain {
|
if let Some(chain) = self.chain {
|
||||||
let swap_encoder_registry =
|
let swap_encoder_registry =
|
||||||
SwapEncoderRegistry::new(self.executors_file_path.clone(), chain.clone())?;
|
SwapEncoderRegistry::new(self.executors_file_path.clone(), chain)?;
|
||||||
Ok(Box::new(TychoExecutorEncoder::new(swap_encoder_registry)?))
|
Ok(Box::new(TychoExecutorEncoder::new(swap_encoder_registry)?))
|
||||||
} else {
|
} else {
|
||||||
Err(EncodingError::FatalError(
|
Err(EncodingError::FatalError(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::{collections::HashSet, str::FromStr};
|
use std::{collections::HashSet, str::FromStr};
|
||||||
|
|
||||||
use alloy::primitives::{aliases::U24, U8};
|
use alloy::primitives::{aliases::U24, U8};
|
||||||
use tycho_common::Bytes;
|
use tycho_common::{models::Chain, Bytes};
|
||||||
|
|
||||||
use crate::encoding::{
|
use crate::encoding::{
|
||||||
errors::EncodingError,
|
errors::EncodingError,
|
||||||
@@ -14,7 +14,7 @@ use crate::encoding::{
|
|||||||
swap_encoder::swap_encoder_registry::SwapEncoderRegistry,
|
swap_encoder::swap_encoder_registry::SwapEncoderRegistry,
|
||||||
utils::{get_token_position, percentage_to_uint24, ple_encode},
|
utils::{get_token_position, percentage_to_uint24, ple_encode},
|
||||||
},
|
},
|
||||||
models::{Chain, EncodedSolution, EncodingContext, NativeAction, Solution, UserTransferType},
|
models::{EncodedSolution, EncodingContext, NativeAction, Solution, UserTransferType},
|
||||||
strategy_encoder::StrategyEncoder,
|
strategy_encoder::StrategyEncoder,
|
||||||
swap_encoder::SwapEncoder,
|
swap_encoder::SwapEncoder,
|
||||||
};
|
};
|
||||||
@@ -52,8 +52,8 @@ impl SingleSwapStrategyEncoder {
|
|||||||
swap_encoder_registry,
|
swap_encoder_registry,
|
||||||
router_address: router_address.clone(),
|
router_address: router_address.clone(),
|
||||||
transfer_optimization: TransferOptimization::new(
|
transfer_optimization: TransferOptimization::new(
|
||||||
chain.native_token()?,
|
chain.native_token().address,
|
||||||
chain.wrapped_token()?,
|
chain.wrapped_native_token().address,
|
||||||
user_transfer_type,
|
user_transfer_type,
|
||||||
router_address,
|
router_address,
|
||||||
),
|
),
|
||||||
@@ -186,16 +186,18 @@ impl SequentialSwapStrategyEncoder {
|
|||||||
"sequentialSwap(uint256,address,address,uint256,bool,bool,address,bool,bytes)"
|
"sequentialSwap(uint256,address,address,uint256,bool,bool,address,bool,bytes)"
|
||||||
|
|
||||||
}.to_string();
|
}.to_string();
|
||||||
|
let native_token_address = chain.native_token().address;
|
||||||
|
let wrapped_token_address = chain.wrapped_native_token().address;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
function_signature,
|
function_signature,
|
||||||
swap_encoder_registry,
|
swap_encoder_registry,
|
||||||
router_address: router_address.clone(),
|
router_address: router_address.clone(),
|
||||||
native_address: chain.native_token()?,
|
native_address: native_token_address.clone(),
|
||||||
wrapped_address: chain.wrapped_token()?,
|
wrapped_address: wrapped_token_address.clone(),
|
||||||
sequential_swap_validator: SequentialSwapValidator,
|
sequential_swap_validator: SequentialSwapValidator,
|
||||||
transfer_optimization: TransferOptimization::new(
|
transfer_optimization: TransferOptimization::new(
|
||||||
chain.native_token()?,
|
native_token_address,
|
||||||
chain.wrapped_token()?,
|
wrapped_token_address,
|
||||||
user_transfer_type,
|
user_transfer_type,
|
||||||
router_address,
|
router_address,
|
||||||
),
|
),
|
||||||
@@ -338,16 +340,18 @@ impl SplitSwapStrategyEncoder {
|
|||||||
} else {
|
} else {
|
||||||
"splitSwap(uint256,address,address,uint256,bool,bool,uint256,address,bool,bytes)"
|
"splitSwap(uint256,address,address,uint256,bool,bool,uint256,address,bool,bytes)"
|
||||||
}.to_string();
|
}.to_string();
|
||||||
|
let native_token_address = chain.native_token().address;
|
||||||
|
let wrapped_token_address = chain.wrapped_native_token().address;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
function_signature,
|
function_signature,
|
||||||
swap_encoder_registry,
|
swap_encoder_registry,
|
||||||
native_address: chain.native_token()?,
|
native_address: native_token_address.clone(),
|
||||||
wrapped_address: chain.wrapped_token()?,
|
wrapped_address: wrapped_token_address.clone(),
|
||||||
split_swap_validator: SplitSwapValidator,
|
split_swap_validator: SplitSwapValidator,
|
||||||
router_address: router_address.clone(),
|
router_address: router_address.clone(),
|
||||||
transfer_optimization: TransferOptimization::new(
|
transfer_optimization: TransferOptimization::new(
|
||||||
chain.native_token()?,
|
native_token_address,
|
||||||
chain.wrapped_token()?,
|
wrapped_token_address,
|
||||||
user_transfer_type,
|
user_transfer_type,
|
||||||
router_address,
|
router_address,
|
||||||
),
|
),
|
||||||
@@ -508,7 +512,7 @@ mod tests {
|
|||||||
use alloy::{hex::encode, primitives::hex};
|
use alloy::{hex::encode, primitives::hex};
|
||||||
use num_bigint::{BigInt, BigUint};
|
use num_bigint::{BigInt, BigUint};
|
||||||
use tycho_common::{
|
use tycho_common::{
|
||||||
models::{protocol::ProtocolComponent, Chain as TychoCommonChain},
|
models::{protocol::ProtocolComponent, Chain},
|
||||||
Bytes,
|
Bytes,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -516,7 +520,7 @@ mod tests {
|
|||||||
use crate::encoding::models::Swap;
|
use crate::encoding::models::Swap;
|
||||||
|
|
||||||
fn eth_chain() -> Chain {
|
fn eth_chain() -> Chain {
|
||||||
TychoCommonChain::Ethereum.into()
|
Chain::Ethereum
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weth() -> Bytes {
|
fn weth() -> Bytes {
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use tycho_common::models::Chain;
|
||||||
|
|
||||||
use crate::encoding::{
|
use crate::encoding::{
|
||||||
errors::EncodingError,
|
errors::EncodingError,
|
||||||
evm::swap_encoder::swap_encoders::{
|
evm::swap_encoder::swap_encoders::{
|
||||||
BalancerV2SwapEncoder, BalancerV3SwapEncoder, CurveSwapEncoder, EkuboSwapEncoder,
|
BalancerV2SwapEncoder, BalancerV3SwapEncoder, CurveSwapEncoder, EkuboSwapEncoder,
|
||||||
MaverickV2SwapEncoder, UniswapV2SwapEncoder, UniswapV3SwapEncoder, UniswapV4SwapEncoder,
|
MaverickV2SwapEncoder, UniswapV2SwapEncoder, UniswapV3SwapEncoder, UniswapV4SwapEncoder,
|
||||||
},
|
},
|
||||||
models::Chain,
|
|
||||||
swap_encoder::SwapEncoder,
|
swap_encoder::SwapEncoder,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
use std::{collections::HashMap, fs};
|
use std::{collections::HashMap, fs};
|
||||||
|
|
||||||
|
use tycho_common::models::Chain;
|
||||||
|
|
||||||
use crate::encoding::{
|
use crate::encoding::{
|
||||||
errors::EncodingError,
|
errors::EncodingError,
|
||||||
evm::{
|
evm::{
|
||||||
constants::{DEFAULT_EXECUTORS_JSON, PROTOCOL_SPECIFIC_CONFIG},
|
constants::{DEFAULT_EXECUTORS_JSON, PROTOCOL_SPECIFIC_CONFIG},
|
||||||
swap_encoder::builder::SwapEncoderBuilder,
|
swap_encoder::builder::SwapEncoderBuilder,
|
||||||
},
|
},
|
||||||
models::Chain,
|
|
||||||
swap_encoder::SwapEncoder,
|
swap_encoder::SwapEncoder,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -30,15 +31,15 @@ impl SwapEncoderRegistry {
|
|||||||
} else {
|
} else {
|
||||||
DEFAULT_EXECUTORS_JSON.to_string()
|
DEFAULT_EXECUTORS_JSON.to_string()
|
||||||
};
|
};
|
||||||
let config: HashMap<String, HashMap<String, String>> = serde_json::from_str(&config_str)?;
|
let config: HashMap<Chain, HashMap<String, String>> = serde_json::from_str(&config_str)?;
|
||||||
let executors = config
|
let executors = config
|
||||||
.get(&chain.name)
|
.get(&chain)
|
||||||
.ok_or(EncodingError::FatalError("No executors found for chain".to_string()))?;
|
.ok_or(EncodingError::FatalError("No executors found for chain".to_string()))?;
|
||||||
|
|
||||||
let protocol_specific_config: HashMap<String, HashMap<String, HashMap<String, String>>> =
|
let protocol_specific_config: HashMap<Chain, HashMap<String, HashMap<String, String>>> =
|
||||||
serde_json::from_str(PROTOCOL_SPECIFIC_CONFIG)?;
|
serde_json::from_str(PROTOCOL_SPECIFIC_CONFIG)?;
|
||||||
let protocol_specific_config = protocol_specific_config
|
let protocol_specific_config = protocol_specific_config
|
||||||
.get(&chain.name)
|
.get(&chain)
|
||||||
.ok_or(EncodingError::FatalError(
|
.ok_or(EncodingError::FatalError(
|
||||||
"No protocol specific config found for chain".to_string(),
|
"No protocol specific config found for chain".to_string(),
|
||||||
))?;
|
))?;
|
||||||
@@ -47,7 +48,7 @@ impl SwapEncoderRegistry {
|
|||||||
let builder = SwapEncoderBuilder::new(
|
let builder = SwapEncoderBuilder::new(
|
||||||
protocol,
|
protocol,
|
||||||
executor_address,
|
executor_address,
|
||||||
chain.clone(),
|
chain,
|
||||||
protocol_specific_config
|
protocol_specific_config
|
||||||
.get(protocol)
|
.get(protocol)
|
||||||
.cloned(),
|
.cloned(),
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use alloy::{
|
|||||||
sol_types::SolValue,
|
sol_types::SolValue,
|
||||||
};
|
};
|
||||||
use serde_json::from_str;
|
use serde_json::from_str;
|
||||||
use tycho_common::Bytes;
|
use tycho_common::{models::Chain, Bytes};
|
||||||
|
|
||||||
use crate::encoding::{
|
use crate::encoding::{
|
||||||
errors::EncodingError,
|
errors::EncodingError,
|
||||||
@@ -13,7 +13,7 @@ use crate::encoding::{
|
|||||||
approvals::protocol_approvals_manager::ProtocolApprovalsManager,
|
approvals::protocol_approvals_manager::ProtocolApprovalsManager,
|
||||||
utils::{bytes_to_address, get_static_attribute, pad_to_fixed_size},
|
utils::{bytes_to_address, get_static_attribute, pad_to_fixed_size},
|
||||||
},
|
},
|
||||||
models::{Chain, EncodingContext, Swap},
|
models::{EncodingContext, Swap},
|
||||||
swap_encoder::SwapEncoder,
|
swap_encoder::SwapEncoder,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -466,9 +466,9 @@ impl SwapEncoder for CurveSwapEncoder {
|
|||||||
.to_string();
|
.to_string();
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
executor_address,
|
executor_address,
|
||||||
native_token_address: chain.native_token()?,
|
native_token_address: chain.native_token().address,
|
||||||
native_token_curve_address,
|
native_token_curve_address,
|
||||||
wrapped_native_token_address: chain.wrapped_token()?,
|
wrapped_native_token_address: chain.wrapped_native_token().address,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -646,7 +646,7 @@ mod tests {
|
|||||||
use alloy::hex::encode;
|
use alloy::hex::encode;
|
||||||
use num_bigint::BigInt;
|
use num_bigint::BigInt;
|
||||||
use tycho_common::{
|
use tycho_common::{
|
||||||
models::{protocol::ProtocolComponent, Chain as TychoCoreChain},
|
models::{protocol::ProtocolComponent, Chain},
|
||||||
Bytes,
|
Bytes,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -681,7 +681,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
let encoder = UniswapV2SwapEncoder::new(
|
let encoder = UniswapV2SwapEncoder::new(
|
||||||
String::from("0x543778987b293C7E8Cf0722BB2e935ba6f4068D4"),
|
String::from("0x543778987b293C7E8Cf0722BB2e935ba6f4068D4"),
|
||||||
TychoCoreChain::Ethereum.into(),
|
Chain::Ethereum,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -741,7 +741,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
let encoder = UniswapV3SwapEncoder::new(
|
let encoder = UniswapV3SwapEncoder::new(
|
||||||
String::from("0x543778987b293C7E8Cf0722BB2e935ba6f4068D4"),
|
String::from("0x543778987b293C7E8Cf0722BB2e935ba6f4068D4"),
|
||||||
TychoCoreChain::Ethereum.into(),
|
Chain::Ethereum,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -803,7 +803,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
let encoder = BalancerV2SwapEncoder::new(
|
let encoder = BalancerV2SwapEncoder::new(
|
||||||
String::from("0x543778987b293C7E8Cf0722BB2e935ba6f4068D4"),
|
String::from("0x543778987b293C7E8Cf0722BB2e935ba6f4068D4"),
|
||||||
TychoCoreChain::Ethereum.into(),
|
Chain::Ethereum,
|
||||||
Some(HashMap::from([(
|
Some(HashMap::from([(
|
||||||
"vault_address".to_string(),
|
"vault_address".to_string(),
|
||||||
"0xba12222222228d8ba445958a75a0704d566bf2c8".to_string(),
|
"0xba12222222228d8ba445958a75a0704d566bf2c8".to_string(),
|
||||||
@@ -878,7 +878,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
let encoder = UniswapV4SwapEncoder::new(
|
let encoder = UniswapV4SwapEncoder::new(
|
||||||
String::from("0xF62849F9A0B5Bf2913b396098F7c7019b51A820a"),
|
String::from("0xF62849F9A0B5Bf2913b396098F7c7019b51A820a"),
|
||||||
TychoCoreChain::Ethereum.into(),
|
Chain::Ethereum,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -951,7 +951,7 @@ mod tests {
|
|||||||
|
|
||||||
let encoder = UniswapV4SwapEncoder::new(
|
let encoder = UniswapV4SwapEncoder::new(
|
||||||
String::from("0x543778987b293C7E8Cf0722BB2e935ba6f4068D4"),
|
String::from("0x543778987b293C7E8Cf0722BB2e935ba6f4068D4"),
|
||||||
TychoCoreChain::Ethereum.into(),
|
Chain::Ethereum,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -1046,7 +1046,7 @@ mod tests {
|
|||||||
|
|
||||||
let encoder = UniswapV4SwapEncoder::new(
|
let encoder = UniswapV4SwapEncoder::new(
|
||||||
String::from("0xF62849F9A0B5Bf2913b396098F7c7019b51A820a"),
|
String::from("0xF62849F9A0B5Bf2913b396098F7c7019b51A820a"),
|
||||||
TychoCoreChain::Ethereum.into(),
|
Chain::Ethereum,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -1130,9 +1130,7 @@ mod tests {
|
|||||||
transfer_type: TransferType::Transfer,
|
transfer_type: TransferType::Transfer,
|
||||||
};
|
};
|
||||||
|
|
||||||
let encoder =
|
let encoder = EkuboSwapEncoder::new(String::default(), Chain::Ethereum, None).unwrap();
|
||||||
EkuboSwapEncoder::new(String::default(), TychoCoreChain::Ethereum.into(), None)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let encoded_swap = encoder
|
let encoded_swap = encoder
|
||||||
.encode_swap(&swap, &encoding_context)
|
.encode_swap(&swap, &encoding_context)
|
||||||
@@ -1163,9 +1161,7 @@ mod tests {
|
|||||||
let group_token_out = Bytes::from("0xdAC17F958D2ee523a2206206994597C13D831ec7"); // USDT
|
let group_token_out = Bytes::from("0xdAC17F958D2ee523a2206206994597C13D831ec7"); // USDT
|
||||||
let intermediary_token = Bytes::from("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"); // USDC
|
let intermediary_token = Bytes::from("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"); // USDC
|
||||||
|
|
||||||
let encoder =
|
let encoder = EkuboSwapEncoder::new(String::default(), Chain::Ethereum, None).unwrap();
|
||||||
EkuboSwapEncoder::new(String::default(), TychoCoreChain::Ethereum.into(), None)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let encoding_context = EncodingContext {
|
let encoding_context = EncodingContext {
|
||||||
receiver: RECEIVER.into(),
|
receiver: RECEIVER.into(),
|
||||||
@@ -1329,12 +1325,8 @@ mod tests {
|
|||||||
split: 0f64,
|
split: 0f64,
|
||||||
user_data: None,
|
user_data: None,
|
||||||
};
|
};
|
||||||
let encoder = CurveSwapEncoder::new(
|
let encoder =
|
||||||
String::default(),
|
CurveSwapEncoder::new(String::default(), Chain::Ethereum, curve_config()).unwrap();
|
||||||
TychoCoreChain::Ethereum.into(),
|
|
||||||
curve_config(),
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
let (i, j) = encoder
|
let (i, j) = encoder
|
||||||
.get_coin_indexes(
|
.get_coin_indexes(
|
||||||
&swap,
|
&swap,
|
||||||
@@ -1384,7 +1376,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
let encoder = CurveSwapEncoder::new(
|
let encoder = CurveSwapEncoder::new(
|
||||||
String::from("0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f"),
|
String::from("0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f"),
|
||||||
TychoCoreChain::Ethereum.into(),
|
Chain::Ethereum,
|
||||||
curve_config(),
|
curve_config(),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -1456,7 +1448,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
let encoder = CurveSwapEncoder::new(
|
let encoder = CurveSwapEncoder::new(
|
||||||
String::from("0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f"),
|
String::from("0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f"),
|
||||||
TychoCoreChain::Ethereum.into(),
|
Chain::Ethereum,
|
||||||
curve_config(),
|
curve_config(),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -1529,7 +1521,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
let encoder = CurveSwapEncoder::new(
|
let encoder = CurveSwapEncoder::new(
|
||||||
String::from("0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f"),
|
String::from("0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f"),
|
||||||
TychoCoreChain::Ethereum.into(),
|
Chain::Ethereum,
|
||||||
Some(HashMap::from([
|
Some(HashMap::from([
|
||||||
(
|
(
|
||||||
"native_token_address".to_string(),
|
"native_token_address".to_string(),
|
||||||
@@ -1603,7 +1595,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
let encoder = BalancerV3SwapEncoder::new(
|
let encoder = BalancerV3SwapEncoder::new(
|
||||||
String::from("0x543778987b293C7E8Cf0722BB2e935ba6f4068D4"),
|
String::from("0x543778987b293C7E8Cf0722BB2e935ba6f4068D4"),
|
||||||
TychoCoreChain::Ethereum.into(),
|
Chain::Ethereum,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -1661,7 +1653,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
let encoder = MaverickV2SwapEncoder::new(
|
let encoder = MaverickV2SwapEncoder::new(
|
||||||
String::from("0x543778987b293C7E8Cf0722BB2e935ba6f4068D4"),
|
String::from("0x543778987b293C7E8Cf0722BB2e935ba6f4068D4"),
|
||||||
TychoCoreChain::Ethereum.into(),
|
Chain::Ethereum,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::{collections::HashSet, str::FromStr};
|
use std::{collections::HashSet, str::FromStr};
|
||||||
|
|
||||||
use alloy::signers::local::PrivateKeySigner;
|
use alloy::signers::local::PrivateKeySigner;
|
||||||
use tycho_common::Bytes;
|
use tycho_common::{models::Chain, Bytes};
|
||||||
|
|
||||||
use crate::encoding::{
|
use crate::encoding::{
|
||||||
errors::EncodingError,
|
errors::EncodingError,
|
||||||
@@ -16,7 +16,7 @@ use crate::encoding::{
|
|||||||
swap_encoder::swap_encoder_registry::SwapEncoderRegistry,
|
swap_encoder::swap_encoder_registry::SwapEncoderRegistry,
|
||||||
},
|
},
|
||||||
models::{
|
models::{
|
||||||
Chain, EncodedSolution, EncodingContext, NativeAction, Solution, Transaction, TransferType,
|
EncodedSolution, EncodingContext, NativeAction, Solution, Transaction, TransferType,
|
||||||
UserTransferType,
|
UserTransferType,
|
||||||
},
|
},
|
||||||
strategy_encoder::StrategyEncoder,
|
strategy_encoder::StrategyEncoder,
|
||||||
@@ -61,19 +61,19 @@ impl TychoRouterEncoder {
|
|||||||
};
|
};
|
||||||
Ok(TychoRouterEncoder {
|
Ok(TychoRouterEncoder {
|
||||||
single_swap_strategy: SingleSwapStrategyEncoder::new(
|
single_swap_strategy: SingleSwapStrategyEncoder::new(
|
||||||
chain.clone(),
|
chain,
|
||||||
swap_encoder_registry.clone(),
|
swap_encoder_registry.clone(),
|
||||||
user_transfer_type.clone(),
|
user_transfer_type.clone(),
|
||||||
router_address.clone(),
|
router_address.clone(),
|
||||||
)?,
|
)?,
|
||||||
sequential_swap_strategy: SequentialSwapStrategyEncoder::new(
|
sequential_swap_strategy: SequentialSwapStrategyEncoder::new(
|
||||||
chain.clone(),
|
chain,
|
||||||
swap_encoder_registry.clone(),
|
swap_encoder_registry.clone(),
|
||||||
user_transfer_type.clone(),
|
user_transfer_type.clone(),
|
||||||
router_address.clone(),
|
router_address.clone(),
|
||||||
)?,
|
)?,
|
||||||
split_swap_strategy: SplitSwapStrategyEncoder::new(
|
split_swap_strategy: SplitSwapStrategyEncoder::new(
|
||||||
chain.clone(),
|
chain,
|
||||||
swap_encoder_registry,
|
swap_encoder_registry,
|
||||||
user_transfer_type.clone(),
|
user_transfer_type.clone(),
|
||||||
router_address.clone(),
|
router_address.clone(),
|
||||||
@@ -153,11 +153,11 @@ impl TychoEncoder for TychoRouterEncoder {
|
|||||||
let encoded_solution = self.encode_solution(solution)?;
|
let encoded_solution = self.encode_solution(solution)?;
|
||||||
|
|
||||||
let transaction = encode_tycho_router_call(
|
let transaction = encode_tycho_router_call(
|
||||||
self.chain.id,
|
self.chain.id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
solution,
|
solution,
|
||||||
&self.user_transfer_type,
|
&self.user_transfer_type,
|
||||||
&self.chain.native_token()?,
|
&self.chain.native_token().address,
|
||||||
self.signer.clone(),
|
self.signer.clone(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
@@ -186,8 +186,11 @@ impl TychoEncoder for TychoRouterEncoder {
|
|||||||
if solution.swaps.is_empty() {
|
if solution.swaps.is_empty() {
|
||||||
return Err(EncodingError::FatalError("No swaps found in solution".to_string()));
|
return Err(EncodingError::FatalError("No swaps found in solution".to_string()));
|
||||||
}
|
}
|
||||||
let native_address = self.chain.native_token()?;
|
let native_address = self.chain.native_token().address;
|
||||||
let wrapped_address = self.chain.wrapped_token()?;
|
let wrapped_address = self
|
||||||
|
.chain
|
||||||
|
.wrapped_native_token()
|
||||||
|
.address;
|
||||||
if let Some(native_action) = &solution.native_action {
|
if let Some(native_action) = &solution.native_action {
|
||||||
if native_action == &NativeAction::Wrap {
|
if native_action == &NativeAction::Wrap {
|
||||||
if solution.given_token != native_address {
|
if solution.given_token != native_address {
|
||||||
@@ -387,7 +390,7 @@ mod tests {
|
|||||||
use std::{collections::HashMap, str::FromStr};
|
use std::{collections::HashMap, str::FromStr};
|
||||||
|
|
||||||
use num_bigint::{BigInt, BigUint};
|
use num_bigint::{BigInt, BigUint};
|
||||||
use tycho_common::models::{protocol::ProtocolComponent, Chain as TychoCommonChain};
|
use tycho_common::models::{protocol::ProtocolComponent, Chain};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::encoding::models::Swap;
|
use crate::encoding::models::Swap;
|
||||||
@@ -466,7 +469,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn eth_chain() -> Chain {
|
fn eth_chain() -> Chain {
|
||||||
TychoCommonChain::Ethereum.into()
|
Chain::Ethereum
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_swap_encoder_registry() -> SwapEncoderRegistry {
|
fn get_swap_encoder_registry() -> SwapEncoderRegistry {
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
use clap::ValueEnum;
|
use clap::ValueEnum;
|
||||||
use hex;
|
|
||||||
use num_bigint::BigUint;
|
use num_bigint::BigUint;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tycho_common::{
|
use tycho_common::{models::protocol::ProtocolComponent, Bytes};
|
||||||
models::{protocol::ProtocolComponent, Chain as TychoCommonChain},
|
|
||||||
Bytes,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::encoding::{errors::EncodingError, serde_primitives::biguint_string};
|
use crate::encoding::serde_primitives::biguint_string;
|
||||||
|
|
||||||
/// Specifies the method for transferring user funds into Tycho execution.
|
/// Specifies the method for transferring user funds into Tycho execution.
|
||||||
///
|
///
|
||||||
@@ -210,63 +206,6 @@ pub enum TransferType {
|
|||||||
None = 2,
|
None = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Hash)]
|
|
||||||
pub struct Chain {
|
|
||||||
pub id: u64,
|
|
||||||
pub name: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<TychoCommonChain> for Chain {
|
|
||||||
fn from(chain: TychoCommonChain) -> Self {
|
|
||||||
match chain {
|
|
||||||
TychoCommonChain::Ethereum => Chain { id: 1, name: chain.to_string() },
|
|
||||||
TychoCommonChain::ZkSync => Chain { id: 324, name: chain.to_string() },
|
|
||||||
TychoCommonChain::Arbitrum => Chain { id: 42161, name: chain.to_string() },
|
|
||||||
TychoCommonChain::Starknet => Chain { id: 0, name: chain.to_string() },
|
|
||||||
TychoCommonChain::Base => Chain { id: 8453, name: chain.to_string() },
|
|
||||||
TychoCommonChain::Unichain => Chain { id: 130, name: chain.to_string() },
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Chain {
|
|
||||||
fn decode_hex(&self, hex_str: &str, err_msg: &str) -> Result<Bytes, EncodingError> {
|
|
||||||
Ok(Bytes::from(
|
|
||||||
hex::decode(hex_str).map_err(|_| EncodingError::FatalError(err_msg.to_string()))?,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn native_token(&self) -> Result<Bytes, EncodingError> {
|
|
||||||
let decode_err_msg = "Failed to decode native token";
|
|
||||||
match self.id {
|
|
||||||
1 | 8453 | 42161 => {
|
|
||||||
self.decode_hex("0000000000000000000000000000000000000000", decode_err_msg)
|
|
||||||
}
|
|
||||||
324 => self.decode_hex("000000000000000000000000000000000000800A", decode_err_msg),
|
|
||||||
130 => self.decode_hex("0000000000000000000000000000000000000000", decode_err_msg),
|
|
||||||
_ => Err(EncodingError::InvalidInput(format!(
|
|
||||||
"Native token not set for chain {:?}. Double check the chain is supported.",
|
|
||||||
self.name
|
|
||||||
))),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn wrapped_token(&self) -> Result<Bytes, EncodingError> {
|
|
||||||
let decode_err_msg = "Failed to decode wrapped token";
|
|
||||||
match self.id {
|
|
||||||
1 => self.decode_hex("C02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", decode_err_msg),
|
|
||||||
8453 => self.decode_hex("4200000000000000000000000000000000000006", decode_err_msg),
|
|
||||||
324 => self.decode_hex("5AEa5775959fBC2557Cc8789bC1bf90A239D9a91", decode_err_msg),
|
|
||||||
42161 => self.decode_hex("82aF49447D8a07e3bd95BD0d56f35241523fBab1", decode_err_msg),
|
|
||||||
130 => self.decode_hex("4200000000000000000000000000000000000006", decode_err_msg),
|
|
||||||
_ => Err(EncodingError::InvalidInput(format!(
|
|
||||||
"Wrapped token not set for chain {:?}. Double check the chain is supported.",
|
|
||||||
self.name
|
|
||||||
))),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use tycho_common::models::Chain;
|
||||||
|
|
||||||
use crate::encoding::{
|
use crate::encoding::{
|
||||||
errors::EncodingError,
|
errors::EncodingError,
|
||||||
models::{Chain, EncodingContext, Swap},
|
models::{EncodingContext, Swap},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A trait for protocol-specific swap encoding, where each implementation should handle the
|
/// A trait for protocol-specific swap encoding, where each implementation should handle the
|
||||||
|
|||||||
@@ -4,10 +4,9 @@ pub mod encoding;
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use alloy::{primitives::B256, signers::local::PrivateKeySigner};
|
use alloy::{primitives::B256, signers::local::PrivateKeySigner};
|
||||||
use tycho_common::{models::Chain as TychoCommonChain, Bytes};
|
use tycho_common::{models::Chain, Bytes};
|
||||||
use tycho_execution::encoding::{
|
use tycho_execution::encoding::{
|
||||||
evm::encoder_builders::TychoRouterEncoderBuilder,
|
evm::encoder_builders::TychoRouterEncoderBuilder, models::UserTransferType,
|
||||||
models::{Chain, UserTransferType},
|
|
||||||
tycho_encoder::TychoEncoder,
|
tycho_encoder::TychoEncoder,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -16,7 +15,7 @@ pub fn router_address() -> Bytes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn eth_chain() -> Chain {
|
pub fn eth_chain() -> Chain {
|
||||||
TychoCommonChain::Ethereum.into()
|
Chain::Ethereum
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn eth() -> Bytes {
|
pub fn eth() -> Bytes {
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ fn test_uniswap_v3_uniswap_v2() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFrom,
|
&UserTransferType::TransferFrom,
|
||||||
@@ -167,7 +167,7 @@ fn test_uniswap_v3_uniswap_v3() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFrom,
|
&UserTransferType::TransferFrom,
|
||||||
@@ -263,7 +263,7 @@ fn test_uniswap_v3_curve() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFrom,
|
&UserTransferType::TransferFrom,
|
||||||
@@ -334,7 +334,7 @@ fn test_balancer_v2_uniswap_v2() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFrom,
|
&UserTransferType::TransferFrom,
|
||||||
@@ -490,7 +490,7 @@ fn test_multi_protocol() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFromPermit2,
|
&UserTransferType::TransferFromPermit2,
|
||||||
@@ -565,7 +565,7 @@ fn test_uniswap_v3_balancer_v3() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFrom,
|
&UserTransferType::TransferFrom,
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ fn test_single_encoding_strategy_ekubo() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFrom,
|
&UserTransferType::TransferFrom,
|
||||||
@@ -115,7 +115,7 @@ fn test_single_encoding_strategy_maverick() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFrom,
|
&UserTransferType::TransferFrom,
|
||||||
@@ -177,7 +177,7 @@ fn test_single_encoding_strategy_usv4_eth_in() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFromPermit2,
|
&UserTransferType::TransferFromPermit2,
|
||||||
@@ -244,7 +244,7 @@ fn test_single_encoding_strategy_usv4_eth_out() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFromPermit2,
|
&UserTransferType::TransferFromPermit2,
|
||||||
@@ -330,7 +330,7 @@ fn test_single_encoding_strategy_usv4_grouped_swap() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFromPermit2,
|
&UserTransferType::TransferFromPermit2,
|
||||||
@@ -440,7 +440,7 @@ fn test_single_encoding_strategy_curve() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFrom,
|
&UserTransferType::TransferFrom,
|
||||||
@@ -507,7 +507,7 @@ fn test_single_encoding_strategy_curve_st_eth() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFrom,
|
&UserTransferType::TransferFrom,
|
||||||
@@ -560,7 +560,7 @@ fn test_single_encoding_strategy_balancer_v3() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFrom,
|
&UserTransferType::TransferFrom,
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ fn test_sequential_swap_strategy_encoder() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFromPermit2,
|
&UserTransferType::TransferFromPermit2,
|
||||||
@@ -135,7 +135,7 @@ fn test_sequential_swap_strategy_encoder_no_permit2() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFrom,
|
&UserTransferType::TransferFrom,
|
||||||
@@ -260,7 +260,7 @@ fn test_sequential_strategy_cyclic_swap() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFromPermit2,
|
&UserTransferType::TransferFromPermit2,
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ fn test_single_swap_strategy_encoder() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solutions[0].clone(),
|
encoded_solutions[0].clone(),
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFromPermit2,
|
&UserTransferType::TransferFromPermit2,
|
||||||
@@ -139,7 +139,7 @@ fn test_single_swap_strategy_encoder_no_permit2() {
|
|||||||
.unwrap()[0]
|
.unwrap()[0]
|
||||||
.clone();
|
.clone();
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFrom,
|
&UserTransferType::TransferFrom,
|
||||||
@@ -221,7 +221,7 @@ fn test_single_swap_strategy_encoder_no_transfer_in() {
|
|||||||
.unwrap()[0]
|
.unwrap()[0]
|
||||||
.clone();
|
.clone();
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::None,
|
&UserTransferType::None,
|
||||||
@@ -305,7 +305,7 @@ fn test_single_swap_strategy_encoder_wrap() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFromPermit2,
|
&UserTransferType::TransferFromPermit2,
|
||||||
@@ -357,7 +357,7 @@ fn test_single_swap_strategy_encoder_unwrap() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFromPermit2,
|
&UserTransferType::TransferFromPermit2,
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ fn test_split_swap_strategy_encoder() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFromPermit2,
|
&UserTransferType::TransferFromPermit2,
|
||||||
@@ -212,7 +212,7 @@ fn test_split_input_cyclic_swap() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFromPermit2,
|
&UserTransferType::TransferFromPermit2,
|
||||||
@@ -372,7 +372,7 @@ fn test_split_output_cyclic_swap() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let calldata = encode_tycho_router_call(
|
let calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFromPermit2,
|
&UserTransferType::TransferFromPermit2,
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ fn test_sequential_swap_usx() {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let tycho_calldata = encode_tycho_router_call(
|
let tycho_calldata = encode_tycho_router_call(
|
||||||
eth_chain().id,
|
eth_chain().id(),
|
||||||
encoded_solution,
|
encoded_solution,
|
||||||
&solution,
|
&solution,
|
||||||
&UserTransferType::TransferFrom,
|
&UserTransferType::TransferFrom,
|
||||||
|
|||||||
Reference in New Issue
Block a user