From 7121067bf9a20fd26159fcd136257046db5c229a Mon Sep 17 00:00:00 2001 From: Alastair Holmes Date: Thu, 15 Feb 2024 12:50:50 +0100 Subject: [PATCH] Use ForeignChainAndAsset --- state-chain/runtime/src/lib.rs | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/state-chain/runtime/src/lib.rs b/state-chain/runtime/src/lib.rs index bbfd98eb34..937153dd7b 100644 --- a/state-chain/runtime/src/lib.rs +++ b/state-chain/runtime/src/lib.rs @@ -1222,23 +1222,13 @@ impl_runtime_apis! { } } - fn cf_egress_dust_limit(asset: Asset) -> AssetAmount { + fn cf_egress_dust_limit(generic_asset: Asset) -> AssetAmount { use pallet_cf_ingress_egress::EgressDustLimit; - use cf_chains::assets::{eth, dot, btc}; - match ForeignChain::from(asset) { - ForeignChain::Ethereum => EgressDustLimit::::get( - eth::Asset::try_from(asset) - .expect("Conversion must succeed: ForeignChain checked in match clause.") - ), - ForeignChain::Polkadot => EgressDustLimit::::get( - dot::Asset::try_from(asset) - .expect("Conversion must succeed: ForeignChain checked in match clause.") - ), - ForeignChain::Bitcoin => EgressDustLimit::::get( - btc::Asset::try_from(asset) - .expect("Conversion must succeed: ForeignChain checked in match clause.") - ), + match generic_asset.into() { + ForeignChainAndAsset::Ethereum(asset) => EgressDustLimit::::get(asset), + ForeignChainAndAsset::Polkadot(asset) => EgressDustLimit::::get(asset), + ForeignChainAndAsset::Bitcoin(asset) => EgressDustLimit::::get(asset), } }