testnet_parachains_constants/
rococo.rs1pub mod currency {
17 use polkadot_core_primitives::Balance;
18 use rococo_runtime_constants as constants;
19
20 pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10;
22
23 pub const UNITS: Balance = constants::currency::UNITS;
24 pub const CENTS: Balance = constants::currency::CENTS;
25 pub const MILLICENTS: Balance = constants::currency::MILLICENTS;
26
27 pub const fn deposit(items: u32, bytes: u32) -> Balance {
28 constants::currency::deposit(items, bytes) / 100
30 }
31}
32
33pub mod fee {
34 use frame_support::{
35 pallet_prelude::Weight,
36 weights::{
37 constants::ExtrinsicBaseWeight, FeePolynomial, WeightToFeeCoefficient,
38 WeightToFeeCoefficients, WeightToFeePolynomial,
39 },
40 };
41 use polkadot_core_primitives::Balance;
42 use smallvec::smallvec;
43 pub use sp_runtime::Perbill;
44
45 pub const TARGET_BLOCK_FULLNESS: Perbill = Perbill::from_percent(25);
47
48 pub struct WeightToFee;
59 impl frame_support::weights::WeightToFee for WeightToFee {
60 type Balance = Balance;
61
62 fn weight_to_fee(weight: &Weight) -> Self::Balance {
63 let time_poly: FeePolynomial<Balance> = RefTimeToFee::polynomial().into();
64 let proof_poly: FeePolynomial<Balance> = ProofSizeToFee::polynomial().into();
65
66 time_poly.eval(weight.ref_time()).max(proof_poly.eval(weight.proof_size()))
68 }
69 }
70
71 pub struct RefTimeToFee;
73 impl WeightToFeePolynomial for RefTimeToFee {
74 type Balance = Balance;
75 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
76 let p = super::currency::CENTS;
79 let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time());
80
81 smallvec![WeightToFeeCoefficient {
82 degree: 1,
83 negative: false,
84 coeff_frac: Perbill::from_rational(p % q, q),
85 coeff_integer: p / q,
86 }]
87 }
88 }
89
90 pub struct ProofSizeToFee;
92 impl WeightToFeePolynomial for ProofSizeToFee {
93 type Balance = Balance;
94 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
95 let p = super::currency::CENTS;
97 let q = 10_000;
98
99 smallvec![WeightToFeeCoefficient {
100 degree: 1,
101 negative: false,
102 coeff_frac: Perbill::from_rational(p % q, q),
103 coeff_integer: p / q,
104 }]
105 }
106 }
107}
108
109pub mod consensus {
111 use frame_support::weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight};
112
113 pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3;
116 pub const BLOCK_PROCESSING_VELOCITY: u32 = 1;
119 pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
121
122 pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
124 WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2),
125 cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
126 );
127
128 pub const MILLISECS_PER_BLOCK: u64 = 6000;
135 pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
136}
137
138pub mod time {
140 use polkadot_core_primitives::BlockNumber;
141
142 pub const MINUTES: BlockNumber =
144 60_000 / (super::consensus::MILLISECS_PER_BLOCK as BlockNumber);
145 pub const HOURS: BlockNumber = MINUTES * 60;
146 pub const DAYS: BlockNumber = HOURS * 24;
147}
148
149pub mod snowbridge {
150 use frame_support::parameter_types;
151 use xcm::prelude::{Location, NetworkId};
152
153 pub const INBOUND_QUEUE_PALLET_INDEX: u8 = 80;
155
156 parameter_types! {
157 pub EthereumNetwork: NetworkId = NetworkId::Ethereum { chain_id: 11155111 };
162 pub EthereumLocation: Location = Location::new(2, EthereumNetwork::get());
163 }
164}
165
166pub mod xcm_version {
167 pub const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
169}
170
171pub mod locations {
172 use frame_support::parameter_types;
173 pub use rococo_runtime_constants::system_parachain::{AssetHubParaId, PeopleParaId};
174 use xcm::latest::prelude::{Location, Parachain};
175
176 parameter_types! {
177 pub AssetHubLocation: Location = Location::new(1, Parachain(rococo_runtime_constants::system_parachain::ASSET_HUB_ID));
178 pub PeopleLocation: Location = Location::new(1, Parachain(rococo_runtime_constants::system_parachain::PEOPLE_ID));
179 }
180}