timechain_runtime/configs/
services.rsuse crate::System;
use polkadot_sdk::*;
use frame_support::{
parameter_types,
traits::{fungible::HoldConsideration, ConstU32, EqualPrivilegeOnly, LinearStoragePrice},
weights::Weight,
};
use sp_runtime::{traits::Verify, Perbill};
use pallet_identity::legacy::IdentityInfo;
use time_primitives::{Signature, ANLOG};
use crate::{
deposit, AccountId, Balance, Balances, DefaultAdminOrigin, OriginCaller, Preimage, Runtime,
RuntimeBlockWeights, RuntimeCall, RuntimeEvent, RuntimeHoldReason, RuntimeOrigin, DAYS,
};
parameter_types! {
pub const BasicDeposit: Balance = deposit(1, 17);
pub const ByteDeposit: Balance = deposit(0, 1);
pub const SubAccountDeposit: Balance = 2 * ANLOG; pub const UsernameDeposit: Balance = deposit(0, 32);
pub const MaxSubAccounts: u32 = 100;
pub const MaxAdditionalFields: u32 = 100;
pub const MaxRegistrars: u32 = 20;
}
#[cfg(feature = "testnet")]
impl pallet_identity::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type BasicDeposit = BasicDeposit;
type ByteDeposit = ByteDeposit;
type UsernameDeposit = UsernameDeposit;
type SubAccountDeposit = SubAccountDeposit;
type MaxSubAccounts = MaxSubAccounts;
type IdentityInformation = IdentityInfo<MaxAdditionalFields>;
type MaxRegistrars = MaxRegistrars;
type Slashed = (); type ForceOrigin = DefaultAdminOrigin;
type RegistrarOrigin = DefaultAdminOrigin;
type OffchainSignature = Signature;
type SigningPublicKey = <Signature as Verify>::Signer;
type UsernameAuthorityOrigin = DefaultAdminOrigin;
type PendingUsernameExpiration = ConstU32<{ 7 * DAYS }>;
type UsernameGracePeriod = ConstU32<{ 30 * DAYS }>;
type MaxSuffixLength = ConstU32<7>;
type MaxUsernameLength = ConstU32<32>;
type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;
}
#[cfg(feature = "testnet")]
parameter_types! {
pub const PreimageHoldReason: RuntimeHoldReason = RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
pub const StorageBaseDeposit: Balance = 1 * ANLOG;
pub const StorageByteDeposit: Balance = deposit(0,1);
}
#[cfg(feature = "testnet")]
impl pallet_preimage::Config for Runtime {
type WeightInfo = pallet_preimage::weights::SubstrateWeight<Runtime>;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = DefaultAdminOrigin;
type Consideration = HoldConsideration<
AccountId,
Balances,
PreimageHoldReason,
LinearStoragePrice<StorageBaseDeposit, StorageByteDeposit, Balance>,
>;
}
parameter_types! {
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) *
RuntimeBlockWeights::get().max_block;
}
#[cfg(feature = "testnet")]
impl pallet_scheduler::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type PalletsOrigin = OriginCaller;
type RuntimeCall = RuntimeCall;
type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = DefaultAdminOrigin;
#[cfg(feature = "runtime-benchmarks")]
type MaxScheduledPerBlock = ConstU32<512>;
#[cfg(not(feature = "runtime-benchmarks"))]
type MaxScheduledPerBlock = ConstU32<50>;
type WeightInfo = pallet_scheduler::weights::SubstrateWeight<Runtime>;
type OriginPrivilegeCmp = EqualPrivilegeOnly;
type Preimages = Preimage;
type BlockNumberProvider = System;
}