diff --git a/Cargo.lock b/Cargo.lock index 67d406d..30db2a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1361,6 +1361,7 @@ dependencies = [ "num-rational", "num-traits", "regex", + "syn 2.0.48", "thiserror", ] diff --git a/Cargo.toml b/Cargo.toml index 091886c..e60bf10 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,4 +18,8 @@ num-integer = "0.1.45" num-rational = "0.4.1" num-traits = "0.2.17" regex = "1.10.2" +syn = "2.0.48" thiserror = "1.0.56" + +[features] +validate_parse_address = [] \ No newline at end of file diff --git a/src/addresses.rs b/src/addresses.rs index 685c950..659eba5 100644 --- a/src/addresses.rs +++ b/src/addresses.rs @@ -5,6 +5,8 @@ type ChainMap = HashMap; type ChainAddress = HashMap; #[derive(Clone)] + + pub struct ChainAddresses { v3_core_factory_address: Address, multicall_address: Address, @@ -18,6 +20,16 @@ pub struct ChainAddresses { pub const DEFAULT_NETWORKS: [ChainId; 3] = [ChainId::MAINNET, ChainId::GOERLI, ChainId::SEPOLIA]; +/// returns an hashmap of key pair input of chainid to address +/// +/// # Arguments +/// +/// * Address +/// * additional networks a vector of chainid +/// +/// +/// returns: AdresssMap +/// pub fn construct_same_address_map(address: Address, additional_networks: &[ChainId]) -> AddressMap { let mut networks = DEFAULT_NETWORKS.to_vec(); networks.extend_from_slice(additional_networks); diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 5279e1f..6fcb698 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,4 +1,5 @@ pub mod compute_price_impact; pub mod sorted_insert; pub mod sqrt; +#[cfg(feature = "validate_parse_address")] pub mod validate_and_parse_address;