- The router address can be set when creating the SplitSwapStrategy, which now takes an Option<Bytes> as input during initialization (another breaking interface change) - This change allows us to change our router address in the future with minimal effect on the users. Users should only pass the router address in the split swap initialization if they intend to use their own router for execution. - This change also means that the router address does not need to be passed with the solution, even when using the executor strategy (which was pointless). - I thought of having a router_address() method to set this in the encoder builder - but it seemed too messy, since we don't need the router address for execution for example. We would then potentially unnecessarily load and set the default router address when not needed. It is also not even used at the highest level EVMTychoEncoder, so it makes more sense for it to be directly associated with the swap strategy instead. - Users will now not be able to encode for different routers without re-initializing the strategy. We assumed this use case to be very rare and not worth supporting.
18 lines
732 B
Rust
18 lines
732 B
Rust
use std::{collections::HashSet, sync::LazyLock};
|
|
|
|
pub const DEFAULT_EXECUTORS_JSON: &str = include_str!("../../../config/executor_addresses.json");
|
|
pub const DEFAULT_ROUTERS_JSON: &str = include_str!("../../../config/router_addresses.json");
|
|
|
|
/// These protocols support the optimization of grouping swaps.
|
|
///
|
|
/// This requires special encoding to send call data of multiple swaps to a single executor,
|
|
/// as if it were a single swap. The protocol likely uses flash accounting to save gas on token
|
|
/// transfers.
|
|
pub static GROUPABLE_PROTOCOLS: LazyLock<HashSet<&'static str>> = LazyLock::new(|| {
|
|
let mut set = HashSet::new();
|
|
set.insert("uniswap_v4");
|
|
set.insert("balancer_v3");
|
|
set.insert("ekubo");
|
|
set
|
|
});
|