diff --git a/bin/node/cli/src/chain_spec.rs b/bin/node/cli/src/chain_spec.rs index ed323cd52e..50d5d0da90 100644 --- a/bin/node/cli/src/chain_spec.rs +++ b/bin/node/cli/src/chain_spec.rs @@ -325,7 +325,7 @@ fn pangolin_build_spec_genesis() -> pangolin_runtime::GenesisConfig { darwinia_vesting: Default::default(), pallet_sudo: pangolin_runtime::SudoConfig { key: root.clone() }, darwinia_crab_issuing: pangolin_runtime::DarwiniaCrabIssuingConfig { total_mapped_ring: BUNCH_OF_COINS }, - darwinia_crab_backing: pangolin_runtime::CrabBackingConfig { backed_ring: BUNCH_OF_COINS }, + darwinia_crab_backing: pangolin_runtime::DarwiniaCrabBackingConfig { backed_ring: BUNCH_OF_COINS }, darwinia_ethereum_relay: pangolin_runtime::EthereumRelayConfig { genesis_header_info: ( vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 232, 31, 23, 27, 204, 85, 166, 255, 131, 69, 230, 146, 192, 248, 110, 91, 72, 224, 27, 153, 108, 173, 192, 1, 98, 47, 181, 227, 99, 180, 33, 29, 204, 77, 232, 222, 199, 93, 122, 171, 133, 181, 103, 182, 204, 212, 26, 211, 18, 69, 27, 148, 138, 116, 19, 240, 161, 66, 253, 64, 212, 147, 71, 128, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 33, 123, 11, 188, 251, 114, 226, 213, 126, 40, 243, 60, 179, 97, 185, 152, 53, 19, 23, 119, 85, 220, 63, 51, 206, 62, 112, 34, 237, 98, 183, 123, 86, 232, 31, 23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 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 132, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 136, 0, 0, 0, 0, 0, 0, 0, 66, 1, 65, 148, 16, 35, 104, 9, 35, 224, 254, 77, 116, 163, 75, 218, 200, 20, 31, 37, 64, 227, 174, 144, 98, 55, 24, 228, 125, 102, 209, 202, 74, 45], @@ -478,7 +478,7 @@ fn pangolin_development_genesis() -> pangolin_runtime::GenesisConfig { darwinia_vesting: Default::default(), pallet_sudo: pangolin_runtime::SudoConfig { key: root.clone() }, darwinia_crab_issuing: pangolin_runtime::DarwiniaCrabIssuingConfig { total_mapped_ring: BUNCH_OF_COINS }, - darwinia_crab_backing: pangolin_runtime::CrabBackingConfig { backed_ring: BUNCH_OF_COINS }, + darwinia_crab_backing: pangolin_runtime::DarwiniaCrabBackingConfig { backed_ring: BUNCH_OF_COINS }, darwinia_ethereum_relay: pangolin_runtime::EthereumRelayConfig { genesis_header_info: ( vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 232, 31, 23, 27, 204, 85, 166, 255, 131, 69, 230, 146, 192, 248, 110, 91, 72, 224, 27, 153, 108, 173, 192, 1, 98, 47, 181, 227, 99, 180, 33, 29, 204, 77, 232, 222, 199, 93, 122, 171, 133, 181, 103, 182, 204, 212, 26, 211, 18, 69, 27, 148, 138, 116, 19, 240, 161, 66, 253, 64, 212, 147, 71, 128, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 33, 123, 11, 188, 251, 114, 226, 213, 126, 40, 243, 60, 179, 97, 185, 152, 53, 19, 23, 119, 85, 220, 63, 51, 206, 62, 112, 34, 237, 98, 183, 123, 86, 232, 31, 23, 27, 204, 85, 166, 255, 131, 69, 230, 146, 192, 248, 110, 91, 72, 224, 27, 153, 108, 173, 192, 1, 98, 47, 181, 227, 99, 180, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 132, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 136, 0, 0, 0, 0, 0, 0, 0, 66, 1, 65, 148, 16, 35, 104, 9, 35, 224, 254, 77, 116, 163, 75, 218, 200, 20, 31, 37, 64, 227, 174, 144, 98, 55, 24, 228, 125, 102, 209, 202, 74, 45], diff --git a/bin/node/runtime/pangolin/src/lib.rs b/bin/node/runtime/pangolin/src/lib.rs index 04c5bda3b9..99ba231171 100644 --- a/bin/node/runtime/pangolin/src/lib.rs +++ b/bin/node/runtime/pangolin/src/lib.rs @@ -488,7 +488,7 @@ frame_support::construct_runtime! { Multisig: pallet_multisig::{Pallet, Call, Storage, Event} = 32, DarwiniaCrabIssuing: darwinia_crab_issuing::{Pallet, Call, Storage, Config, Event} = 33, - CrabBacking: darwinia_crab_backing::{Pallet, Storage, Config} = 34, + DarwiniaCrabBacking: darwinia_crab_backing::{Pallet, Storage, Config} = 34, EthereumRelay: darwinia_ethereum_relay::{Pallet, Call, Storage, Config, Event} = 35, EthereumBacking: darwinia_ethereum_backing::{Pallet, Call, Storage, Config, Event} = 36, diff --git a/frame/bridge/crab/backing/src/lib.rs b/frame/bridge/crab/backing/src/lib.rs index ad0a951d6c..743230b7e7 100644 --- a/frame/bridge/crab/backing/src/lib.rs +++ b/frame/bridge/crab/backing/src/lib.rs @@ -21,65 +21,69 @@ #![cfg_attr(not(feature = "std"), no_std)] pub mod weights; -// --- darwinia --- -pub use weights::WeightInfo; - -mod types { - // --- darwinia --- - #[cfg(feature = "std")] - use crate::*; - - pub type AccountId = ::AccountId; - - #[cfg(feature = "std")] - pub type RingBalance = as Currency>>::Balance; - - #[cfg(feature = "std")] - type RingCurrency = ::RingCurrency; -} -// --- substrate --- -use frame_support::{ - decl_module, decl_storage, - traits::{Currency, Get}, -}; -use sp_runtime::{traits::AccountIdConversion, ModuleId}; -// --- darwinia --- -use types::*; +pub use pallet::*; +pub use weights::WeightInfo; -pub trait Config: frame_system::Config { - type ModuleId: Get; +#[frame_support::pallet] +pub mod pallet { + pub mod types { + // --- darwinia --- + use super::*; - type RingCurrency: Currency>; + // Generic types + pub type AccountId = ::AccountId; + pub type RingBalance = as Currency>>::Balance; + type RingCurrency = ::RingCurrency; + } + pub use types::*; - type WeightInfo: WeightInfo; -} + // --- substrate --- + use frame_support::{ + pallet_prelude::*, + traits::{Currency, Get}, + }; + use frame_system::pallet_prelude::*; + use sp_runtime::{traits::AccountIdConversion, ModuleId}; + // --- darwinia --- + use crate::weights::WeightInfo; -decl_storage! { - trait Store for Module as DarwiniaCrabBacking {} + #[pallet::config] + pub trait Config: frame_system::Config { + // --- substrate --- + type WeightInfo: WeightInfo; + // --- darwinia --- + #[pallet::constant] + type ModuleId: Get; + type RingCurrency: Currency>; + } - add_extra_genesis { - config(backed_ring): RingBalance; - build(|config| { + #[pallet::genesis_config] + pub struct GenesisConfig { + pub backed_ring: RingBalance, + } + #[cfg(feature = "std")] + impl Default for GenesisConfig { + fn default() -> Self { + Self { + backed_ring: Default::default(), + } + } + } + #[pallet::genesis_build] + impl GenesisBuild for GenesisConfig { + fn build(&self) { let _ = T::RingCurrency::make_free_balance_be( - &>::account_id(), - T::RingCurrency::minimum_balance() + config.backed_ring + &T::ModuleId::get().into_account(), + T::RingCurrency::minimum_balance() + self.backed_ring, ); - }); + } } -} -decl_module! { - pub struct Module for enum Call - where - origin: T::Origin - { - const ModuleId: ModuleId = T::ModuleId::get(); - } -} - -impl Module { - pub fn account_id() -> T::AccountId { - T::ModuleId::get().into_account() - } + #[pallet::pallet] + pub struct Pallet(_); + #[pallet::hooks] + impl Hooks> for Pallet {} + #[pallet::call] + impl Pallet {} }