From b0bb5207748bcd130f76d1458baa29cc9f3734a2 Mon Sep 17 00:00:00 2001 From: Alastair Holmes <42404303+AlastairHolmes@users.noreply.github.com> Date: Fri, 16 Feb 2024 11:53:03 +0100 Subject: [PATCH] refactor: use ForeignChainAndAsset (#4536) --- 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 06cd45a410..1ba929509a 100644 --- a/state-chain/runtime/src/lib.rs +++ b/state-chain/runtime/src/lib.rs @@ -1225,23 +1225,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), } }