Skip to content

Commit

Permalink
add support for blast
Browse files Browse the repository at this point in the history
  • Loading branch information
malik672 committed Apr 28, 2024
1 parent fb3c083 commit c4f9ccf
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
32 changes: 32 additions & 0 deletions src/addresses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ lazy_static! {
ChainId::CELO as u64,
address!("79a530c8e2fA8748B7B40dd3629C0520c2cCf03f"),
);
m.insert(
ChainId::BLAST as u64,
address!("5C346464d33F90bABaf70dB6388507CC889C1070"),
);
m
};
}
Expand Down Expand Up @@ -140,6 +144,10 @@ lazy_static! {
ChainId::POLYGON as u64,
address!("edf6066a2b290c185783862c7f4776a2c8077ad1"),
);
m.insert(
ChainId::BLAST as u64,
address!("BB66Eb1c5e875933D44DAe661dbD80e5D9B03035"),
);
m
};
}
Expand Down Expand Up @@ -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.
///
Expand Down Expand Up @@ -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
};
}
Expand Down Expand Up @@ -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")
);
}
}
7 changes: 6 additions & 1 deletion src/chains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
Expand All @@ -95,4 +98,6 @@ pub enum NativeCurrencyName {
AVAX,
/// Rootstock's native currency.
ROOTSTOCK,
/// Blast native currency.
BLAST,
}

0 comments on commit c4f9ccf

Please sign in to comment.