Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion runtime/common/src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use sp_std::prelude::*;
use sp_io::{hashing::keccak_256, crypto::secp256k1_ecdsa_recover};
use frame_support::{decl_event, decl_storage, decl_module, decl_error};
use frame_support::weights::SimpleDispatchInfo;
use frame_support::weights::{SimpleDispatchInfo, Weight, WeighData};
use frame_support::traits::{Currency, Get, VestingSchedule};
use system::{ensure_root, ensure_none};
use codec::{Encode, Decode};
Expand Down Expand Up @@ -142,6 +142,18 @@ decl_storage! {
}
}

mod migration {
use super::*;

pub fn migrate<T: Trait>() {
if let Ok(addresses) = Vec::<EthereumAddress>::decode(&mut &include_bytes!("./claims.scale")[..]) {
for i in &addresses {
Claims::<T>::migrate_key_from_blake(i);
}
}
}
}

decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
type Error = Error<T>;
Expand All @@ -152,6 +164,11 @@ decl_module! {
/// Deposit one of this module's events by using the default implementation.
fn deposit_event() = default;

fn on_runtime_upgrade() -> Weight {
migration::migrate::<T>();
SimpleDispatchInfo::default().weigh_data(())
}

/// Make a claim to collect your DOTs.
///
/// The dispatch origin for this call must be _None_.
Expand Down
Binary file added runtime/common/src/claims.scale
Binary file not shown.
4 changes: 2 additions & 2 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("kusama"),
impl_name: create_runtime_str!("parity-kusama"),
authoring_version: 2,
spec_version: 1057,
impl_version: 1,
spec_version: 1058,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
};

Expand Down