From d8aabf0c324209e4399979dac88301e19f85459f Mon Sep 17 00:00:00 2001 From: Joshy Orndorff Date: Fri, 7 Aug 2020 15:52:15 -0400 Subject: [PATCH] Separate ParachainId injection to its own pallet (#183) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Separate paraid injection to own pallet * Move token dealer to a crate * Move to rococo-parachains * Remove parameter_types hack * Fix chainspec * fix build * remove commented code * Update contracts runtime to match other runtime * Apply suggestions from code review Co-authored-by: Bastian Köcher * Alphebetize workspace members * Parachain info to own crate * prune system = frame_system Co-authored-by: Ricardo Rius Co-authored-by: Bastian Köcher --- cumulus/Cargo.lock | 27 +++ cumulus/Cargo.toml | 8 +- cumulus/message-broker/src/lib.rs | 2 +- .../contracts-runtime/Cargo.toml | 5 + .../contracts-runtime/src/lib.rs | 17 +- .../pallets/parachain-info/Cargo.toml | 24 +++ .../pallets/parachain-info/src/lib.rs | 42 ++++ .../pallets/token-dealer/Cargo.toml | 29 +++ .../token-dealer/src/lib.rs} | 28 +-- cumulus/rococo-parachains/runtime/Cargo.toml | 6 +- cumulus/rococo-parachains/runtime/src/lib.rs | 18 +- .../runtime/src/message_example.rs | 179 ------------------ cumulus/rococo-parachains/src/chain_spec.rs | 4 +- 13 files changed, 165 insertions(+), 224 deletions(-) create mode 100644 cumulus/rococo-parachains/pallets/parachain-info/Cargo.toml create mode 100644 cumulus/rococo-parachains/pallets/parachain-info/src/lib.rs create mode 100644 cumulus/rococo-parachains/pallets/token-dealer/Cargo.toml rename cumulus/rococo-parachains/{contracts-runtime/src/message_example.rs => pallets/token-dealer/src/lib.rs} (89%) delete mode 100644 cumulus/rococo-parachains/runtime/src/message_example.rs diff --git a/cumulus/Cargo.lock b/cumulus/Cargo.lock index 05879ba38f..4957a83faa 100644 --- a/cumulus/Cargo.lock +++ b/cumulus/Cargo.lock @@ -961,6 +961,7 @@ dependencies = [ "cumulus-parachain-upgrade", "cumulus-primitives", "cumulus-runtime", + "cumulus-token-dealer", "cumulus-upward-message", "frame-executive", "frame-support", @@ -973,6 +974,7 @@ dependencies = [ "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", + "parachain-info", "parity-scale-codec", "polkadot-parachain", "serde", @@ -1114,6 +1116,7 @@ dependencies = [ "cumulus-parachain-upgrade", "cumulus-primitives", "cumulus-runtime", + "cumulus-token-dealer", "cumulus-upward-message", "frame-executive", "frame-support", @@ -1123,6 +1126,7 @@ dependencies = [ "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", + "parachain-info", "parity-scale-codec", "polkadot-parachain", "serde", @@ -1149,6 +1153,18 @@ dependencies = [ "substrate-wasm-builder-runner 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "cumulus-token-dealer" +version = "0.1.0" +dependencies = [ + "cumulus-primitives", + "cumulus-upward-message", + "frame-support", + "frame-system", + "parity-scale-codec", + "polkadot-parachain", +] + [[package]] name = "cumulus-upward-message" version = "0.1.0" @@ -4223,6 +4239,17 @@ dependencies = [ "sp-std", ] +[[package]] +name = "parachain-info" +version = "0.1.0" +dependencies = [ + "cumulus-primitives", + "frame-support", + "frame-system", + "parity-scale-codec", + "serde", +] + [[package]] name = "parity-db" version = "0.1.2" diff --git a/cumulus/Cargo.toml b/cumulus/Cargo.toml index f3d8252a88..a10eacf7ae 100644 --- a/cumulus/Cargo.toml +++ b/cumulus/Cargo.toml @@ -5,12 +5,14 @@ members = [ "network", "parachain-upgrade", "primitives", + "rococo-parachains/", + "rococo-parachains/contracts-runtime", + "rococo-parachains/pallets/parachain-info", + "rococo-parachains/pallets/token-dealer", + "rococo-parachains/runtime", "runtime", "test/runtime", "test/client", - "rococo-parachains", - "rococo-parachains/runtime", - "rococo-parachains/contracts-runtime", "upward-message", ] diff --git a/cumulus/message-broker/src/lib.rs b/cumulus/message-broker/src/lib.rs index 66420718f2..f9e7a7c5f7 100644 --- a/cumulus/message-broker/src/lib.rs +++ b/cumulus/message-broker/src/lib.rs @@ -71,7 +71,7 @@ decl_event! { } decl_module! { - pub struct Module for enum Call where origin: T::Origin, system = frame_system { + pub struct Module for enum Call where origin: T::Origin { /// Executes the given downward messages by calling the message handlers. /// /// The origin of this call needs to be `None` as this is an inherent. diff --git a/cumulus/rococo-parachains/contracts-runtime/Cargo.toml b/cumulus/rococo-parachains/contracts-runtime/Cargo.toml index f05e2d1df5..7d7e67e6d1 100644 --- a/cumulus/rococo-parachains/contracts-runtime/Cargo.toml +++ b/cumulus/rococo-parachains/contracts-runtime/Cargo.toml @@ -8,6 +8,9 @@ edition = '2018' serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +cumulus-token-dealer = { path = "../pallets/token-dealer", default-features = false} +parachain-info = { path = "../pallets/parachain-info", default-features = false} + # Substrate dependencies sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" } sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" } @@ -75,12 +78,14 @@ std = [ "pallet-timestamp/std", "pallet-sudo/std", "pallet-transaction-payment/std", + "parachain-info/std", "cumulus-runtime/std", "cumulus-parachain-upgrade/std", "cumulus-message-broker/std", "cumulus-upward-message/std", "cumulus-primitives/std", "polkadot-parachain/std", + "cumulus-token-dealer/std", ] # Will be enabled by the `wasm-builder` when building the runtime for WASM. runtime-wasm = [ diff --git a/cumulus/rococo-parachains/contracts-runtime/src/lib.rs b/cumulus/rococo-parachains/contracts-runtime/src/lib.rs index 1819f556b8..524573a585 100644 --- a/cumulus/rococo-parachains/contracts-runtime/src/lib.rs +++ b/cumulus/rococo-parachains/contracts-runtime/src/lib.rs @@ -36,8 +36,6 @@ use sp_std::prelude::*; use sp_version::NativeVersion; use sp_version::RuntimeVersion; -mod message_example; - // A few exports that help ease life for downstream crates. pub use frame_support::{ construct_runtime, parameter_types, @@ -244,20 +242,16 @@ impl cumulus_parachain_upgrade::Trait for Runtime { type OnValidationFunctionParams = (); } -parameter_types! { - pub storage ParachainId: cumulus_primitives::ParaId = 100.into(); -} - impl cumulus_message_broker::Trait for Runtime { type Event = Event; type DownwardMessageHandlers = TokenDealer; type UpwardMessage = cumulus_upward_message::RococoUpwardMessage; - type ParachainId = ParachainId; - type XCMPMessage = XCMPMessage; + type ParachainId = ParachainInfo; + type XCMPMessage = cumulus_token_dealer::XCMPMessage; type XCMPMessageHandlers = TokenDealer; } -impl message_example::Trait for Runtime { +impl cumulus_token_dealer::Trait for Runtime { type Event = Event; type UpwardMessageSender = MessageBroker; type UpwardMessage = cumulus_upward_message::RococoUpwardMessage; @@ -265,6 +259,8 @@ impl message_example::Trait for Runtime { type XCMPMessageSender = MessageBroker; } +impl parachain_info::Trait for Runtime {} + // We disable the rent system for easier testing. parameter_types! { pub const TombstoneDeposit: Balance = 0; @@ -307,8 +303,9 @@ construct_runtime! { RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage}, ParachainUpgrade: cumulus_parachain_upgrade::{Module, Call, Storage, Inherent, Event}, MessageBroker: cumulus_message_broker::{Module, Call, Inherent, Event}, - TokenDealer: message_example::{Module, Call, Event, Config}, + TokenDealer: cumulus_token_dealer::{Module, Call, Event}, TransactionPayment: pallet_transaction_payment::{Module, Storage}, + ParachainInfo: parachain_info::{Module, Storage, Config}, } } diff --git a/cumulus/rococo-parachains/pallets/parachain-info/Cargo.toml b/cumulus/rococo-parachains/pallets/parachain-info/Cargo.toml new file mode 100644 index 0000000000..c70c786d3b --- /dev/null +++ b/cumulus/rococo-parachains/pallets/parachain-info/Cargo.toml @@ -0,0 +1,24 @@ +[package] +authors = ["Parity Technologies "] +edition = "2018" +name = "parachain-info" +version = "0.1.0" + +[dependencies] +codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +serde = { version = "1.0.101", optional = true, features = ["derive"] } + +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" } + +cumulus-primitives = { path = "../../../primitives", default-features = false } + +[features] +default = ["std"] +std = [ + "codec/std", + "serde", + "cumulus-primitives/std", + "frame-support/std", + "frame-system/std", +] diff --git a/cumulus/rococo-parachains/pallets/parachain-info/src/lib.rs b/cumulus/rococo-parachains/pallets/parachain-info/src/lib.rs new file mode 100644 index 0000000000..56acde48df --- /dev/null +++ b/cumulus/rococo-parachains/pallets/parachain-info/src/lib.rs @@ -0,0 +1,42 @@ +// Copyright 2020 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Minimal Pallet that injects a ParachainId into Runtime storage from + +#![cfg_attr(not(feature = "std"), no_std)] + +use frame_support::{decl_module, decl_storage, traits::Get}; + +use cumulus_primitives::ParaId; + +/// Configuration trait of this pallet. +pub trait Trait: frame_system::Trait {} + +impl Get for Module { + fn get() -> ParaId { + Self::parachain_id() + } +} + +decl_storage! { + trait Store for Module as ParachainUpgrade { + ParachainId get(fn parachain_id) config(): ParaId = 100.into(); + } +} + +decl_module! { + pub struct Module for enum Call where origin: T::Origin {} +} diff --git a/cumulus/rococo-parachains/pallets/token-dealer/Cargo.toml b/cumulus/rococo-parachains/pallets/token-dealer/Cargo.toml new file mode 100644 index 0000000000..178bf1fadf --- /dev/null +++ b/cumulus/rococo-parachains/pallets/token-dealer/Cargo.toml @@ -0,0 +1,29 @@ +[package] +authors = ["Parity Technologies "] +edition = "2018" +name = "cumulus-token-dealer" +version = "0.1.0" + +[dependencies] +codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } + +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" } + +# Cumulus dependencies +cumulus-upward-message = { path = "../../../upward-message", default-features = false } +cumulus-primitives = { path = "../../../primitives", default-features = false } + +# Polkadot dependencies +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch", default-features = false } + +[features] +default = ["std"] +std = [ + "codec/std", + "cumulus-upward-message/std", + "cumulus-primitives/std", + "frame-support/std", + "frame-system/std", + "polkadot-parachain/std", +] diff --git a/cumulus/rococo-parachains/contracts-runtime/src/message_example.rs b/cumulus/rococo-parachains/pallets/token-dealer/src/lib.rs similarity index 89% rename from cumulus/rococo-parachains/contracts-runtime/src/message_example.rs rename to cumulus/rococo-parachains/pallets/token-dealer/src/lib.rs index 42a475be20..ee05fd1538 100644 --- a/cumulus/rococo-parachains/contracts-runtime/src/message_example.rs +++ b/cumulus/rococo-parachains/pallets/token-dealer/src/lib.rs @@ -14,16 +14,14 @@ // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . -//! Example Pallet that shows how to send upward messages and how to receive -//! downward messages. +#![cfg_attr(not(feature = "std"), no_std)] use frame_support::{ - decl_event, decl_module, decl_storage, + decl_event, decl_module, dispatch::DispatchResult, traits::{Currency, ExistenceRequirement, WithdrawReason}, }; use frame_system::ensure_signed; -use crate::XCMPMessage; use codec::{Decode, Encode}; use cumulus_primitives::{ relay_chain::DownwardMessage, @@ -32,7 +30,12 @@ use cumulus_primitives::{ }; use cumulus_upward_message::BalancesMessage; use polkadot_parachain::primitives::AccountIdConversion; -use sp_runtime::DispatchResult; + +#[derive(Encode, Decode)] +pub enum XCMPMessage { + /// Transfer tokens to the given account from the Parachain account. + TransferToken(XAccountId, XBalance), +} type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; @@ -55,19 +58,6 @@ pub trait Trait: frame_system::Trait { type XCMPMessageSender: XCMPMessageSender>>; } -// This pallet's storage items. -decl_storage! { - trait Store for Module as ParachainUpgrade {} - add_extra_genesis { - config(parachain_id): ParaId; - build(|config: &Self| { - // This is basically a hack to make the parachain id easily configurable. - // Could also be done differently, but yeah.. - crate::ParachainId::set(&config.parachain_id); - }); - } -} - decl_event! { pub enum Event where AccountId = ::AccountId, @@ -83,7 +73,7 @@ decl_event! { } decl_module! { - pub struct Module for enum Call where origin: T::Origin, system = frame_system { + pub struct Module for enum Call where origin: T::Origin { /// Transfer `amount` of tokens on the relay chain from the Parachain account to /// the given `dest` account. #[weight = 10] diff --git a/cumulus/rococo-parachains/runtime/Cargo.toml b/cumulus/rococo-parachains/runtime/Cargo.toml index ed0d308ea8..f588969235 100644 --- a/cumulus/rococo-parachains/runtime/Cargo.toml +++ b/cumulus/rococo-parachains/runtime/Cargo.toml @@ -8,6 +8,9 @@ edition = '2018' serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +cumulus-token-dealer = { path = "../pallets/token-dealer", default-features = false} +parachain-info = { path = "../pallets/parachain-info", default-features = false} + # Substrate dependencies sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" } sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" } @@ -67,12 +70,13 @@ std = [ "pallet-timestamp/std", "pallet-sudo/std", "pallet-transaction-payment/std", + "parachain-info/std", "cumulus-runtime/std", "cumulus-parachain-upgrade/std", "cumulus-message-broker/std", "cumulus-upward-message/std", "cumulus-primitives/std", - "polkadot-parachain/std", + "cumulus-token-dealer/std", ] # Will be enabled by the `wasm-builder` when building the runtime for WASM. runtime-wasm = [ diff --git a/cumulus/rococo-parachains/runtime/src/lib.rs b/cumulus/rococo-parachains/runtime/src/lib.rs index 73b0bf70e7..e707771dd1 100644 --- a/cumulus/rococo-parachains/runtime/src/lib.rs +++ b/cumulus/rococo-parachains/runtime/src/lib.rs @@ -35,7 +35,8 @@ use sp_std::prelude::*; use sp_version::NativeVersion; use sp_version::RuntimeVersion; -mod message_example; +/// Import the token dealer pallet. +pub use cumulus_token_dealer; // A few exports that help ease life for downstream crates. pub use frame_support::{ @@ -243,20 +244,16 @@ impl cumulus_parachain_upgrade::Trait for Runtime { type OnValidationFunctionParams = (); } -parameter_types! { - pub storage ParachainId: cumulus_primitives::ParaId = 100.into(); -} - impl cumulus_message_broker::Trait for Runtime { type Event = Event; type DownwardMessageHandlers = TokenDealer; type UpwardMessage = cumulus_upward_message::RococoUpwardMessage; - type ParachainId = ParachainId; - type XCMPMessage = XCMPMessage; + type ParachainId = ParachainInfo; + type XCMPMessage = cumulus_token_dealer::XCMPMessage; type XCMPMessageHandlers = TokenDealer; } -impl message_example::Trait for Runtime { +impl cumulus_token_dealer::Trait for Runtime { type Event = Event; type UpwardMessageSender = MessageBroker; type UpwardMessage = cumulus_upward_message::RococoUpwardMessage; @@ -264,6 +261,8 @@ impl message_example::Trait for Runtime { type XCMPMessageSender = MessageBroker; } +impl parachain_info::Trait for Runtime {} + construct_runtime! { pub enum Runtime where Block = Block, @@ -277,8 +276,9 @@ construct_runtime! { RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage}, ParachainUpgrade: cumulus_parachain_upgrade::{Module, Call, Storage, Inherent, Event}, MessageBroker: cumulus_message_broker::{Module, Call, Inherent, Event}, - TokenDealer: message_example::{Module, Call, Event, Config}, + TokenDealer: cumulus_token_dealer::{Module, Call, Event}, TransactionPayment: pallet_transaction_payment::{Module, Storage}, + ParachainInfo: parachain_info::{Module, Storage, Config}, } } diff --git a/cumulus/rococo-parachains/runtime/src/message_example.rs b/cumulus/rococo-parachains/runtime/src/message_example.rs deleted file mode 100644 index 42a475be20..0000000000 --- a/cumulus/rococo-parachains/runtime/src/message_example.rs +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright 2020 Parity Technologies (UK) Ltd. -// This file is part of Cumulus. - -// Cumulus 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. - -// Cumulus 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 Cumulus. If not, see . - -//! Example Pallet that shows how to send upward messages and how to receive -//! downward messages. - -use frame_support::{ - decl_event, decl_module, decl_storage, - traits::{Currency, ExistenceRequirement, WithdrawReason}, -}; -use frame_system::ensure_signed; - -use crate::XCMPMessage; -use codec::{Decode, Encode}; -use cumulus_primitives::{ - relay_chain::DownwardMessage, - xcmp::{XCMPMessageHandler, XCMPMessageSender}, - DownwardMessageHandler, ParaId, UpwardMessageOrigin, UpwardMessageSender, -}; -use cumulus_upward_message::BalancesMessage; -use polkadot_parachain::primitives::AccountIdConversion; -use sp_runtime::DispatchResult; - -type BalanceOf = - <::Currency as Currency<::AccountId>>::Balance; - -/// Configuration trait of this pallet. -pub trait Trait: frame_system::Trait { - /// Event type used by the runtime. - type Event: From> + Into<::Event>; - - /// The sender of upward messages. - type UpwardMessageSender: UpwardMessageSender; - - /// The upward message type used by the Parachain runtime. - type UpwardMessage: codec::Codec + BalancesMessage>; - - /// Currency of the runtime. - type Currency: Currency; - - /// The sender of XCMP messages. - type XCMPMessageSender: XCMPMessageSender>>; -} - -// This pallet's storage items. -decl_storage! { - trait Store for Module as ParachainUpgrade {} - add_extra_genesis { - config(parachain_id): ParaId; - build(|config: &Self| { - // This is basically a hack to make the parachain id easily configurable. - // Could also be done differently, but yeah.. - crate::ParachainId::set(&config.parachain_id); - }); - } -} - -decl_event! { - pub enum Event where - AccountId = ::AccountId, - Balance = BalanceOf - { - /// Transferred tokens to the account on the relay chain. - TransferredTokensToRelayChain(AccountId, Balance), - /// Transferred tokens to the account on request from the relay chain. - TransferredTokensFromRelayChain(AccountId, Balance), - /// Transferred tokens to the account from the given parachain account. - TransferredTokensViaXCMP(ParaId, AccountId, Balance, DispatchResult), - } -} - -decl_module! { - pub struct Module for enum Call where origin: T::Origin, system = frame_system { - /// Transfer `amount` of tokens on the relay chain from the Parachain account to - /// the given `dest` account. - #[weight = 10] - fn transfer_tokens_to_relay_chain(origin, dest: T::AccountId, amount: BalanceOf) { - let who = ensure_signed(origin)?; - - let _ = T::Currency::withdraw( - &who, - amount, - WithdrawReason::Transfer.into(), - ExistenceRequirement::AllowDeath, - )?; - - let msg = ::UpwardMessage::transfer(dest.clone(), amount.clone()); - ::UpwardMessageSender::send_upward_message(&msg, UpwardMessageOrigin::Signed) - .expect("Should not fail; qed"); - - Self::deposit_event(Event::::TransferredTokensToRelayChain(dest, amount)); - } - - /// Transfer `amount` of tokens to another parachain. - #[weight = 10] - fn transfer_tokens_to_parachain_chain( - origin, - para_id: u32, - dest: T::AccountId, - amount: BalanceOf, - ) { - //TODO we don't make sure that the parachain has some tokens on the other parachain. - let who = ensure_signed(origin)?; - - let _ = T::Currency::withdraw( - &who, - amount, - WithdrawReason::Transfer.into(), - ExistenceRequirement::AllowDeath, - )?; - - T::XCMPMessageSender::send_xcmp_message( - para_id.into(), - &XCMPMessage::TransferToken(dest, amount), - ).expect("Should not fail; qed"); - } - - fn deposit_event() = default; - } -} - -/// This is a hack to convert from one generic type to another where we are sure that both are the -/// same type/use the same encoding. -fn convert_hack(input: &impl Encode) -> O { - input.using_encoded(|e| Decode::decode(&mut &e[..]).expect("Must be compatible; qed")) -} - -impl DownwardMessageHandler for Module { - fn handle_downward_message(msg: &DownwardMessage) { - match msg { - DownwardMessage::TransferInto(dest, amount, _) => { - let dest = convert_hack(&dest); - let amount: BalanceOf = convert_hack(amount); - - let _ = T::Currency::deposit_creating(&dest, amount.clone()); - - Self::deposit_event(Event::::TransferredTokensFromRelayChain(dest, amount)); - } - _ => {} - } - } -} - -impl XCMPMessageHandler>> for Module { - fn handle_xcmp_message(src: ParaId, msg: &XCMPMessage>) { - match msg { - XCMPMessage::TransferToken(dest, amount) => { - let para_account = src.clone().into_account(); - - let res = T::Currency::transfer( - ¶_account, - dest, - amount.clone(), - ExistenceRequirement::AllowDeath, - ); - - Self::deposit_event(Event::::TransferredTokensViaXCMP( - src, - dest.clone(), - amount.clone(), - res, - )); - } - } - } -} diff --git a/cumulus/rococo-parachains/src/chain_spec.rs b/cumulus/rococo-parachains/src/chain_spec.rs index 19a3223171..d8305029b8 100644 --- a/cumulus/rococo-parachains/src/chain_spec.rs +++ b/cumulus/rococo-parachains/src/chain_spec.rs @@ -17,7 +17,7 @@ use cumulus_primitives::ParaId; use parachain_runtime::{ AccountId, BalancesConfig, GenesisConfig, Signature, SudoConfig, SystemConfig, - TokenDealerConfig, WASM_BINARY, + ParachainInfoConfig, WASM_BINARY, }; use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; use sc_service::ChainType; @@ -140,7 +140,7 @@ fn testnet_genesis( .collect(), }), pallet_sudo: Some(SudoConfig { key: root_key }), - message_example: Some(TokenDealerConfig { parachain_id: id }), + parachain_info: Some(ParachainInfoConfig { parachain_id: id }), // TODO: add contracts genesis for the contracts runtime // pallet_contracts: Some(parachain_runtime::ContractsConfig { current_schedule: Default::default() }), }