-
Notifications
You must be signed in to change notification settings - Fork 122
/
lib.rs
1723 lines (1561 loc) · 73 KB
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2020-2024 Manta Network.
// This file is part of Manta.
//
// Manta 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.
//
// Manta 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 Manta. If not, see <http://www.gnu.org/licenses/>.
//! Calamari Parachain runtime.
#![allow(clippy::identity_op)] // keep e.g. 1 * DAYS for legibility
#![cfg_attr(not(feature = "std"), no_std)]
#![recursion_limit = "256"]
// Make the WASM binary available.
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
use manta_collator_selection::IdentityCollator;
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, IdentityLookup},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, Perbill, Percent, Permill,
};
use sp_std::{cmp::Ordering, prelude::*};
#[cfg(feature = "std")]
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;
use cumulus_primitives_core::relay_chain::MAX_POV_SIZE;
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
parameter_types,
traits::{
fungible::HoldConsideration,
tokens::{PayFromAccount, UnityAssetBalanceConversion},
ConstBool, ConstU128, ConstU32, ConstU8, Contains, Currency, EitherOfDiverse, IsInVec,
LinearStoragePrice, PrivilegeCmp,
},
weights::{ConstantMultiplier, Weight},
PalletId,
};
use frame_system::{
limits::{BlockLength, BlockWeights},
EnsureRoot, EnsureSigned, EnsureWithSuccess,
};
use manta_primitives::{
constants::{
time::*, RocksDbWeight, LOTTERY_PALLET_ID, NAME_SERVICE_PALLET_ID, STAKING_PALLET_ID,
TREASURY_PALLET_ID, WEIGHT_PER_SECOND,
},
currencies::Currencies,
types::{
AccountId, Balance, BlockNumber, CalamariAssetId, Hash, Header, Nonce, PoolId, Signature,
},
};
use manta_support::manta_pay::{InitialSyncResponse, PullResponse, RawCheckpoint};
pub use pallet_parachain_staking::{InflationInfo, Range};
use pallet_session::ShouldEndSession;
use runtime_common::{
prod_or_fast, BlockExecutionWeight, BlockHashCount, CalamariSlowAdjustingFeeUpdate,
ExtrinsicBaseWeight,
};
use session_key_primitives::{AuraId, NimbusId, VrfId};
use zenlink_protocol::{AssetBalance, AssetId as ZenlinkAssetId, MultiAssetsHandler, PairInfo};
use xcm::latest::prelude::*;
pub mod assets_config;
pub mod currency;
#[cfg(test)]
mod diff_tx_fees;
pub mod fee;
pub mod impls;
pub mod migrations;
mod nimbus_session_adapter;
pub mod staking;
pub mod xcm_config;
pub mod zenlink;
use currency::*;
use impls::DealWithFees;
pub type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
/// the specifics of the runtime. They can then be made to be agnostic over specific formats
/// of data like extrinsics, allowing for them to continue syncing the network through upgrades
/// to even the core data structures.
pub mod opaque {
use super::*;
pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
/// Opaque block header type.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Opaque block type.
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
/// Opaque block identifier type.
pub type BlockId = generic::BlockId<Block>;
use nimbus_session_adapter::{AuthorInherentWithNoOpSession, VrfWithNoOpSession};
impl_opaque_keys! {
pub struct SessionKeys {
pub aura: Aura,
pub nimbus: AuthorInherentWithNoOpSession<Runtime>,
pub vrf: VrfWithNoOpSession,
}
}
impl SessionKeys {
pub fn new(tuple: (AuraId, NimbusId, VrfId)) -> SessionKeys {
let (aura, nimbus, vrf) = tuple;
SessionKeys { aura, nimbus, vrf }
}
/// Derives all collator keys from `seed` without checking that the `seed` is valid.
#[cfg(feature = "std")]
pub fn from_seed_unchecked(seed: &str) -> SessionKeys {
Self::new((
session_key_primitives::util::unchecked_public_key::<AuraId>(seed),
session_key_primitives::util::unchecked_public_key::<NimbusId>(seed),
session_key_primitives::util::unchecked_public_key::<VrfId>(seed),
))
}
}
}
// Weights used in the runtime.
pub mod weights;
#[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("calamari"),
impl_name: create_runtime_str!("calamari"),
authoring_version: 2,
spec_version: 4730,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 21,
state_version: 0,
};
/// The version information used to identify this runtime when compiled natively.
#[cfg(feature = "std")]
pub fn native_version() -> NativeVersion {
NativeVersion {
runtime_version: VERSION,
can_author_with: Default::default(),
}
}
/// We assume that ~10% of the block weight is consumed by `on_initialize` handlers. This is
/// used to limit the maximal weight of a single extrinsic.
pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
/// We allow `Normal` extrinsics to fill up the block up to 70%, the rest can be used by
/// Operational extrinsics.
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(70);
/// We allow for 0.5 seconds of compute with a 6 second average block time.
pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(WEIGHT_PER_SECOND, 0)
.saturating_div(2)
.set_proof_size(MAX_POV_SIZE as u64);
parameter_types! {
pub const Version: RuntimeVersion = VERSION;
pub RuntimeBlockLength: BlockLength =
BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
.base_block(BlockExecutionWeight::get())
.for_class(DispatchClass::all(), |weights| {
weights.base_extrinsic = ExtrinsicBaseWeight::get();
})
.for_class(DispatchClass::Normal, |weights| {
weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
})
.for_class(DispatchClass::Operational, |weights| {
weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
// Operational transactions have some extra reserved space, so that they
// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
weights.reserved = Some(
MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
);
})
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
.build_or_panic();
pub const SS58Prefix: u8 = manta_primitives::constants::CALAMARI_SS58PREFIX;
}
parameter_types! {
pub NonPausablePallets: Vec<Vec<u8>> = vec![b"Democracy".to_vec(), b"Balances".to_vec(), b"Council".to_vec(), b"CouncilMembership".to_vec(), b"TechnicalCommittee".to_vec(), b"TechnicalMembership".to_vec()];
}
impl pallet_tx_pause::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type MaxCallNames = ConstU32<25>;
type PauseOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureMembers<AccountId, TechnicalCollective, 2>,
>;
type UnpauseOrigin = EnsureRoot<AccountId>;
type NonPausablePallets = IsInVec<NonPausablePallets>;
type WeightInfo = weights::pallet_tx_pause::SubstrateWeight<Runtime>;
}
// Don't allow permission-less asset creation.
pub struct BaseFilter;
impl Contains<RuntimeCall> for BaseFilter {
fn contains(call: &RuntimeCall) -> bool {
if matches!(
call,
RuntimeCall::Timestamp(_) | RuntimeCall::ParachainSystem(_) | RuntimeCall::System(_)
) {
// always allow core call
// pallet-timestamp and parachainSystem could not be filtered because
// they are used in communication between relaychain and parachain.
return true;
}
if pallet_tx_pause::PausedTransactionFilter::<Runtime>::contains(call) {
// no paused call
return false;
}
#[allow(clippy::match_like_matches_macro)]
// keep CallFilter with explicit true/false for documentation
match call {
// Explicitly DISALLOWED calls ( Pallet user extrinsics we don't want used WITH REASONING )
// Filter Assets. Assets should only be accessed by AssetManager.
| RuntimeCall::Assets(pallet_assets::Call::create {..}
| pallet_assets::Call::force_create {..}
| pallet_assets::Call::start_destroy {..}
| pallet_assets::Call::destroy_accounts {..}
| pallet_assets::Call::destroy_approvals {..}
| pallet_assets::Call::finish_destroy {..}
| pallet_assets::Call::mint {..}
| pallet_assets::Call::burn {..}
| pallet_assets::Call::force_transfer {..}
| pallet_assets::Call::freeze {..}
| pallet_assets::Call::thaw {..}
| pallet_assets::Call::freeze_asset {..}
| pallet_assets::Call::thaw_asset {..}
| pallet_assets::Call::transfer_ownership {..}
| pallet_assets::Call::set_team {..}
| pallet_assets::Call::set_metadata {..}
| pallet_assets::Call::clear_metadata {..}
| pallet_assets::Call::force_set_metadata {..}
| pallet_assets::Call::force_clear_metadata {..}
| pallet_assets::Call::force_asset_status {..}
| pallet_assets::Call::approve_transfer {..}
| pallet_assets::Call::cancel_approval {..}
| pallet_assets::Call::force_cancel_approval {..}
| pallet_assets::Call::transfer_approved {..}
| pallet_assets::Call::touch {..}
| pallet_assets::Call::refund {..}
)
// It's a call only for vesting crowdloan contributors' token, normal user should not use it.
| RuntimeCall::CalamariVesting(calamari_vesting::Call::vested_transfer {..})
// For now disallow public proposal workflows, treasury workflows.
| RuntimeCall::Democracy(
pallet_democracy::Call::propose {..}
| pallet_democracy::Call::second {..}
| pallet_democracy::Call::cancel_proposal {..}
| pallet_democracy::Call::clear_public_proposals {..})
| RuntimeCall::Treasury(_) // Treasury calls are filtered while it is accumulating funds.
// Filter callables from XCM pallets, we use XTokens exclusively
| RuntimeCall::XcmpQueue(_) => false,
// Explicitly ALLOWED calls
| RuntimeCall::Multisig(_)
| RuntimeCall::Democracy(pallet_democracy::Call::vote {..}
| pallet_democracy::Call::emergency_cancel {..}
| pallet_democracy::Call::external_propose {..}
| pallet_democracy::Call::external_propose_default {..}
| pallet_democracy::Call::external_propose_majority {..}
| pallet_democracy::Call::fast_track {..}
| pallet_democracy::Call::veto_external {..}
| pallet_democracy::Call::cancel_referendum {..}
| pallet_democracy::Call::delegate {..}
| pallet_democracy::Call::undelegate {..}
| pallet_democracy::Call::unlock {..}
| pallet_democracy::Call::remove_vote {..}
| pallet_democracy::Call::remove_other_vote {..}
| pallet_democracy::Call::blacklist {..})
| RuntimeCall::Council(_)
| RuntimeCall::TechnicalCommittee(_)
| RuntimeCall::CouncilMembership(_)
| RuntimeCall::TechnicalMembership(_)
// | RuntimeCall::Lottery(_)
| RuntimeCall::Randomness(pallet_randomness::Call::set_babe_randomness_results{..})
| RuntimeCall::Scheduler(_)
| RuntimeCall::CalamariVesting(_)
| RuntimeCall::Session(_) // User must be able to set their session key when applying for a collator
| RuntimeCall::AuthorInherent(pallet_author_inherent::Call::kick_off_authorship_validation {..}) // executes unsigned on every block
| RuntimeCall::ParachainStaking(
// Collator extrinsics
pallet_parachain_staking::Call::join_candidates{..}
| pallet_parachain_staking::Call::set_staking_expectations{..}
| pallet_parachain_staking::Call::schedule_leave_candidates{..}
| pallet_parachain_staking::Call::execute_leave_candidates{..}
| pallet_parachain_staking::Call::cancel_leave_candidates{..}
| pallet_parachain_staking::Call::go_offline{..}
| pallet_parachain_staking::Call::go_online{..}
| pallet_parachain_staking::Call::candidate_bond_more{..}
| pallet_parachain_staking::Call::schedule_candidate_bond_less{..}
| pallet_parachain_staking::Call::execute_candidate_bond_less{..}
| pallet_parachain_staking::Call::cancel_candidate_bond_less{..}
// Delegator extrinsics
| pallet_parachain_staking::Call::delegate{..}
| pallet_parachain_staking::Call::schedule_leave_delegators{..}
| pallet_parachain_staking::Call::execute_leave_delegators{..}
| pallet_parachain_staking::Call::cancel_leave_delegators{..}
| pallet_parachain_staking::Call::schedule_revoke_delegation{..}
| pallet_parachain_staking::Call::delegator_bond_more{..}
| pallet_parachain_staking::Call::schedule_delegator_bond_less{..}
| pallet_parachain_staking::Call::execute_delegation_request{..}
| pallet_parachain_staking::Call::cancel_delegation_request{..})
| RuntimeCall::Balances(_)
| RuntimeCall::Preimage(_)
| RuntimeCall::MantaPay(_)
| RuntimeCall::MantaSbt(_)
| RuntimeCall::NameService(_)
| RuntimeCall::XTokens(_)
| RuntimeCall::TransactionPause(_)
| RuntimeCall::ZenlinkProtocol(_)
| RuntimeCall::Farming(_)
| RuntimeCall::Assets(
pallet_assets::Call::transfer {..}
| pallet_assets::Call::transfer_keep_alive {..}
)
| RuntimeCall::AssetManager(pallet_asset_manager::Call::update_outgoing_filtered_assets {..})
| RuntimeCall::PolkadotXcm(pallet_xcm::Call::send {..})
| RuntimeCall::Utility(_) => true,
// DISALLOW anything else
| _ => false
}
}
}
// Configure FRAME pallets to include in runtime.
impl frame_system::Config for Runtime {
type BaseCallFilter = BaseFilter; // Let filter activate.
type BlockWeights = RuntimeBlockWeights;
type BlockLength = RuntimeBlockLength;
type AccountId = AccountId;
type RuntimeCall = RuntimeCall;
type Lookup = AccountIdLookup<AccountId, ()>;
type Nonce = Nonce;
type Block = Block;
type Hash = Hash;
type Hashing = BlakeTwo256;
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type BlockHashCount = BlockHashCount;
type DbWeight = RocksDbWeight;
type Version = Version;
type PalletInfo = PalletInfo;
type RuntimeTask = RuntimeTask;
type OnNewAccount = ();
type OnKilledAccount = ();
type AccountData = pallet_balances::AccountData<Balance>;
type SystemWeightInfo = ();
type SS58Prefix = SS58Prefix;
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
type MaxConsumers = ConstU32<16>;
}
parameter_types! {
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
}
impl pallet_timestamp::Config for Runtime {
/// A timestamp: milliseconds since the unix epoch.
type Moment = u64;
type OnTimestampSet = ();
type MinimumPeriod = MinimumPeriod;
type WeightInfo = weights::pallet_timestamp::SubstrateWeight<Runtime>;
}
/// Only callable after `set_validation_data` is called which forms this proof the same way
fn relay_chain_state_proof() -> cumulus_pallet_parachain_system::RelayChainStateProof {
use sp_core::Get;
let relay_storage_root = ParachainSystem::validation_data()
.expect("set in `set_validation_data`")
.relay_parent_storage_root;
let relay_chain_state =
ParachainSystem::relay_state_proof().expect("set in `set_validation_data`");
cumulus_pallet_parachain_system::RelayChainStateProof::new(
ParachainInfo::get(),
relay_storage_root,
relay_chain_state,
)
.expect("Invalid relay chain state proof, already constructed in `set_validation_data`")
}
pub struct BabeDataGetter;
impl pallet_randomness::GetBabeData<u64, Option<Hash>> for BabeDataGetter {
// Tolerate panic here because only ever called in inherent (so can be omitted)
fn get_epoch_index() -> u64 {
if cfg!(feature = "runtime-benchmarks") {
// storage reads as per actual reads
let _relay_storage_root = ParachainSystem::validation_data();
let _relay_chain_state = ParachainSystem::relay_state_proof();
const BENCHMARKING_NEW_EPOCH: u64 = 10u64;
return BENCHMARKING_NEW_EPOCH;
}
relay_chain_state_proof()
.read_optional_entry(cumulus_primitives_core::relay_chain::well_known_keys::EPOCH_INDEX)
.ok()
.flatten()
.expect("expected to be able to read epoch index from relay chain state proof")
}
fn get_epoch_randomness() -> Option<Hash> {
if cfg!(feature = "runtime-benchmarks") {
// storage reads as per actual reads
let _relay_storage_root = ParachainSystem::validation_data();
let _relay_chain_state = ParachainSystem::relay_state_proof();
let benchmarking_babe_output = Hash::default();
return Some(benchmarking_babe_output);
}
relay_chain_state_proof()
.read_optional_entry(
cumulus_primitives_core::relay_chain::well_known_keys::ONE_EPOCH_AGO_RANDOMNESS,
)
.ok()
.flatten()
}
}
impl pallet_randomness::Config for Runtime {
type BabeDataGetter = BabeDataGetter;
type WeightInfo = weights::pallet_randomness::SubstrateWeight<Runtime>;
}
parameter_types! {
pub const LotteryPotId: PalletId = LOTTERY_PALLET_ID;
/// Time in blocks between lottery drawings
pub DrawingInterval: BlockNumber = prod_or_fast!(7 * DAYS, 3 * MINUTES);
/// Time in blocks *before* a drawing in which modifications of the win-eligble pool are prevented
pub DrawingFreezeout: BlockNumber = prod_or_fast!(1 * DAYS, 1 * MINUTES);
/// Time in blocks until a collator is done unstaking
pub UnstakeLockTime: BlockNumber = LeaveDelayRounds::get() * DefaultBlocksPerRound::get();
}
impl pallet_lottery::Config for Runtime {
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type Scheduler = Scheduler;
type EstimateCallFee = TransactionPayment;
type RandomnessSource = Randomness;
type ManageOrigin = EnsureRootOrMoreThanHalfCouncil;
type PalletsOrigin = OriginCaller;
type LotteryPot = LotteryPotId;
type DrawingInterval = DrawingInterval;
type DrawingFreezeout = DrawingFreezeout;
type UnstakeLockTime = UnstakeLockTime;
type BalanceConversion = Balance;
type WeightInfo = weights::pallet_lottery::SubstrateWeight<Runtime>;
}
impl pallet_authorship::Config for Runtime {
type FindAuthor = AuthorInherent;
type EventHandler = (CollatorSelection,);
}
parameter_types! {
pub const NativeTokenExistentialDeposit: u128 = 10 * cKMA; // 0.1 KMA
}
// It's for fixing benchmarking pallet-treasury, 100 will be deposited into an
// account in the pallet_treasury::payout, so we have to set a smaller ED.
#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
pub const BenchmarksNativeTokenExistentialDeposit: u128 = 10;
}
impl pallet_balances::Config for Runtime {
type MaxLocks = ConstU32<50>;
type MaxReserves = ConstU32<50>;
type ReserveIdentifier = [u8; 8];
type Balance = Balance;
type DustRemoval = ();
type RuntimeEvent = RuntimeEvent;
#[cfg(not(feature = "runtime-benchmarks"))]
type ExistentialDeposit = NativeTokenExistentialDeposit;
#[cfg(feature = "runtime-benchmarks")]
type ExistentialDeposit = BenchmarksNativeTokenExistentialDeposit;
type AccountStore = frame_system::Pallet<Runtime>;
type WeightInfo = weights::pallet_balances::SubstrateWeight<Runtime>;
type FreezeIdentifier = ();
type MaxFreezes = ();
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type MaxHolds = ConstU32<50>;
}
parameter_types! {
pub const TransactionLengthToFeeCoeff: Balance = mKMA / 100;
pub const WeightToFeeCoeff: Balance = 5_000;
}
impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;
type WeightToFee = ConstantMultiplier<Balance, WeightToFeeCoeff>;
type LengthToFee = ConstantMultiplier<Balance, TransactionLengthToFeeCoeff>;
type FeeMultiplierUpdate = CalamariSlowAdjustingFeeUpdate<Self>;
type OperationalFeeMultiplier = ConstU8<5>;
type RuntimeEvent = RuntimeEvent;
}
parameter_types! {
// One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes.
pub const DepositBase: Balance = deposit(1, 88);
// Additional storage item size of 32 bytes.
pub const DepositFactor: Balance = deposit(0, 32);
}
impl pallet_multisig::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type MaxSignatories = ConstU32<100>;
type WeightInfo = weights::pallet_multisig::SubstrateWeight<Runtime>;
}
impl pallet_utility::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type PalletsOrigin = OriginCaller;
type WeightInfo = weights::pallet_utility::SubstrateWeight<Runtime>;
}
parameter_types! {
pub LaunchPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 5 * MINUTES, "CALAMARI_LAUNCH_PERIOD");
pub VotingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 5 * MINUTES, "CALAMARI_VOTING_PERIOD");
pub FastTrackVotingPeriod: BlockNumber = prod_or_fast!(3 * HOURS, 2 * MINUTES, "CALAMARI_FAST_TRACK_VOTING_PERIOD");
pub const InstantAllowed: bool = true;
pub const MinimumDeposit: Balance = 1000 * KMA;
pub EnactmentPeriod: BlockNumber = prod_or_fast!(1 * DAYS, 2 * MINUTES, "CALAMARI_ENACTMENT_PERIOD");
pub CooloffPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 2 * MINUTES, "CALAMARI_COOL_OFF_PERIOD");
pub const PreimageByteDeposit: Balance = deposit(0, 1);
}
impl pallet_democracy::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type EnactmentPeriod = EnactmentPeriod;
type VoteLockingPeriod = EnactmentPeriod;
type LaunchPeriod = LaunchPeriod;
type VotingPeriod = VotingPeriod;
type MinimumDeposit = MinimumDeposit;
/// A straight majority of the council can decide what their next motion is.
type ExternalOrigin =
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 2>;
/// A super-majority can have the next scheduled referendum be a straight majority-carries vote.
type ExternalMajorityOrigin =
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 4>;
/// A unanimous council can have the next scheduled referendum be a straight default-carries
/// (NTB) vote.
type ExternalDefaultOrigin =
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 1>;
/// Two thirds of the technical committee can have an ExternalMajority/ExternalDefault vote
/// be tabled immediately and with a shorter voting/enactment period.
type FastTrackOrigin =
pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 2, 3>;
type InstantOrigin =
pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 1, 1>;
type InstantAllowed = InstantAllowed;
type FastTrackVotingPeriod = FastTrackVotingPeriod;
// To cancel a proposal which has been passed, 2/3 of the council must agree to it.
type CancellationOrigin =
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 3>;
// To cancel a proposal before it has been passed, the technical committee must be unanimous or
// Root must agree.
type CancelProposalOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 1, 1>,
>;
type BlacklistOrigin = EnsureRoot<AccountId>;
// Any single technical committee member may veto a coming council proposal, however they can
// only do it once and it lasts only for the cool-off period.
type VetoOrigin = pallet_collective::EnsureMember<AccountId, TechnicalCollective>;
type CooloffPeriod = CooloffPeriod;
type Slash = ();
type Scheduler = Scheduler;
type PalletsOrigin = OriginCaller;
type MaxVotes = ConstU32<100>;
type WeightInfo = weights::pallet_democracy::SubstrateWeight<Runtime>;
type MaxProposals = ConstU32<100>;
type Preimages = Preimage;
type MaxDeposits = ConstU32<100>;
type MaxBlacklisted = ConstU32<100>;
type SubmitOrigin = EnsureSigned<AccountId>;
}
parameter_types! {
/// The maximum amount of time (in blocks) for council members to vote on motions.
/// Motions may end in fewer blocks if enough votes are cast to determine the result.
pub const CouncilMotionDuration: BlockNumber = 3 * DAYS;
pub MaxProposalWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block;
}
type CouncilCollective = pallet_collective::Instance1;
impl pallet_collective::Config<CouncilCollective> for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = CouncilMotionDuration;
type MaxProposals = ConstU32<100>;
type MaxMembers = ConstU32<100>;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type SetMembersOrigin = EnsureRoot<AccountId>;
type MaxProposalWeight = MaxProposalWeight;
type WeightInfo = weights::pallet_collective::SubstrateWeight<Runtime>;
}
pub type EnsureRootOrThreeFourthsCouncil = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 4>,
>;
type CouncilMembershipInstance = pallet_membership::Instance1;
impl pallet_membership::Config<CouncilMembershipInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type AddOrigin = EnsureRootOrThreeFourthsCouncil;
type RemoveOrigin = EnsureRootOrThreeFourthsCouncil;
type SwapOrigin = EnsureRootOrThreeFourthsCouncil;
type ResetOrigin = EnsureRootOrThreeFourthsCouncil;
type PrimeOrigin = EnsureRootOrThreeFourthsCouncil;
type MembershipInitialized = Council;
type MembershipChanged = Council;
type MaxMembers = ConstU32<100>;
type WeightInfo = weights::pallet_membership::SubstrateWeight<Runtime>;
}
parameter_types! {
pub const TechnicalMotionDuration: BlockNumber = 3 * DAYS;
}
type TechnicalCollective = pallet_collective::Instance2;
impl pallet_collective::Config<TechnicalCollective> for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = TechnicalMotionDuration;
type MaxProposals = ConstU32<100>;
type MaxMembers = ConstU32<100>;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type SetMembersOrigin = EnsureRoot<AccountId>;
type MaxProposalWeight = MaxProposalWeight;
type WeightInfo = weights::pallet_collective::SubstrateWeight<Runtime>;
}
type TechnicalMembershipInstance = pallet_membership::Instance2;
impl pallet_membership::Config<TechnicalMembershipInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type AddOrigin = EnsureRootOrThreeFourthsCouncil;
type RemoveOrigin = EnsureRootOrThreeFourthsCouncil;
type SwapOrigin = EnsureRootOrThreeFourthsCouncil;
type ResetOrigin = EnsureRootOrThreeFourthsCouncil;
type PrimeOrigin = EnsureRootOrThreeFourthsCouncil;
type MembershipInitialized = TechnicalCommittee;
type MembershipChanged = TechnicalCommittee;
type MaxMembers = ConstU32<100>;
type WeightInfo = weights::pallet_membership::SubstrateWeight<Runtime>;
}
parameter_types! {
pub const ProposalBond: Permill = Permill::from_percent(1);
pub const ProposalBondMinimum: Balance = 500 * KMA;
pub const ProposalBondMaximum: Balance = 10_000 * KMA;
pub SpendPeriod: BlockNumber = prod_or_fast!(6 * DAYS, 2 * MINUTES, "CALAMARI_SPEND_PERIOD");
pub const Burn: Permill = Permill::from_percent(0);
pub const TreasuryPalletId: PalletId = TREASURY_PALLET_ID;
pub const PayoutSpendPeriod: BlockNumber = 30 * DAYS;
pub const MaxBalance: Balance = Balance::max_value();
}
type EnsureRootOrThreeFifthsCouncil = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 5>,
>;
type EnsureRootOrMoreThanHalfCouncil = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>,
>;
impl pallet_treasury::Config for Runtime {
type PalletId = TreasuryPalletId;
type Currency = Balances;
type ApproveOrigin = EnsureRootOrThreeFifthsCouncil;
type RejectOrigin = EnsureRootOrMoreThanHalfCouncil;
type RuntimeEvent = RuntimeEvent;
type OnSlash = Treasury;
type ProposalBond = ProposalBond;
type ProposalBondMinimum = ProposalBondMinimum;
type ProposalBondMaximum = ProposalBondMaximum;
type SpendPeriod = SpendPeriod;
type Burn = Burn;
type BurnDestination = ();
type MaxApprovals = ConstU32<100>;
type WeightInfo = weights::pallet_treasury::SubstrateWeight<Runtime>;
type SpendFunds = ();
// Expects an implementation of `EnsureOrigin` with a `Success` generic,
// which is the the maximum amount that this origin is allowed to spend at a time.
type SpendOrigin = EnsureWithSuccess<EnsureRoot<AccountId>, AccountId, MaxBalance>;
type Beneficiary = AccountId;
type BeneficiaryLookup = IdentityLookup<Self::Beneficiary>;
type Paymaster = PayFromAccount<Balances, TreasuryAccount>;
type BalanceConverter = UnityAssetBalanceConversion;
type PayoutPeriod = PayoutSpendPeriod;
type AssetKind = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
impl pallet_aura_style_filter::Config for Runtime {
/// Nimbus filter pipeline (final) step 3:
/// Choose 1 collator from PotentialAuthors as eligible
/// for each slot in round-robin fashion
type PotentialAuthors = ParachainStaking;
}
parameter_types! {
/// Fixed percentage a collator takes off the top of due rewards
pub const DefaultCollatorCommission: Perbill = Perbill::from_percent(10);
/// Default percent of inflation set aside for parachain bond every round
pub const DefaultParachainBondReservePercent: Percent = Percent::zero();
pub DefaultBlocksPerRound: BlockNumber = prod_or_fast!(6 * HOURS,15,"CALAMARI_DEFAULT_BLOCKS_PER_ROUND");
pub LeaveDelayRounds: BlockNumber = prod_or_fast!(28,1,"CALAMARI_LEAVE_DELAY_ROUNDS"); // == 7 * DAYS / 6 * HOURS
}
impl pallet_parachain_staking::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type BlockAuthor = AuthorInherent;
type MonetaryGovernanceOrigin = EnsureRoot<AccountId>;
/// Minimum round length is 2 minutes (10 * 12 second block times)
type MinBlocksPerRound = ConstU32<10>;
/// Blocks per round
type DefaultBlocksPerRound = DefaultBlocksPerRound;
/// Rounds before the collator leaving the candidates request can be executed
type LeaveCandidatesDelay = LeaveDelayRounds;
/// Rounds before the candidate bond increase/decrease can be executed
type CandidateBondLessDelay = LeaveDelayRounds;
/// Rounds before the delegator exit can be executed
type LeaveDelegatorsDelay = LeaveDelayRounds;
/// Rounds before the delegator revocation can be executed
type RevokeDelegationDelay = LeaveDelayRounds;
/// Rounds before the delegator bond increase/decrease can be executed
type DelegationBondLessDelay = LeaveDelayRounds;
/// Rounds before the reward is paid
type RewardPaymentDelay = ConstU32<2>;
/// Minimum collators selected per round, default at genesis and minimum forever after
type MinSelectedCandidates = ConstU32<5>;
/// Maximum top delegations per candidate
type MaxTopDelegationsPerCandidate = ConstU32<100>;
/// Maximum bottom delegations per candidate
type MaxBottomDelegationsPerCandidate = ConstU32<50>;
/// Maximum delegations per delegator
type MaxDelegationsPerDelegator = ConstU32<25>;
type DefaultCollatorCommission = DefaultCollatorCommission;
type DefaultParachainBondReservePercent = DefaultParachainBondReservePercent;
/// Minimum stake on a collator to be considered for block production
type MinCollatorStk = ConstU128<{ crate::staking::MIN_BOND_TO_BE_CONSIDERED_COLLATOR }>;
/// Minimum stake the collator runner must bond to register as collator candidate
type MinCandidateStk = ConstU128<{ crate::staking::NORMAL_COLLATOR_MINIMUM_STAKE }>;
/// WHITELIST: Minimum stake required for *a whitelisted* account to be a collator candidate
type MinWhitelistCandidateStk = ConstU128<{ crate::staking::EARLY_COLLATOR_MINIMUM_STAKE }>;
/// Smallest amount that can be delegated
type MinDelegation = ConstU128<{ 5_000 * KMA }>;
/// Minimum stake required to be reserved to be a delegator
type MinDelegatorStk = ConstU128<{ 5_000 * KMA }>;
type OnCollatorPayout = ();
type OnNewRound = ();
type WeightInfo = weights::pallet_parachain_staking::SubstrateWeight<Runtime>;
}
impl pallet_author_inherent::Config for Runtime {
// We start a new slot each time we see a new relay block.
type SlotBeacon = cumulus_pallet_parachain_system::RelaychainDataProvider<Self>;
type AccountLookup = CollatorSelection;
type AuthorId = AccountId;
// PUT REAL WEIGHT
type WeightInfo = ();
/// Nimbus filter pipeline step 1:
/// Filters out NimbusIds not registered as SessionKeys of some AccountId
type CanAuthor = AuraAuthorFilter;
}
type ScheduleOrigin = EnsureRootOrMoreThanHalfCouncil;
/// Used the compare the privilege of an origin inside the scheduler.
pub struct OriginPrivilegeCmp;
impl PrivilegeCmp<OriginCaller> for OriginPrivilegeCmp {
fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option<Ordering> {
if left == right {
return Some(Ordering::Equal);
}
match (left, right) {
// Root is greater than anything.
(OriginCaller::system(frame_system::RawOrigin::Root), _) => Some(Ordering::Greater),
// Check which one has more yes votes.
(
OriginCaller::Council(pallet_collective::RawOrigin::Members(l_yes_votes, l_count)),
OriginCaller::Council(pallet_collective::RawOrigin::Members(r_yes_votes, r_count)),
) => Some((l_yes_votes * r_count).cmp(&(r_yes_votes * l_count))),
// For every other origin we don't care, as they are not used for `ScheduleOrigin`.
_ => None,
}
}
}
parameter_types! {
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) *
RuntimeBlockWeights::get().max_block;
pub const NoPreimagePostponement: Option<u32> = Some(10);
}
impl pallet_scheduler::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type PalletsOrigin = OriginCaller;
type RuntimeCall = RuntimeCall;
type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = ScheduleOrigin;
type MaxScheduledPerBlock = ConstU32<50>; // 50 scheduled calls at most in the queue for a single block.
type WeightInfo = weights::pallet_scheduler::SubstrateWeight<Runtime>;
type OriginPrivilegeCmp = OriginPrivilegeCmp;
type Preimages = Preimage;
}
parameter_types! {
// Our NORMAL_DISPATCH_RATIO is 70% of the 5MB limit
// So anything more than 3.5MB doesn't make sense here
pub const PreimageMaxSize: u32 = 3584 * 1024;
pub const PreimageBaseDeposit: Balance = 1 * KMA;
pub const PreimageHoldReason: RuntimeHoldReason =
RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
}
impl pallet_preimage::Config for Runtime {
type WeightInfo = weights::pallet_preimage::SubstrateWeight<Runtime>;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>;
type Consideration = HoldConsideration<
AccountId,
Balances,
PreimageHoldReason,
LinearStoragePrice<PreimageBaseDeposit, PreimageByteDeposit, Balance>,
>;
}
parameter_types! {
// Rotate collator's spot each 6 hours.
pub Period: u32 = prod_or_fast!(6 * HOURS, 2 * MINUTES, "CALAMARI_PERIOD");
pub const Offset: u32 = 0;
}
// NOTE: pallet_parachain_staking rounds are now used,
// session rotation through pallet session no longer needed
// but the pallet is used for SessionKeys storage
pub struct NeverEndSession;
impl ShouldEndSession<u32> for NeverEndSession {
fn should_end_session(_: u32) -> bool {
false
}
}
impl pallet_session::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type ValidatorId = <Self as frame_system::Config>::AccountId;
// we don't have stash and controller, thus we don't need the convert as well.
type ValidatorIdOf = IdentityCollator;
type ShouldEndSession = NeverEndSession;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type SessionManager = ();
type SessionHandler =
<opaque::SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
type Keys = opaque::SessionKeys;
type WeightInfo = weights::pallet_session::SubstrateWeight<Runtime>;
}
impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
type DisabledValidators = ();
type MaxAuthorities = ConstU32<100_000>;
// false means async backing is disabled
// https://forum.polkadot.network/t/polkadot-release-analysis-v1-0-0/3585#pallet-aura-allow-multiple-blocks-per-slot-12
type AllowMultipleBlocksPerSlot = ConstBool<false>;
}
parameter_types! {
// Pallet account for record rewards and give rewards to collator.
pub const PotId: PalletId = STAKING_PALLET_ID;
}
parameter_types! {
pub const ExecutiveBody: BodyId = BodyId::Executive;
}
/// We allow root and the Relay Chain council to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 1>,
>;
impl manta_collator_selection::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type UpdateOrigin = CollatorSelectionUpdateOrigin;
type PotId = PotId;
type MaxCandidates = ConstU32<50>; // 50 candidates at most
type MaxInvulnerables = ConstU32<5>; // 5 invulnerables at most
type ValidatorId = <Self as frame_system::Config>::AccountId;
type ValidatorIdOf = IdentityCollator;
type AccountIdOf = IdentityCollator;
type ValidatorRegistration = Session;
type WeightInfo = weights::manta_collator_selection::SubstrateWeight<Runtime>;
/// Nimbus filter pipeline step 2:
/// Filters collators not part of the current pallet_session::validators()
type CanAuthor = AuraAuthorFilter;
}
// Calamari pallets configuration
parameter_types! {
pub const MinVestedTransfer: Balance = KMA;
}
#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
pub const BenchmarksMinVestedTransfer: Balance = 10;
}
impl calamari_vesting::Config for Runtime {
type Currency = Balances;
type RuntimeEvent = RuntimeEvent;
type Timestamp = Timestamp;
#[cfg(not(feature = "runtime-benchmarks"))]
type MinVestedTransfer = MinVestedTransfer;
#[cfg(feature = "runtime-benchmarks")]
type MinVestedTransfer = BenchmarksMinVestedTransfer;
type MaxScheduleLength = ConstU32<6>;
type WeightInfo = weights::calamari_vesting::SubstrateWeight<Runtime>;
}
parameter_types! {
pub const FarmingKeeperPalletId: PalletId = PalletId(*b"mt/fmkpr");
pub const FarmingRewardIssuerPalletId: PalletId = PalletId(*b"mt/fmrir");
pub TreasuryAccount: AccountId = TreasuryPalletId::get().into_account_truncating();
}
/// Zenlink protocol Asset adaptor for orml_traits::MultiCurrency.
type MantaCurrencies = Currencies<Runtime, assets_config::CalamariAssetConfig, Balances, Assets>;
impl pallet_farming::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type CurrencyId = CalamariAssetId;
type MultiCurrency = MantaCurrencies;
type ControlOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 2, 3>,
>;
type TreasuryAccount = TreasuryAccount;
type Keeper = FarmingKeeperPalletId;
type RewardIssuer = FarmingRewardIssuerPalletId;
type WeightInfo = weights::pallet_farming::SubstrateWeight<Runtime>;
}
parameter_types! {
pub const NameServicePalletId: PalletId = NAME_SERVICE_PALLET_ID;
}
impl pallet_name_service::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type PalletId = NameServicePalletId;
type RegisterWaitingPeriod = ConstU32<2>;
/// Register pricing around 5$ with current KMA/USD
type RegisterPrice = ConstU128<{ 3300 * KMA }>;
type WeightInfo = weights::pallet_name_service::SubstrateWeight<Runtime>;
}
struct CheckInherents;
#[allow(deprecated)]
impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
fn check_inherents(
block: &Block,
relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,
) -> sp_inherents::CheckInherentsResult {
let relay_chain_slot = relay_state_proof
.read_slot()
.expect("Could not read the relay chain slot from the proof");