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
#![cfg_attr(not(feature = "std"), no_std)]
#![recursion_limit = "256"]
#![allow(clippy::from_over_into)]
#![allow(clippy::manual_range_contains)]
use frame_support::{construct_runtime, parameter_types, weights::Weight, PalletId};
use frame_system::limits::{BlockLength, BlockWeights};
use sp_runtime::traits::Get;
use pallet_session::historical as pallet_session_historical;
#[cfg(any(feature = "std", test))]
pub use frame_system::Call as SystemCall;
#[cfg(any(feature = "std", test))]
pub use pallet_balances::Call as BalancesCall;
#[cfg(any(feature = "std", test))]
pub use pallet_staking::StakerStatus;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
use sp_runtime::{create_runtime_str, impl_opaque_keys, DispatchError, DispatchResult};
use sp_std::prelude::*;
#[cfg(any(feature = "std", test))]
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;
#[cfg(feature = "std")]
pub use crate::api::{api::dispatch, RuntimeApi};
pub use crate::types::{
AccountId, AccountIndex, Address, AssetId, Balance, Block, BlockId, BlockNumber,
CheckedExtrinsic, Hash, Header, Moment, Nonce, Signature, SignedBlock, SignedExtra,
SignedPayload, UncheckedExtrinsic, BABE_GENESIS_EPOCH_CONFIG,
};
mod config;
#[path = "../../common/impls.rs"]
mod impls;
#[path = "../../common/constants.rs"]
pub mod constants;
#[path = "../../common/types.rs"]
pub mod types;
#[path = "../../common/api.rs"]
mod api;
mod weights;
mod bag_thresholds;
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
pub const SS58_PREFIX: u16 = 42;
#[cfg(feature = "std")]
pub fn wasm_binary_unwrap() -> &'static [u8] {
WASM_BINARY.expect(
"Development wasm binary is not available. This means the client is \
built with `SKIP_WASM_BUILD` flag and it is only usable for \
production chains. Please rebuild with the flag disabled.",
)
}
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("lagoon"),
impl_name: create_runtime_str!("lagoon"),
authoring_version: 0,
spec_version: 7020,
impl_version: 0,
apis: crate::api::PRUNTIME_API_VERSIONS,
transaction_version: 1,
state_version: 0,
};
#[cfg(any(feature = "std", test))]
pub fn native_version() -> NativeVersion {
NativeVersion {
runtime_version: VERSION,
can_author_with: Default::default(),
}
}
impl_opaque_keys! {
pub struct SessionKeys {
pub grandpa: Grandpa,
pub babe: Babe,
pub im_online: ImOnline,
pub authority_discovery: AuthorityDiscovery,
}
}
pub type CouncilCollectiveInstance = pallet_collective::Instance1;
pub type TechnicalCollectiveInstance = pallet_collective::Instance2;
pub type TechnicalMembershipInstance = pallet_membership::Instance1;
parameter_types! {
pub const QuorumPalletId: PalletId = PalletId(*b"py/quorm");
pub const OraclePalletId: PalletId = PalletId(*b"py/oracl");
pub const AssetRegistryPalletId: PalletId = PalletId(*b"py/asstr");
pub const TidefiStakingPalletId: PalletId = PalletId(*b"py/stake");
pub const FeesPalletId: PalletId = PalletId(*b"py/wfees");
pub const SunrisePalletId: PalletId = PalletId(*b"py/sunrp");
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
pub const SunriseCooldown: BlockNumber = 1_200; }
impl pallet_sudo::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
}
construct_runtime!(
pub enum Runtime where
Block = Block,
NodeBlock = tidefi_primitives::Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: frame_system::{Pallet, Call, Config, Storage, Event<T>} = 0,
Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1,
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2,
Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>} = 3,
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 4,
TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>} = 5,
Authorship: pallet_authorship::{Pallet, Storage} = 6,
Staking: pallet_staking::{Pallet, Call, Config<T>, Storage, Event<T>} = 7,
Offences: pallet_offences::{Pallet, Storage, Event} = 8,
Historical: pallet_session_historical::{Pallet} = 9,
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 10,
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 11,
ImOnline: pallet_im_online::{Pallet, Call, Storage, Event<T>, ValidateUnsigned, Config<T>} = 12,
AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 13,
Democracy: pallet_democracy::{Pallet, Call, Storage, Config<T>, Event<T>} = 14,
Council: pallet_collective::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 15,
TechnicalCommittee: pallet_collective::<Instance2>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 16,
Elections: pallet_elections_phragmen::{Pallet, Call, Storage, Event<T>, Config<T>} = 17,
TechnicalMembership: pallet_membership::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 18,
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 19,
Utility: pallet_utility::{Pallet, Call, Event} = 20,
Identity: pallet_identity::{Pallet, Call, Storage, Event<T>} = 21,
ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event<T>, ValidateUnsigned} = 22,
Recovery: pallet_recovery::{Pallet, Call, Storage, Event<T>} = 23,
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 24,
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 25,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 26,
Bounties: pallet_bounties::{Pallet, Call, Storage, Event<T>} = 27,
Assets: pallet_assets::{Pallet, Call, Storage, Event<T>} = 28,
BagsList: pallet_bags_list::{Pallet, Call, Storage, Event<T>} = 29,
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>} = 30,
Sudo: pallet_sudo::{Pallet, Call, Config<T>, Storage, Event<T>} = 31,
Tidefi: pallet_tidefi::{Pallet, Call, Storage, Event<T>} = 50,
TidefiStaking: pallet_tidefi_stake::{Pallet, Call, Config<T>, Storage, Event<T>} = 51,
Quorum: pallet_quorum::{Pallet, Call, Config<T>, Storage, Event<T>} = 52,
Oracle: pallet_oracle::{Pallet, Call, Config<T>, Storage, Event<T>} = 53,
Security: pallet_security::{Pallet, Call, Config, Storage, Event<T>} = 54,
Fees: pallet_fees::{Pallet, Config<T>, Storage, Event<T>} = 55,
AssetRegistry: pallet_asset_registry::{Pallet, Call, Config<T>, Storage, Event<T>} = 56,
Sunrise: pallet_sunrise::{Pallet, Config<T>, Storage, Event<T>} = 57,
Vesting: pallet_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 58,
}
);
pub type Executive = frame_executive::Executive<
Runtime,
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
(
pallet_bags_list::migrations::AddScore<Runtime>,
pallet_scheduler::migration::v4::CleanupAgendas<Runtime>,
MigrateStakingToV8<Runtime>,
pallet_staking::migrations::v9::InjectValidatorsIntoVoterList<Runtime>,
pallet_staking::migrations::v10::MigrateToV10<Runtime>,
pallet_staking::migrations::v11::MigrateToV11<Runtime, BagsList, StakingMigrationV11OldPallet>,
pallet_staking::migrations::v12::MigrateToV12<Runtime>,
pallet_staking::migrations::v13::MigrateToV13<Runtime>,
pallet_grandpa::migrations::CleanupSetIdSessionMap<Runtime>,
pallet_election_provider_multi_phase::migrations::v1::MigrateToV1<Runtime>,
pallet_scheduler::migration::v4::CleanupAgendas<Runtime>,
pallet_multisig::migrations::v1::MigrateToV1<Runtime>,
MigrateBountyToV4<Runtime>,
pallet_preimage::migration::v1::Migration<Runtime>,
),
>;
pub struct StakingMigrationV11OldPallet;
impl Get<&'static str> for StakingMigrationV11OldPallet {
fn get() -> &'static str {
"BagsList"
}
}
pub struct MigrateStakingToV8<T>(sp_std::marker::PhantomData<T>);
impl<T: pallet_staking::Config> frame_support::traits::OnRuntimeUpgrade for MigrateStakingToV8<T> {
fn on_runtime_upgrade() -> Weight {
pallet_staking::migrations::v8::migrate::<T>()
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, &'static str> {
pallet_staking::migrations::v8::pre_migrate::<T>()?;
Ok(Vec::new())
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: Vec<u8>) -> Result<(), &'static str> {
pallet_staking::migrations::v8::post_migrate::<T>()
}
}
pub struct MigrateBountyToV4<T>(sp_std::marker::PhantomData<T>);
impl<T: pallet_bounties::Config> frame_support::traits::OnRuntimeUpgrade for MigrateBountyToV4<T> {
fn on_runtime_upgrade() -> Weight {
pallet_bounties::migrations::v4::migrate::<T, Bounties, &str>("bounties", "bounties")
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, &'static str> {
pallet_bounties::migrations::v4::pre_migration::<T, Bounties, &str>("bounties", "bounties");
Ok(Vec::new())
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: Vec<u8>) -> Result<(), &'static str> {
pallet_bounties::migrations::v4::post_migration::<T, Bounties, &str>("bounties", "bounties");
Ok(())
}
}