From 2e0dfb64b7a8132b1135a0085c0f8351f5d4417e Mon Sep 17 00:00:00 2001 From: SunTiebing <1045060705@qq.com> Date: Mon, 6 Jan 2025 14:08:49 +0800 Subject: [PATCH] adjust vBNC can be used as a flexible fee on the Polkadot side --- pallets/flexible-fee/src/benchmarking.rs | 4 +- pallets/flexible-fee/src/lib.rs | 12 +- .../src/{mock.rs => mocks/kusama_mock.rs} | 6 +- .../src/{ => mocks}/mock_price.rs | 0 pallets/flexible-fee/src/mocks/mod.rs | 22 + .../flexible-fee/src/mocks/polkadot_mock.rs | 454 ++++++++++++++++++ .../src/{tests.rs => tests/common_tests.rs} | 4 +- pallets/flexible-fee/src/tests/mod.rs | 20 + .../src/tests/polkadot_specical_tests.rs | 44 ++ runtime/bifrost-kusama/src/lib.rs | 2 + runtime/bifrost-polkadot/src/lib.rs | 2 + 11 files changed, 560 insertions(+), 10 deletions(-) rename pallets/flexible-fee/src/{mock.rs => mocks/kusama_mock.rs} (98%) rename pallets/flexible-fee/src/{ => mocks}/mock_price.rs (100%) create mode 100644 pallets/flexible-fee/src/mocks/mod.rs create mode 100644 pallets/flexible-fee/src/mocks/polkadot_mock.rs rename pallets/flexible-fee/src/{tests.rs => tests/common_tests.rs} (99%) create mode 100644 pallets/flexible-fee/src/tests/mod.rs create mode 100644 pallets/flexible-fee/src/tests/polkadot_specical_tests.rs diff --git a/pallets/flexible-fee/src/benchmarking.rs b/pallets/flexible-fee/src/benchmarking.rs index dd18e3b93..d54641281 100644 --- a/pallets/flexible-fee/src/benchmarking.rs +++ b/pallets/flexible-fee/src/benchmarking.rs @@ -55,7 +55,7 @@ mod benchmarks { } impl_benchmark_test_suite!( Pallet, - crate::mock::new_test_ext_benchmark(), - crate::mock::Test + crate::mocks::kusama_mock::new_test_ext_benchmark(), + crate::mocks::kusama_mock::Test ); } diff --git a/pallets/flexible-fee/src/lib.rs b/pallets/flexible-fee/src/lib.rs index e4bfaa9e3..7ce4222f9 100644 --- a/pallets/flexible-fee/src/lib.rs +++ b/pallets/flexible-fee/src/lib.rs @@ -59,8 +59,7 @@ use zenlink_protocol::{AssetId, ExportZenlink}; mod benchmarking; pub mod impls; pub mod migrations; -mod mock; -mod mock_price; +mod mocks; mod tests; pub mod weights; @@ -126,6 +125,9 @@ pub mod pallet { type PalletId: Get; // asset registry to get asset metadata type AssetIdMaps: CurrencyIdMapping>>; + /// The `AllowVBNCAsFee` constant determines whether VBNC is allowed as a fee currency. + #[pallet::constant] + type AllowVBNCAsFee: Get; } #[pallet::hooks] @@ -247,8 +249,10 @@ pub mod pallet { let who = ensure_signed(origin)?; if let Some(fee_currency) = ¤cy_id { - // VBNC is not supported. - ensure!(fee_currency != &VBNC, Error::::CurrencyNotSupport); + if !T::AllowVBNCAsFee::get() { + // VBNC is not supported. + ensure!(fee_currency != &VBNC, Error::::CurrencyNotSupport); + } UserDefaultFeeCurrency::::insert(&who, fee_currency); } else { diff --git a/pallets/flexible-fee/src/mock.rs b/pallets/flexible-fee/src/mocks/kusama_mock.rs similarity index 98% rename from pallets/flexible-fee/src/mock.rs rename to pallets/flexible-fee/src/mocks/kusama_mock.rs index 49981d83d..eb3e0ae02 100644 --- a/pallets/flexible-fee/src/mock.rs +++ b/pallets/flexible-fee/src/mocks/kusama_mock.rs @@ -18,8 +18,8 @@ #![cfg(test)] -use super::*; -use crate::{self as flexible_fee, mock_price::MockOraclePriceProvider}; +use crate::*; +use crate::{self as flexible_fee, mocks::mock_price::MockOraclePriceProvider}; use bifrost_asset_registry::AssetIdMaps; use bifrost_currencies::BasicCurrencyAdapter; use bifrost_primitives::{ @@ -175,6 +175,7 @@ impl pallet_evm_accounts::Config for Test { parameter_types! { pub const TreasuryAccount: AccountId32 = TREASURY_ACCOUNT; pub const MaxFeeCurrencyOrderListLen: u32 = 50; + pub AllowVBNCAsFee: bool = false; } impl crate::Config for Test { @@ -196,6 +197,7 @@ impl crate::Config for Test { type InspectEvmAccounts = EVMAccounts; type EvmPermit = PermitDispatchHandler; type AssetIdMaps = AssetIdMaps; + type AllowVBNCAsFee = AllowVBNCAsFee; } pub struct XcmDestWeightAndFee; diff --git a/pallets/flexible-fee/src/mock_price.rs b/pallets/flexible-fee/src/mocks/mock_price.rs similarity index 100% rename from pallets/flexible-fee/src/mock_price.rs rename to pallets/flexible-fee/src/mocks/mock_price.rs diff --git a/pallets/flexible-fee/src/mocks/mod.rs b/pallets/flexible-fee/src/mocks/mod.rs new file mode 100644 index 000000000..309b49ce8 --- /dev/null +++ b/pallets/flexible-fee/src/mocks/mod.rs @@ -0,0 +1,22 @@ +// This file is part of Bifrost. + +// Copyright (C) Liebi Technologies PTE. LTD. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pub mod kusama_mock; +pub mod polkadot_mock; + +mod mock_price; diff --git a/pallets/flexible-fee/src/mocks/polkadot_mock.rs b/pallets/flexible-fee/src/mocks/polkadot_mock.rs new file mode 100644 index 000000000..85361dddd --- /dev/null +++ b/pallets/flexible-fee/src/mocks/polkadot_mock.rs @@ -0,0 +1,454 @@ +// This file is part of Bifrost. + +// Copyright (C) Liebi Technologies PTE. LTD. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#![cfg(test)] + +use crate::*; +use crate::{self as flexible_fee, mocks::mock_price::MockOraclePriceProvider}; +use bifrost_asset_registry::AssetIdMaps; +use bifrost_currencies::BasicCurrencyAdapter; +use bifrost_primitives::{ + Balance, CurrencyId, EvmPermit, FlexibleFeePalletId, TokenSymbol, ZenlinkPalletId, +}; +use cumulus_primitives_core::ParaId as Pid; +use frame_support::{ + derive_impl, ord_parameter_types, parameter_types, + sp_runtime::{DispatchError, DispatchResult}, + traits::{ConstU128, Get, Nothing}, + weights::{ConstantMultiplier, IdentityFee}, + PalletId, +}; +use frame_system::EnsureSignedBy; +use frame_system::{self, EnsureRoot}; +use orml_traits::MultiCurrency; +use sp_runtime::{ + traits::{AccountIdConversion, IdentityLookup, UniqueSaturatedInto}, + AccountId32, BuildStorage, SaturatedConversion, +}; +use sp_std::marker::PhantomData; +use std::{cell::RefCell, convert::TryInto}; +use zenlink_protocol::{ + AssetBalance, AssetId as ZenlinkAssetId, LocalAssetHandler, PairLpGenerate, ZenlinkMultiAssets, +}; + +pub type AccountId = AccountId32; +pub type BlockNumber = u32; +pub type Amount = i128; + +pub const TREASURY_ACCOUNT: AccountId32 = AccountId32::new([9u8; 32]); + +type Block = frame_system::mocking::MockBlock; + +// Configure a mock runtime to test the pallet. +frame_support::construct_runtime!( + pub enum Test { + System: frame_system, + Balances: pallet_balances = 10, + Tokens: orml_tokens, + TransactionPayment: pallet_transaction_payment, + FlexibleFee: flexible_fee, + ZenlinkProtocol: zenlink_protocol, + Currencies: bifrost_currencies, + AssetRegistry: bifrost_asset_registry, + EVMAccounts: pallet_evm_accounts, + } +); + +ord_parameter_types! { + pub const CouncilAccount: AccountId = AccountId::from([1u8; 32]); +} +impl bifrost_asset_registry::Config for Test { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type RegisterOrigin = EnsureSignedBy; + type WeightInfo = (); +} + +parameter_types! { + pub const BlockHashCount: u32 = 250; +} + +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] +impl frame_system::Config for Test { + type Block = Block; + type AccountId = AccountId; + type Lookup = IdentityLookup; + type AccountData = pallet_balances::AccountData; +} + +parameter_types! { + pub const TransactionByteFee: Balance = 1; + pub const OperationalFeeMultiplier: u8 = 5; +} + +impl pallet_transaction_payment::Config for Test { + type FeeMultiplierUpdate = (); + type LengthToFee = ConstantMultiplier; + type OnChargeTransaction = FlexibleFee; + type OperationalFeeMultiplier = OperationalFeeMultiplier; + type WeightToFee = IdentityFee; + type RuntimeEvent = RuntimeEvent; +} + +parameter_types! { + pub const ExistentialDeposit: u64 = 1; +} + +impl pallet_balances::Config for Test { + type AccountStore = System; + type Balance = u128; + type DustRemoval = (); + type RuntimeEvent = RuntimeEvent; + type ExistentialDeposit = ExistentialDeposit; + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type WeightInfo = (); + type RuntimeHoldReason = RuntimeHoldReason; + type RuntimeFreezeReason = RuntimeFreezeReason; + type FreezeIdentifier = (); + type MaxFreezes = ConstU32<0>; +} + +orml_traits::parameter_type_with_key! { + pub ExistentialDeposits: |_currency_id: CurrencyId| -> Balance { + 1 + }; +} + +parameter_types! { + pub DustAccount: AccountId = PalletId(*b"orml/dst").into_account_truncating(); + pub MaxLocks: u32 = 2; +} + +impl orml_tokens::Config for Test { + type Amount = i128; + type Balance = Balance; + type CurrencyId = CurrencyId; + type DustRemovalWhitelist = Nothing; + type RuntimeEvent = RuntimeEvent; + type ExistentialDeposits = ExistentialDeposits; + type MaxLocks = MaxLocks; + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type WeightInfo = (); + type CurrencyHooks = (); +} + +pub struct EvmNonceProvider; +impl pallet_evm_accounts::EvmNonceProvider for EvmNonceProvider { + fn get_nonce(_: sp_core::H160) -> sp_core::U256 { + sp_core::U256::zero() + } +} + +impl pallet_evm_accounts::Config for Test { + type RuntimeEvent = RuntimeEvent; + type EvmNonceProvider = EvmNonceProvider; + type FeeMultiplier = ConstU32<10>; + type ControllerOrigin = EnsureRoot; + type WeightInfo = (); +} + +parameter_types! { + pub const TreasuryAccount: AccountId32 = TREASURY_ACCOUNT; + pub const MaxFeeCurrencyOrderListLen: u32 = 50; + pub AllowVBNCAsFee: bool = true; +} + +impl crate::Config for Test { + type DexOperator = ZenlinkProtocol; + type RuntimeEvent = RuntimeEvent; + type MultiCurrency = Currencies; + type TreasuryAccount = TreasuryAccount; + type MaxFeeCurrencyOrderListLen = MaxFeeCurrencyOrderListLen; + type WeightInfo = (); + type ParachainId = ParaInfo; + type ControlOrigin = EnsureRoot; + type XcmWeightAndFeeHandler = XcmDestWeightAndFee; + type MinAssetHubExecutionFee = ConstU128<3>; + type MinRelaychainExecutionFee = ConstU128<3>; + type RelaychainCurrencyId = RelayCurrencyId; + type XcmRouter = (); + type PalletId = FlexibleFeePalletId; + type OraclePriceProvider = MockOraclePriceProvider; + type InspectEvmAccounts = EVMAccounts; + type EvmPermit = PermitDispatchHandler; + type AssetIdMaps = AssetIdMaps; + type AllowVBNCAsFee = AllowVBNCAsFee; +} + +pub struct XcmDestWeightAndFee; +impl XcmDestWeightAndFeeHandler for XcmDestWeightAndFee { + fn get_operation_weight_and_fee( + _token: CurrencyId, + _operation: XcmOperationType, + ) -> Option<(Weight, Balance)> { + Some((Weight::from_parts(100, 100), 100u32.into())) + } + + fn set_xcm_dest_weight_and_fee( + _currency_id: CurrencyId, + _operation: XcmOperationType, + _weight_and_fee: Option<(Weight, Balance)>, + ) -> DispatchResult { + Ok(()) + } +} + +pub struct ParaInfo; +impl Get for ParaInfo { + fn get() -> Pid { + Pid::from(2001) + } +} + +parameter_types! { + pub const GetNativeCurrencyId: CurrencyId = BNC; +} + +impl bifrost_currencies::Config for Test { + type GetNativeCurrencyId = GetNativeCurrencyId; + type MultiCurrency = Tokens; + type NativeCurrency = BasicCurrencyAdapter; + type WeightInfo = (); +} + +parameter_types! { + pub const GetExchangeFee: (u32, u32) = (3, 1000); // 0.3% + pub const SelfParaId: u32 = 2001; +} + +impl zenlink_protocol::Config for Test { + type RuntimeEvent = RuntimeEvent; + type MultiAssetsHandler = MultiAssets; + type PalletId = ZenlinkPalletId; + type SelfParaId = SelfParaId; + type TargetChains = (); + type WeightInfo = (); + type AssetId = ZenlinkAssetId; + type LpGenerate = PairLpGenerate; +} + +type MultiAssets = ZenlinkMultiAssets>; + +// Below is the implementation of tokens manipulation functions other than native token. +pub struct LocalAssetAdaptor(PhantomData); + +impl LocalAssetHandler for LocalAssetAdaptor +where + Local: MultiCurrency, +{ + fn local_balance_of(asset_id: ZenlinkAssetId, who: &AccountId) -> AssetBalance { + let currency_id: CurrencyId = asset_id.try_into().unwrap(); + Local::free_balance(currency_id, &who).saturated_into() + } + + fn local_total_supply(asset_id: ZenlinkAssetId) -> AssetBalance { + let currency_id: CurrencyId = asset_id.try_into().unwrap(); + Local::total_issuance(currency_id).saturated_into() + } + + fn local_is_exists(asset_id: ZenlinkAssetId) -> bool { + let rs: Result = asset_id.try_into(); + match rs { + Ok(_) => true, + Err(_) => false, + } + } + + fn local_transfer( + asset_id: ZenlinkAssetId, + origin: &AccountId, + target: &AccountId, + amount: AssetBalance, + ) -> DispatchResult { + let currency_id: CurrencyId = asset_id.try_into().unwrap(); + Local::transfer( + currency_id, + &origin, + &target, + amount.unique_saturated_into(), + )?; + + Ok(()) + } + + fn local_deposit( + asset_id: ZenlinkAssetId, + origin: &AccountId, + amount: AssetBalance, + ) -> Result { + let currency_id: CurrencyId = asset_id.try_into().unwrap(); + Local::deposit(currency_id, &origin, amount.unique_saturated_into())?; + return Ok(amount); + } + + fn local_withdraw( + asset_id: ZenlinkAssetId, + origin: &AccountId, + amount: AssetBalance, + ) -> Result { + let currency_id: CurrencyId = asset_id.try_into().unwrap(); + Local::withdraw(currency_id, &origin, amount.unique_saturated_into())?; + + Ok(amount) + } +} + +// Build genesis storage according to the mock runtime. +pub(crate) fn new_test_ext() -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::::default() + .build_storage() + .unwrap(); + // We use default for brevity, but you can configure as desired if needed. + pallet_balances::GenesisConfig::::default() + .assimilate_storage(&mut t) + .unwrap(); + t.into() +} + +pub const ALICE: AccountId = AccountId::new([0u8; 32]); + +parameter_types! { + pub const RelayCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::KSM); +} + +impl BalanceCmp for Test { + type Error = Error; + + fn cmp_with_precision( + account: &AccountId, + currency: &CurrencyId, + amount: u128, + amount_precision: u32, + ) -> Result { + Pallet::::cmp_with_precision(account, currency, amount, amount_precision) + } +} + +#[derive(Clone, Debug, PartialEq)] +pub struct PermitDispatchData { + pub source: H160, + pub target: H160, + pub input: Vec, + pub value: U256, + pub gas_limit: u64, + pub max_fee_per_gas: U256, + pub max_priority_fee_per_gas: Option, + pub nonce: Option, + pub access_list: Vec<(H160, Vec)>, +} + +#[derive(Clone, Debug, PartialEq)] +pub struct ValidationData { + pub source: H160, + pub target: H160, + pub input: Vec, + pub value: U256, + pub gas_limit: u64, + pub deadline: U256, + pub v: u8, + pub r: H256, + pub s: H256, +} + +thread_local! { + static PERMIT_VALIDATION: RefCell> = const { RefCell::new(vec![]) }; + static PERMIT_DISPATCH: RefCell> = const { RefCell::new(vec![]) }; +} + +pub struct PermitDispatchHandler; + +impl PermitDispatchHandler { + pub fn last_validation_call_data() -> ValidationData { + PERMIT_VALIDATION.with(|v| v.borrow().last().unwrap().clone()) + } + + pub fn last_dispatch_call_data() -> PermitDispatchData { + PERMIT_DISPATCH.with(|v| v.borrow().last().unwrap().clone()) + } +} + +impl EvmPermit for PermitDispatchHandler { + fn validate_permit( + source: H160, + target: H160, + input: Vec, + value: U256, + gas_limit: u64, + deadline: U256, + v: u8, + r: H256, + s: H256, + ) -> DispatchResult { + let data = ValidationData { + source, + target, + input, + value, + gas_limit, + deadline, + v, + r, + s, + }; + PERMIT_VALIDATION.with(|v| v.borrow_mut().push(data)); + Ok(()) + } + + fn dispatch_permit( + source: H160, + target: H160, + input: Vec, + value: U256, + gas_limit: u64, + max_fee_per_gas: U256, + max_priority_fee_per_gas: Option, + nonce: Option, + access_list: Vec<(H160, Vec)>, + ) -> DispatchResultWithPostInfo { + let data = PermitDispatchData { + source, + target, + input, + value, + gas_limit, + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list, + }; + PERMIT_DISPATCH.with(|v| v.borrow_mut().push(data)); + Ok(PostDispatchInfo::default()) + } + + fn gas_price() -> (U256, Weight) { + (U256::from(222u128), Weight::zero()) + } + + fn dispatch_weight(_gas_limit: u64) -> Weight { + todo!() + } + + fn permit_nonce(_account: H160) -> U256 { + U256::default() + } + + fn on_dispatch_permit_error() {} +} diff --git a/pallets/flexible-fee/src/tests.rs b/pallets/flexible-fee/src/tests/common_tests.rs similarity index 99% rename from pallets/flexible-fee/src/tests.rs rename to pallets/flexible-fee/src/tests/common_tests.rs index e8756eabd..36deca851 100644 --- a/pallets/flexible-fee/src/tests.rs +++ b/pallets/flexible-fee/src/tests/common_tests.rs @@ -20,8 +20,8 @@ #![cfg(test)] use crate::{ - impls::on_charge_transaction::PaymentInfo, mock::*, BlockNumberFor, BoundedVec, Config, - DispatchError::BadOrigin, Error, UserDefaultFeeCurrency, + impls::on_charge_transaction::PaymentInfo, mocks::kusama_mock::*, BlockNumberFor, BoundedVec, + Config, DispatchError::BadOrigin, Error, UserDefaultFeeCurrency, }; use bifrost_asset_registry::AssetMetadata; use bifrost_asset_registry::CurrencyMetadatas; diff --git a/pallets/flexible-fee/src/tests/mod.rs b/pallets/flexible-fee/src/tests/mod.rs new file mode 100644 index 000000000..752e20915 --- /dev/null +++ b/pallets/flexible-fee/src/tests/mod.rs @@ -0,0 +1,20 @@ +// This file is part of Bifrost. + +// Copyright (C) Liebi Technologies PTE. LTD. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +mod common_tests; +mod polkadot_specical_tests; diff --git a/pallets/flexible-fee/src/tests/polkadot_specical_tests.rs b/pallets/flexible-fee/src/tests/polkadot_specical_tests.rs new file mode 100644 index 000000000..eb3e2bfb2 --- /dev/null +++ b/pallets/flexible-fee/src/tests/polkadot_specical_tests.rs @@ -0,0 +1,44 @@ +// This file is part of Bifrost. + +// Copyright (C) Liebi Technologies PTE. LTD. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Tests for the module. + +#![cfg(test)] +use crate::{mocks::polkadot_mock::*, UserDefaultFeeCurrency}; +use bifrost_primitives::VBNC; +use frame_support::assert_ok; + +#[test] +fn set_user_default_fee_currency_should_fail_with_error_currency() { + new_test_ext().execute_with(|| { + let origin_signed_alice = RuntimeOrigin::signed(ALICE); + assert_ok!(FlexibleFee::set_user_default_fee_currency( + origin_signed_alice.clone(), + Some(VBNC) + )); + + let alice_default_currency = UserDefaultFeeCurrency::::get(ALICE).unwrap(); + assert_eq!(alice_default_currency, VBNC); + + assert_ok!(FlexibleFee::set_user_default_fee_currency( + origin_signed_alice.clone(), + None + )); + assert_eq!(UserDefaultFeeCurrency::::get(ALICE).is_none(), true); + }); +} diff --git a/runtime/bifrost-kusama/src/lib.rs b/runtime/bifrost-kusama/src/lib.rs index 82b176821..a6612fb5a 100644 --- a/runtime/bifrost-kusama/src/lib.rs +++ b/runtime/bifrost-kusama/src/lib.rs @@ -1113,6 +1113,7 @@ impl bifrost_vesting::Config for Runtime { parameter_types! { pub MaxFeeCurrencyOrderListLen: u32 = 50; + pub AllowVBNCAsFee: bool = false; } impl bifrost_flexible_fee::Config for Runtime { @@ -1134,6 +1135,7 @@ impl bifrost_flexible_fee::Config for Runtime { type InspectEvmAccounts = (); type EvmPermit = bifrost_flexible_fee::impls::evm_permit::DisabledEvmPermitHandler; type AssetIdMaps = AssetIdMaps; + type AllowVBNCAsFee = AllowVBNCAsFee; } parameter_types! { diff --git a/runtime/bifrost-polkadot/src/lib.rs b/runtime/bifrost-polkadot/src/lib.rs index 4f624df24..4d595d355 100644 --- a/runtime/bifrost-polkadot/src/lib.rs +++ b/runtime/bifrost-polkadot/src/lib.rs @@ -968,6 +968,7 @@ impl bifrost_vesting::Config for Runtime { parameter_types! { pub MaxFeeCurrencyOrderListLen: u32 = 50; + pub AllowVBNCAsFee: bool = true; } impl bifrost_flexible_fee::Config for Runtime { @@ -989,6 +990,7 @@ impl bifrost_flexible_fee::Config for Runtime { type InspectEvmAccounts = EVMAccounts; type EvmPermit = evm::permit::EvmPermitHandler; type AssetIdMaps = AssetIdMaps; + type AllowVBNCAsFee = AllowVBNCAsFee; } parameter_types! {