diff --git a/Cargo.toml b/Cargo.toml index 153b809..917ea46 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uniswap-sdk-core" -version = "0.21.0" +version = "0.23.0" edition = "2021" authors = ["malik ", "Shuhui Luo "] description = "The Uniswap SDK Core in Rust provides essential functionality for interacting with the Uniswap decentralized exchange" diff --git a/README.md b/README.md index c7f65a6..beccee8 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Add this to your Cargo.toml ``` [dependencies] -uniswap-sdk-core = "0.22.0"; +uniswap-sdk-core = "0.23.0"; ``` And this to your code: diff --git a/src/addresses.rs b/src/addresses.rs index 9d1bc78..bef5b54 100644 --- a/src/addresses.rs +++ b/src/addresses.rs @@ -99,6 +99,10 @@ lazy_static! { ChainId::CELO as u64, address!("79a530c8e2fA8748B7B40dd3629C0520c2cCf03f"), ); + m.insert( + ChainId::BLAST as u64, + address!("5C346464d33F90bABaf70dB6388507CC889C1070"), + ); m }; } @@ -140,6 +144,10 @@ lazy_static! { ChainId::POLYGON as u64, address!("edf6066a2b290c185783862c7f4776a2c8077ad1"), ); + m.insert( + ChainId::BLAST as u64, + address!("BB66Eb1c5e875933D44DAe661dbD80e5D9B03035"), + ); m }; } @@ -388,6 +396,20 @@ pub const ROOTSTOCK_ADDRESSES: ChainAddresses = ChainAddresses { v1_mixed_route_quoter_address: None, }; +/// Blast addresses +pub const BLAST_ADDRESSES: ChainAddresses = ChainAddresses { + v3_core_factory_address: address!("792edAdE80af5fC680d96a2eD80A44247D2Cf6Fd"), + multicall_address: address!("dC7f370de7631cE9e2c2e1DCDA6B3B5744Cf4705"), + quoter_address: address!("6Cdcd65e03c1CEc3730AeeCd45bc140D57A25C77"), + v3_migrator_address: Some(address!("15CA7043CD84C5D21Ae76Ba0A1A967d42c40ecE0")), + nonfungible_position_manager_address: Some(address!( + "B218e4f7cF0533d4696fDfC419A0023D33345F28" + )), + tick_lens_address: Some(address!("2E95185bCdD928a3e984B7e2D6560Ab1b17d7274")), + swap_router02_address: Some(address!("549FEB8c9bd4c12Ad2AB27022dA12492aC452B66")), + v1_mixed_route_quoter_address: None, +}; + lazy_static! { /// A map of chain IDs to their corresponding Uniswap contract addresses. /// @@ -418,6 +440,7 @@ lazy_static! { new_map.insert(ChainId::ZORA as u64, ZORA_ADDRESSES); new_map.insert(ChainId::ZORASEPOLIA as u64, ZORA_SEPOLIA_ADDRESSES); new_map.insert(ChainId::ROOTSTOCK as u64, ROOTSTOCK_ADDRESSES); + new_map.insert(ChainId::BLAST as u64, BLAST_ADDRESSES); new_map }; } @@ -759,4 +782,13 @@ mod tests { address!("3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E") ); } + + #[test] + fn test_swap_router_02_addresses_blast() { + let address = swap_router02_address(ChainId::BLAST as u64); + assert_eq!( + address, + address!("549FEB8c9bd4c12Ad2AB27022dA12492aC452B66") + ); + } } diff --git a/src/chains.rs b/src/chains.rs index f08eb85..dbbe537 100644 --- a/src/chains.rs +++ b/src/chains.rs @@ -47,13 +47,15 @@ pub enum ChainId { ZORASEPOLIA = 999999999, /// The Rootstock network. ROOTSTOCK = 30, + /// The Blast network. + BLAST = 81457, } /// A list of `ChainId` constants representing the blockchain networks supported by the Uniswap SDK. /// /// This array includes all the `ChainId` variants that are supported by the SDK, making it easy to /// iterate over or check for supported chains. -pub const SUPPORTED_CHAINS: [ChainId; 20] = [ +pub const SUPPORTED_CHAINS: [ChainId; 21] = [ ChainId::MAINNET, ChainId::OPTIMISM, ChainId::OPTIMISMGOERLI, @@ -74,6 +76,7 @@ pub const SUPPORTED_CHAINS: [ChainId; 20] = [ ChainId::ZORA, ChainId::ZORASEPOLIA, ChainId::ROOTSTOCK, + ChainId::BLAST, ]; /// Represents the names of native currencies supported by the Uniswap SDK. @@ -95,4 +98,6 @@ pub enum NativeCurrencyName { AVAX, /// Rootstock's native currency. ROOTSTOCK, + /// Blast native currency. + BLAST, } diff --git a/src/entities/fractions/fraction.rs b/src/entities/fractions/fraction.rs index 274554a..bf762f4 100644 --- a/src/entities/fractions/fraction.rs +++ b/src/entities/fractions/fraction.rs @@ -82,7 +82,7 @@ pub trait FractionBase: Sized { /// Accessor method for retrieving metadata fn meta(&self) -> M; - /// Accessor method for retrieving the numerator + /// Accessor method for retrieving numerator fn numerator(&self) -> BigInt; /// Accessor method for retrieving the denominator diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 6fcb698..00f4e7a 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,5 +1,9 @@ + pub mod compute_price_impact; + + pub mod sorted_insert; + pub mod sqrt; #[cfg(feature = "validate_parse_address")] pub mod validate_and_parse_address;