From 55305d2e6ad48b84bbec74f8dcd77665d5237857 Mon Sep 17 00:00:00 2001 From: Clara van Staden Date: Thu, 2 Nov 2023 20:00:15 +0200 Subject: [PATCH] Adds transfer token user fee (#7) * adds transfer token user fee * updates fee calc * starts with adding snowbridge conf * updates fee * correct ROC amount * correct ROC amount --------- Co-authored-by: claravanstaden --- cumulus/parachains/common/src/lib.rs | 1 + cumulus/parachains/common/src/snowbridge_config.rs | 6 ++++++ .../runtimes/assets/asset-hub-rococo/src/xcm_config.rs | 5 +++-- .../bridge-hubs/bridge-hub-rococo/src/xcm_config.rs | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 cumulus/parachains/common/src/snowbridge_config.rs diff --git a/cumulus/parachains/common/src/lib.rs b/cumulus/parachains/common/src/lib.rs index 4ebc2cc6e1e2..caea757e0d60 100644 --- a/cumulus/parachains/common/src/lib.rs +++ b/cumulus/parachains/common/src/lib.rs @@ -19,6 +19,7 @@ pub mod impls; pub mod kusama; pub mod polkadot; pub mod rococo; +pub mod snowbridge_config; pub mod westend; pub mod wococo; pub mod xcm_config; diff --git a/cumulus/parachains/common/src/snowbridge_config.rs b/cumulus/parachains/common/src/snowbridge_config.rs new file mode 100644 index 000000000000..8edc52c1b014 --- /dev/null +++ b/cumulus/parachains/common/src/snowbridge_config.rs @@ -0,0 +1,6 @@ +frame_support::parameter_types! { + /// User fee for ERC20 token transfer back to Ethereum. + /// (initially was calculated by test `OutboundQueue::calculate_fees` - ETH/ROC 1/400 and fee_per_gas 15 GWEI = 22698000000 + *25%) + /// Needs to be more than fee calculated from DefaultFeeConfig FeeConfigRecord in snowbridge:parachain/pallets/outbound-queue/src/lib.rs + pub const BridgeHubEthereumBaseFeeInRocs: u128 = 28372500000; +} diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs index c6ea9f3fdd5d..c96d9e2df8e3 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs @@ -32,6 +32,7 @@ use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; use parachains_common::{ impls::ToStakingPot, + snowbridge_config::BridgeHubEthereumBaseFeeInRocs, xcm_config::{ AssetFeeAsExistentialDepositMultiplier, ConcreteAssetFromSystem, RelayOrOtherSystemParachains, @@ -910,8 +911,8 @@ pub mod bridging { SiblingBridgeHub::get(), Some(( XcmBridgeHubRouterFeeAssetId::get(), - bp_asset_hub_rococo::BridgeHubRococoBaseFeeInRocs::get(), - ).into()) // TODO calculate fee factor + BridgeHubEthereumBaseFeeInRocs::get(), + ).into()) ), ]; diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs index 5571432fc030..4ff63f9b0cfe 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs @@ -237,9 +237,9 @@ impl Contains for SafeCallFilter { snowbridge_ethereum_beacon_client::Call::force_checkpoint { .. } | snowbridge_ethereum_beacon_client::Call::set_operating_mode { .. }, ) | RuntimeCall::EthereumInboundQueue( - snowbridge_inbound_queue::Call::set_operating_mode { .. }, + snowbridge_inbound_queue::Call::set_operating_mode { .. }, ) | RuntimeCall::EthereumOutboundQueue( - snowbridge_outbound_queue::Call::set_operating_mode { .. }, + snowbridge_outbound_queue::Call::set_operating_mode { .. }, ) | RuntimeCall::EthereumControl(..) ) }