docs: improvements from PR comments
This commit is contained in:
@@ -71,8 +71,8 @@ pub trait EVMStrategyEncoder: StrategyEncoder {
|
|||||||
///
|
///
|
||||||
/// # Fields
|
/// # Fields
|
||||||
/// * `swap_encoder_registry`: SwapEncoderRegistry, containing all possible swap encoders
|
/// * `swap_encoder_registry`: SwapEncoderRegistry, containing all possible swap encoders
|
||||||
/// * `permit2`: Permit2, the object containing necessary information for managing permit2
|
/// * `permit2`: Permit2, responsible for managing permit2 operations and providing necessary
|
||||||
/// operations
|
/// signatures and permit2 objects for calling the router
|
||||||
/// * `selector`: String, the selector for the swap function in the router contract
|
/// * `selector`: String, the selector for the swap function in the router contract
|
||||||
pub struct SplitSwapStrategyEncoder {
|
pub struct SplitSwapStrategyEncoder {
|
||||||
swap_encoder_registry: SwapEncoderRegistry,
|
swap_encoder_registry: SwapEncoderRegistry,
|
||||||
@@ -92,7 +92,7 @@ impl SplitSwapStrategyEncoder {
|
|||||||
|
|
||||||
/// Raises an error if the split percentages are invalid.
|
/// Raises an error if the split percentages are invalid.
|
||||||
///
|
///
|
||||||
/// Split percentages are considered valid of all the following conditions are met:
|
/// Split percentages are considered valid if all the following conditions are met:
|
||||||
/// * Each split amount is < 1 (100%)
|
/// * Each split amount is < 1 (100%)
|
||||||
/// * There is exactly one 0% split for each token, and it's the last swap specified, signifying
|
/// * There is exactly one 0% split for each token, and it's the last swap specified, signifying
|
||||||
/// to the router to send the remainder of the token to the designated protocol
|
/// to the router to send the remainder of the token to the designated protocol
|
||||||
@@ -171,9 +171,9 @@ impl SplitSwapStrategyEncoder {
|
|||||||
/// Raises an error if swaps do not represent a valid path from the given token to the checked
|
/// Raises an error if swaps do not represent a valid path from the given token to the checked
|
||||||
/// token.
|
/// token.
|
||||||
///
|
///
|
||||||
/// A path is considered valid of all the following conditions are met:
|
/// A path is considered valid if all the following conditions are met:
|
||||||
/// * The checked token is reachable from the given token through the swap path
|
/// * The checked token is reachable from the given token through the swap path
|
||||||
/// * There are tokens which are unconnected from the main path
|
/// * There are no tokens which are unconnected from the main path
|
||||||
fn validate_swap_path(
|
fn validate_swap_path(
|
||||||
&self,
|
&self,
|
||||||
swaps: &[Swap],
|
swaps: &[Swap],
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ pub struct SwapEncoderRegistry {
|
|||||||
|
|
||||||
impl SwapEncoderRegistry {
|
impl SwapEncoderRegistry {
|
||||||
/// Populates the registry with the `SwapEncoders` for the given blockchain by parsing the
|
/// Populates the registry with the `SwapEncoders` for the given blockchain by parsing the
|
||||||
/// executors in the file at the given path.
|
/// executors' addresses in the file at the given path.
|
||||||
pub fn new(executors_file_path: &str, blockchain: Chain) -> Result<Self, EncodingError> {
|
pub fn new(executors_file_path: &str, blockchain: Chain) -> Result<Self, EncodingError> {
|
||||||
let config_str = fs::read_to_string(executors_file_path)?;
|
let config_str = fs::read_to_string(executors_file_path)?;
|
||||||
let config: HashMap<Chain, HashMap<String, String>> = serde_json::from_str(&config_str)?;
|
let config: HashMap<Chain, HashMap<String, String>> = serde_json::from_str(&config_str)?;
|
||||||
|
|||||||
Reference in New Issue
Block a user