Skip to content

Commit

Permalink
add nft Arbitrum variant
Browse files Browse the repository at this point in the history
  • Loading branch information
laruh committed Nov 20, 2024
1 parent 22719c0 commit 45899ab
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mm2src/coins/nft/nft_structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ pub enum Chain {
Eth,
Fantom,
Polygon,
Arbitrum,
}

pub trait ConvertChain {
Expand All @@ -133,6 +134,7 @@ impl ConvertChain for Chain {
Chain::Eth => "ETH",
Chain::Fantom => "FTM",
Chain::Polygon => "MATIC",
Chain::Arbitrum => "ETH-ARB20",
}
}

Expand All @@ -145,6 +147,7 @@ impl ConvertChain for Chain {
"ETH" | "eth" => Ok(Chain::Eth),
"FTM" | "ftm" => Ok(Chain::Fantom),
"MATIC" | "matic" => Ok(Chain::Polygon),
"ETH-ARB20" | "eth-arb20" => Ok(Chain::Arbitrum),
_ => Err(ParseChainTypeError::UnsupportedChainType),
}
}
Expand All @@ -157,6 +160,7 @@ impl ConvertChain for Chain {
Chain::Eth => "NFT_ETH",
Chain::Fantom => "NFT_FTM",
Chain::Polygon => "NFT_MATIC",
Chain::Arbitrum => "NFT_ETH-ARB20",
}
}

Expand All @@ -169,6 +173,7 @@ impl ConvertChain for Chain {
"NFT_ETH" => Ok(Chain::Eth),
"NFT_FTM" => Ok(Chain::Fantom),
"NFT_MATIC" => Ok(Chain::Polygon),
"NFT_ETH-ARB20" => Ok(Chain::Arbitrum),
_ => Err(ParseChainTypeError::UnsupportedChainType),
}
}
Expand All @@ -182,6 +187,7 @@ impl fmt::Display for Chain {
Chain::Eth => write!(f, "ETH"),
Chain::Fantom => write!(f, "FANTOM"),
Chain::Polygon => write!(f, "POLYGON"),
Chain::Arbitrum => write!(f, "ARBITRUM"),
}
}
}
Expand All @@ -199,6 +205,7 @@ impl FromStr for Chain {
"ETH" | "eth" => Ok(Chain::Eth),
"FANTOM" | "fantom" => Ok(Chain::Fantom),
"POLYGON" | "polygon" => Ok(Chain::Polygon),
"ARBITRUM" | "arbitrum" => Ok(Chain::Arbitrum),
_ => Err(ParseChainTypeError::UnsupportedChainType),
}
}
Expand Down

0 comments on commit 45899ab

Please sign in to comment.