docs: (WIP) In-code docs for encoders

- TODO double check all this, look for missing docs
This commit is contained in:
TAMARA LIPOWSKI
2025-02-04 18:11:32 -05:00
parent 25a26f21be
commit 52cce5f5c6
10 changed files with 72 additions and 6 deletions

View File

@@ -12,6 +12,12 @@ use crate::encoding::{
strategy_encoder::{StrategyEncoder, StrategyEncoderRegistry},
};
/// Contains all supported strategies to encode a solution.
///
/// # Fields
/// * `strategies` - A hashmap containing the name of the strategy as a key and the strategy
/// encoder as a value.
pub struct EVMStrategyEncoderRegistry {
strategies: HashMap<String, Box<dyn StrategyEncoder>>,
}

View File

@@ -54,6 +54,13 @@ pub trait EVMStrategyEncoder: StrategyEncoder {
}
}
/// Represents the encoder for a swap strategy which supports single, sequential and split swaps.
///
/// # Fields
///
/// * `swap_encoder_registry`: SwapEncoderRegistry, containing all possible swap encoders
/// * `permit2`: Permit2, the object containing necessary information for managing permit2 operations
/// * `selector`: String, the selector for the swap function in the router contract
pub struct SplitSwapStrategyEncoder {
swap_encoder_registry: SwapEncoderRegistry,
permit2: Permit2,
@@ -213,7 +220,11 @@ impl StrategyEncoder for SplitSwapStrategyEncoder {
}
/// This strategy encoder is used for solutions that are sent directly to the pool.
/// Only 1 solution with 1 swap is supported.
/// Only one solution with one swap is supported.
///
/// # Fields
///
/// * `swap_encoder_registry`: SwapEncoderRegistry, containing all possible swap encoders
pub struct ExecutorStrategyEncoder {
swap_encoder_registry: SwapEncoderRegistry,
}