feat: Support in between swaps optimizations

--- don't change below this line ---
ENG-4314 Took 31 seconds
This commit is contained in:
Diana Carvalho
2025-04-16 19:01:15 +01:00
parent eb1aa6cdcd
commit efe12cfcd6
5 changed files with 649 additions and 182 deletions

View File

@@ -13,7 +13,7 @@ pub const PROTOCOL_SPECIFIC_CONFIG: &str =
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("vm:balancer_v3");
set.insert("ekubo_v2");
set
});
@@ -23,18 +23,21 @@ pub static IN_TRANSFER_OPTIMIZABLE_PROTOCOLS: LazyLock<HashSet<&'static str>> =
LazyLock::new(|| {
let mut set = HashSet::new();
set.insert("uniswap_v2");
set.insert("sushiswap_v2");
set.insert("pancakeswap_v2");
set.insert("uniswap_v3");
set.insert("pancakeswap_v3");
set.insert("ekubo_v2");
set
});
/// These protocols expect funds to be in the router at the time of swap.
pub static PROTOCOLS_EXPECTING_FUNDS_IN_ROUTER: LazyLock<HashSet<&'static str>> =
// These protocols do not support chained swaps from the same protocol. This is the case for uniswap
// v3 because of the callback logic. The only way for this to work it would be to call the second
// swap during the callback of the first swap. This is currently not supported.
pub static PROTOCOLS_NOT_OPTIMIZED_CHAINED_SWAPS: LazyLock<HashSet<&'static str>> =
LazyLock::new(|| {
let mut set = HashSet::new();
set.insert("vm:curve");
set.insert("balancer_v2");
// TODO remove uniswap_v4 when we add callback support for transfer optimizations
set.insert("uniswap_v4");
set.insert("uniswap_v3");
set.insert("pancakeswap_v3");
set
});