moonbase_runtime/
runtime_params.rs

1// Copyright 2025 Moonbeam Foundation.
2// This file is part of Moonbeam.
3
4// Moonbeam is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8
9// Moonbeam is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License
15// along with Moonbeam.  If not, see <http://www.gnu.org/licenses/>.
16
17//! Dynamic runtime parameters for moonbase.
18
19use crate::{currency, Runtime};
20use frame_support::dynamic_params::{dynamic_pallet_params, dynamic_params};
21use moonbeam_runtime_common::expose_u128_get;
22use moonbeam_runtime_common::types::BoundedU128;
23use sp_runtime::Perbill;
24
25#[dynamic_params(RuntimeParameters, pallet_parameters::Parameters::<Runtime>)]
26pub mod dynamic_params {
27	use super::*;
28	#[dynamic_pallet_params]
29	#[codec(index = 0)]
30	pub mod runtime_config {
31		// for fees, 80% are burned, 20% to the treasury
32		#[codec(index = 0)]
33		pub static FeesTreasuryProportion: Perbill = Perbill::from_percent(20);
34	}
35
36	#[dynamic_pallet_params]
37	#[codec(index = 1)]
38	pub mod pallet_randomness {
39		#[codec(index = 0)]
40		pub static Deposit: BoundedU128<
41			{ 1 * currency::UNIT * currency::SUPPLY_FACTOR },
42			{ 1_000 * currency::UNIT * currency::SUPPLY_FACTOR },
43		> = BoundedU128::const_new::<{ 1 * currency::UNIT * currency::SUPPLY_FACTOR }>();
44	}
45
46	#[dynamic_pallet_params]
47	#[codec(index = 2)]
48	pub mod xcm_config {
49		#[codec(index = 0)]
50		pub static ForeignAssetCreationDeposit: u128 = 100 * currency::UNIT;
51	}
52}
53
54expose_u128_get!(
55	PalletRandomnessDepositU128,
56	dynamic_params::pallet_randomness::Deposit
57);
58
59#[cfg(feature = "runtime-benchmarks")]
60impl Default for RuntimeParameters {
61	fn default() -> Self {
62		RuntimeParameters::RuntimeConfig(
63			dynamic_params::runtime_config::Parameters::FeesTreasuryProportion(
64				dynamic_params::runtime_config::FeesTreasuryProportion,
65				Some(Perbill::from_percent(20)),
66			),
67		)
68	}
69}