Skip to content

Commit

Permalink
make ForeignAssetCreationDeposit dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzamontiel committed Jan 3, 2025
1 parent f7b300e commit 4283fd4
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 16 deletions.
7 changes: 7 additions & 0 deletions runtime/moonbase/src/runtime_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ pub mod dynamic_params {
{ 1_000 * currency::UNIT * currency::SUPPLY_FACTOR },
> = BoundedU128::const_new::<{ 1 * currency::UNIT * currency::SUPPLY_FACTOR }>();
}

#[dynamic_pallet_params]
#[codec(index = 2)]
pub mod xcm_config {
#[codec(index = 0)]
pub static ForeignAssetCreationDeposit: u64 = 100;
}
}

expose_u128_get!(
Expand Down
5 changes: 3 additions & 2 deletions runtime/moonbase/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! XCM configuration for Moonbase.
//!
use super::moonbase_weights;
use super::{moonbase_weights, runtime_params};
use super::{
governance, AccountId, AssetId, AssetManager, Balance, Balances, EmergencyParaXcm,
Erc20XcmBridge, EvmForeignAssets, MaintenanceMode, MessageQueue, ParachainInfo,
Expand Down Expand Up @@ -699,7 +699,8 @@ impl frame_support::traits::Contains<AssetId> for EvmForeignAssetIdFilter {
parameter_types! {
/// Balance in the native currency that will be reserved from the user
/// to create a new foreign asset
pub ForeignAssetCreationDeposit: u64 = 100;
pub ForeignAssetCreationDeposit: u64 =
runtime_params::dynamic_params::xcm_config::ForeignAssetCreationDeposit::get();
}

pub type ForeignAssetManagerOrigin = frame_system::EnsureSigned<AccountId>;
Expand Down
7 changes: 7 additions & 0 deletions runtime/moonbeam/src/runtime_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ pub mod dynamic_params {
{ 1_000 * currency::GLMR * currency::SUPPLY_FACTOR },
> = BoundedU128::const_new::<{ 1 * currency::GLMR * currency::SUPPLY_FACTOR }>();
}

#[dynamic_pallet_params]
#[codec(index = 2)]
pub mod xcm_config {
#[codec(index = 0)]
pub static ForeignAssetCreationDeposit: u64 = 10_000;
}
}

expose_u128_get!(
Expand Down
10 changes: 3 additions & 7 deletions runtime/moonbeam/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@
//! XCM configuration for Moonbase.
//!
use super::{
governance, AccountId, AssetId, AssetManager, Balance, Balances, EmergencyParaXcm,
Erc20XcmBridge, EvmForeignAssets, MaintenanceMode, MessageQueue, OpenTechCommitteeInstance,
ParachainInfo, ParachainSystem, Perbill, PolkadotXcm, Runtime, RuntimeBlockWeights,
RuntimeCall, RuntimeEvent, RuntimeOrigin, Treasury, XcmpQueue,
};
use super::{governance, runtime_params, AccountId, AssetId, AssetManager, Balance, Balances, EmergencyParaXcm, Erc20XcmBridge, EvmForeignAssets, MaintenanceMode, MessageQueue, OpenTechCommitteeInstance, ParachainInfo, ParachainSystem, Perbill, PolkadotXcm, Runtime, RuntimeBlockWeights, RuntimeCall, RuntimeEvent, RuntimeOrigin, Treasury, XcmpQueue};

use super::moonbeam_weights;
use frame_support::{
Expand Down Expand Up @@ -692,7 +687,8 @@ pub type ForeignAssetManagerOrigin = EitherOfDiverse<
parameter_types! {
/// Balance in the native currency that will be reserved from the user
/// to create a new foreign asset
pub ForeignAssetCreationDeposit: u64 = 100;
pub ForeignAssetCreationDeposit: u64 =
runtime_params::dynamic_params::xcm_config::ForeignAssetCreationDeposit::get();
}

impl pallet_moonbeam_foreign_assets::Config for Runtime {
Expand Down
7 changes: 7 additions & 0 deletions runtime/moonriver/src/runtime_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ pub mod dynamic_params {
{ 1_000 * currency::MOVR * currency::SUPPLY_FACTOR },
> = BoundedU128::const_new::<{ 1 * currency::MOVR * currency::SUPPLY_FACTOR }>();
}

#[dynamic_pallet_params]
#[codec(index = 2)]
pub mod xcm_config {
#[codec(index = 0)]
pub static ForeignAssetCreationDeposit: u64 = 1_000;
}
}

expose_u128_get!(
Expand Down
10 changes: 3 additions & 7 deletions runtime/moonriver/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@
//! XCM configuration for Moonbase.
//!
use super::{
governance, AccountId, AssetId, AssetManager, Balance, Balances, EmergencyParaXcm,
Erc20XcmBridge, EvmForeignAssets, MaintenanceMode, MessageQueue, OpenTechCommitteeInstance,
ParachainInfo, ParachainSystem, Perbill, PolkadotXcm, Runtime, RuntimeBlockWeights,
RuntimeCall, RuntimeEvent, RuntimeOrigin, Treasury, XcmpQueue,
};
use super::{governance, runtime_params, AccountId, AssetId, AssetManager, Balance, Balances, EmergencyParaXcm, Erc20XcmBridge, EvmForeignAssets, MaintenanceMode, MessageQueue, OpenTechCommitteeInstance, ParachainInfo, ParachainSystem, Perbill, PolkadotXcm, Runtime, RuntimeBlockWeights, RuntimeCall, RuntimeEvent, RuntimeOrigin, Treasury, XcmpQueue};

use super::moonriver_weights;
use frame_support::{
Expand Down Expand Up @@ -697,7 +692,8 @@ impl frame_support::traits::Contains<AssetId> for EvmForeignAssetIdFilter {
parameter_types! {
/// Balance in the native currency that will be reserved from the user
/// to create a new foreign asset
pub ForeignAssetCreationDeposit: u64 = 100;
pub ForeignAssetCreationDeposit: u64 =
runtime_params::dynamic_params::xcm_config::ForeignAssetCreationDeposit::get();
}

pub type ForeignAssetManagerOrigin = frame_system::EnsureSigned<AccountId>;
Expand Down

0 comments on commit 4283fd4

Please sign in to comment.