Skip to content

Commit

Permalink
set validate and parse address as a feature
Browse files Browse the repository at this point in the history
  • Loading branch information
malik672 committed Feb 13, 2024
1 parent 3bc6a5c commit e064be6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
12 changes: 12 additions & 0 deletions src/addresses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ type ChainMap = HashMap<u64, ChainAddresses>;
type ChainAddress = HashMap<u64, Address>;

#[derive(Clone)]


pub struct ChainAddresses {
v3_core_factory_address: Address,
multicall_address: Address,
Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit e064be6

Please sign in to comment.