fix: Rename constants and update docstrings for clarity

--- don't change below this line ---
ENG-4314 Took 44 minutes


Took 9 seconds
This commit is contained in:
Diana Carvalho
2025-04-17 15:51:01 +01:00
parent 8aa5b08b41
commit 244b7d3482
3 changed files with 32 additions and 35 deletions

View File

@@ -18,29 +18,28 @@ pub static GROUPABLE_PROTOCOLS: LazyLock<HashSet<&'static str>> = LazyLock::new(
set
});
/// These protocols support the optimization of transferring straight from the user.
/// Any protocols that are not defined here expect funds to be in the router at the time of swap.
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 need an external in transfer to the pool. This transfer can be from the router,
/// from the user or from the previous pool. Any protocols that are not defined here expect funds to
/// be in the router at the time of swap and do the transfer themselves from msg.sender
pub static IN_TRANSFER_REQUIRED_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 do not support chained swaps. The tokens can not be sent directly from the
// previous pool into a pool of this protocol. The tokens need to be sent to the router and only
// then transferred into the pool. 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 UNSUPPORTED_PROTOCOLS_FOR_CHAINED_SWAPS: LazyLock<HashSet<&'static str>> =
LazyLock::new(|| {
let mut set = HashSet::new();
set.insert("uniswap_v3");
set.insert("pancakeswap_v3");
set
});
// The protocols here are a subset of the ones defined in IN_TRANSFER_REQUIRED_PROTOCOLS. The tokens
// can not be sent directly from the previous pool into a pool of this protocol. The tokens need to
// be sent to the router and only then transferred into the pool. 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 CALLBACK_CONSTRAINED_PROTOCOLS: LazyLock<HashSet<&'static str>> = LazyLock::new(|| {
let mut set = HashSet::new();
set.insert("uniswap_v3");
set.insert("pancakeswap_v3");
set
});