feat: add support for Optimism Goerli (#1641)

This commit is contained in:
Danilo Tuler 2022-08-30 13:45:43 -03:00 committed by GitHub
parent 792d415845
commit ea8bcd11be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View File

@ -39,8 +39,8 @@ pub static MULTICALL_SUPPORTED_CHAIN_IDS: Lazy<[U256; 47]> = Lazy::new(|| {
U256::from(Ropsten), // Ropsten U256::from(Ropsten), // Ropsten
U256::from(Sepolia), // Sepolia U256::from(Sepolia), // Sepolia
U256::from(Optimism), // Optimism U256::from(Optimism), // Optimism
U256::from(OptimismGoerli), // OptimismGoerli
U256::from(OptimismKovan), // OptimismKovan U256::from(OptimismKovan), // OptimismKovan
U256::from(420), // OptimismGoerli
U256::from(Arbitrum), // Arbitrum U256::from(Arbitrum), // Arbitrum
U256::from(421613), // ArbitrumGoerli, U256::from(421613), // ArbitrumGoerli,
U256::from(ArbitrumTestnet), // Arbitrum Rinkeby U256::from(ArbitrumTestnet), // Arbitrum Rinkeby

View File

@ -46,6 +46,7 @@ pub enum Chain {
MoonbeamDev = 1281, MoonbeamDev = 1281,
Moonriver = 1285, Moonriver = 1285,
Optimism = 10, Optimism = 10,
OptimismGoerli = 420,
OptimismKovan = 69, OptimismKovan = 69,
Arbitrum = 42161, Arbitrum = 42161,
ArbitrumTestnet = 421611, ArbitrumTestnet = 421611,
@ -104,6 +105,7 @@ impl Chain {
Chain::Sepolia | Chain::Sepolia |
Chain::Moonbase | Chain::Moonbase |
Chain::MoonbeamDev | Chain::MoonbeamDev |
Chain::OptimismGoerli |
Chain::OptimismKovan | Chain::OptimismKovan |
Chain::Poa | Chain::Poa |
Chain::Sokol | Chain::Sokol |
@ -142,6 +144,10 @@ impl Chain {
Chain::Optimism => { Chain::Optimism => {
("https://api-optimistic.etherscan.io/api", "https://optimistic.etherscan.io") ("https://api-optimistic.etherscan.io/api", "https://optimistic.etherscan.io")
} }
Chain::OptimismGoerli => (
"https://api-goerli-optimistic.etherscan.io/api",
"https://goerli-optimism.etherscan.io",
),
Chain::OptimismKovan => ( Chain::OptimismKovan => (
"https://api-kovan-optimistic.etherscan.io/api", "https://api-kovan-optimistic.etherscan.io/api",
"https://kovan-optimistic.etherscan.io", "https://kovan-optimistic.etherscan.io",
@ -229,6 +235,7 @@ impl fmt::Display for Chain {
Chain::MoonbeamDev => "moonbeam-dev", Chain::MoonbeamDev => "moonbeam-dev",
Chain::Moonriver => "moonriver", Chain::Moonriver => "moonriver",
Chain::Optimism => "optimism", Chain::Optimism => "optimism",
Chain::OptimismGoerli => "optimism-goerli",
Chain::OptimismKovan => "optimism-kovan", Chain::OptimismKovan => "optimism-kovan",
Chain::Fantom => "fantom", Chain::Fantom => "fantom",
Chain::Dev => "dev", Chain::Dev => "dev",
@ -300,6 +307,7 @@ impl TryFrom<u64> for Chain {
1281 => Chain::MoonbeamDev, 1281 => Chain::MoonbeamDev,
1285 => Chain::Moonriver, 1285 => Chain::Moonriver,
10 => Chain::Optimism, 10 => Chain::Optimism,
420 => Chain::OptimismGoerli,
69 => Chain::OptimismKovan, 69 => Chain::OptimismKovan,
56 => Chain::BinanceSmartChain, 56 => Chain::BinanceSmartChain,
97 => Chain::BinanceSmartChainTestnet, 97 => Chain::BinanceSmartChainTestnet,
@ -354,6 +362,7 @@ impl FromStr for Chain {
"moonbeam-dev" => Chain::MoonbeamDev, "moonbeam-dev" => Chain::MoonbeamDev,
"moonriver" => Chain::Moonriver, "moonriver" => Chain::Moonriver,
"optimism" => Chain::Optimism, "optimism" => Chain::Optimism,
"optimism-goerli" => Chain::OptimismGoerli,
"optimism-kovan" => Chain::OptimismKovan, "optimism-kovan" => Chain::OptimismKovan,
"fantom" => Chain::Fantom, "fantom" => Chain::Fantom,
"fantom-testnet" => Chain::FantomTestnet, "fantom-testnet" => Chain::FantomTestnet,
@ -386,6 +395,7 @@ impl Chain {
matches!( matches!(
self, self,
Chain::Optimism | Chain::Optimism |
Chain::OptimismGoerli |
Chain::OptimismKovan | Chain::OptimismKovan |
Chain::Fantom | Chain::Fantom |
Chain::FantomTestnet | Chain::FantomTestnet |

View File

@ -85,6 +85,7 @@ impl Client {
Chain::Rinkeby | Chain::Rinkeby |
Chain::Goerli | Chain::Goerli |
Chain::Optimism | Chain::Optimism |
Chain::OptimismGoerli |
Chain::OptimismKovan | Chain::OptimismKovan |
Chain::BinanceSmartChain | Chain::BinanceSmartChain |
Chain::BinanceSmartChainTestnet | Chain::BinanceSmartChainTestnet |