diff --git a/Cargo.lock b/Cargo.lock index 3aba953a92ea6..13220335f14be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3384,7 +3384,6 @@ dependencies = [ "pallet-staking", "pallet-staking-reward-curve", "pallet-sudo", - "pallet-template", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", @@ -4121,18 +4120,6 @@ dependencies = [ "sp-std", ] -[[package]] -name = "pallet-template" -version = "2.0.0" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec", - "sp-core", - "sp-io", - "sp-runtime", -] - [[package]] name = "pallet-timestamp" version = "2.0.0" diff --git a/client/block-builder/src/lib.rs b/client/block-builder/src/lib.rs index ac4b199d4c4f6..41a2485623793 100644 --- a/client/block-builder/src/lib.rs +++ b/client/block-builder/src/lib.rs @@ -1,6 +1,7 @@ // This file is part of Substrate. // Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// Copyright (C) 2020 Mangata team // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/client/service/src/client/client.rs b/client/service/src/client/client.rs index c78244afaaea6..5727904c3c229 100644 --- a/client/service/src/client/client.rs +++ b/client/service/src/client/client.rs @@ -1,6 +1,7 @@ // This file is part of Substrate. // Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// Copyright (C) 2020 Mangata team // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 750e434dcdec2..53e0d240e4855 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -1,3 +1,5 @@ +// Copyright (C) 2020 Mangata team + use sp_core::{Pair, Public, sr25519}; use mangata_runtime::{ AccountId, BabeConfig, BalancesConfig, GenesisConfig, GrandpaConfig, SessionConfig, diff --git a/node/src/cli.rs b/node/src/cli.rs index f2faf17e4ddf4..9f6939b4b913b 100644 --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -1,3 +1,5 @@ +// Copyright (C) 2020 Mangata team + use structopt::StructOpt; use sc_cli::RunCmd; diff --git a/node/src/command.rs b/node/src/command.rs index a0580d307d9a7..19c7fc9b44d08 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -1,6 +1,7 @@ // This file is part of Substrate. // Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// Copyright (C) 2020 Mangata team // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/node/src/service.rs b/node/src/service.rs index 4ae1f1e5d3097..83c47838409eb 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -1,3 +1,5 @@ +// Copyright (C) 2020 Mangata team + //! Service and ServiceFactory implementation. Specialized wrapper over substrate service. use std::sync::Arc; diff --git a/pallets/assets-info/src/lib.rs b/pallets/assets-info/src/lib.rs index 1309e536e1715..3a2c5064dbcb6 100644 --- a/pallets/assets-info/src/lib.rs +++ b/pallets/assets-info/src/lib.rs @@ -1,3 +1,5 @@ +// Copyright (C) 2020 Mangata team + #![cfg_attr(not(feature = "std"), no_std)] /// Edit this file to define custom logic or remove it if it is not needed. diff --git a/pallets/assets-info/src/mock.rs b/pallets/assets-info/src/mock.rs index a9f00eeb02649..71155e3e7b396 100644 --- a/pallets/assets-info/src/mock.rs +++ b/pallets/assets-info/src/mock.rs @@ -1,3 +1,5 @@ +// Copyright (C) 2020 Mangata team + use crate::{Module, Trait}; use sp_core::H256; use frame_support::{impl_outer_origin, parameter_types, weights::Weight}; diff --git a/pallets/assets-info/src/tests.rs b/pallets/assets-info/src/tests.rs index 79c3fb73c6f45..fea7878a0ab69 100644 --- a/pallets/assets-info/src/tests.rs +++ b/pallets/assets-info/src/tests.rs @@ -1,3 +1,5 @@ +// Copyright (C) 2020 Mangata team + use crate::{mock::*, AssetInfo, Error}; use frame_support::{assert_noop, assert_ok}; diff --git a/pallets/assets/src/lib.rs b/pallets/assets/src/lib.rs index f95679738e160..29858b6b6e785 100644 --- a/pallets/assets/src/lib.rs +++ b/pallets/assets/src/lib.rs @@ -1,6 +1,7 @@ // This file is part of Substrate. // Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// Copyright (C) 2020 Mangata team // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/pallets/bridged-asset/src/lib.rs b/pallets/bridged-asset/src/lib.rs index ff1a9477fe872..2c18bd4c2a275 100644 --- a/pallets/bridged-asset/src/lib.rs +++ b/pallets/bridged-asset/src/lib.rs @@ -1,3 +1,6 @@ +// Copyright (C) 2020 Mangata team +// Based on Snowfork bridge implementation + //! # Asset //! //! The asset module provides functionality for handling bridged asset balances. diff --git a/pallets/erc20-app/src/lib.rs b/pallets/erc20-app/src/lib.rs index 3cb8081c0f1cb..a54673832725c 100644 --- a/pallets/erc20-app/src/lib.rs +++ b/pallets/erc20-app/src/lib.rs @@ -1,3 +1,5 @@ +// Copyright (C) 2020 Mangata team +// Based on Snowfork bridge implementation //! # ERC20 //! //! An application that implements bridged ERC20 token assets. diff --git a/pallets/eth-app/src/lib.rs b/pallets/eth-app/src/lib.rs index bd45e7ca70652..dc08ce46219e8 100644 --- a/pallets/eth-app/src/lib.rs +++ b/pallets/eth-app/src/lib.rs @@ -1,3 +1,5 @@ +// Copyright (C) 2020 Mangata team +// Based on Snowfork bridge implementation //! # ETH //! //! An application that implements a bridged ETH asset. diff --git a/pallets/executive/src/lib.rs b/pallets/executive/src/lib.rs index 6bdb55cf69e62..20de22c8b9b44 100644 --- a/pallets/executive/src/lib.rs +++ b/pallets/executive/src/lib.rs @@ -1,6 +1,7 @@ // This file is part of Substrate. // Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// Copyright (C) 2020 Mangata team // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/pallets/template/Cargo.toml b/pallets/template/Cargo.toml deleted file mode 100644 index dc4846863a3d7..0000000000000 --- a/pallets/template/Cargo.toml +++ /dev/null @@ -1,36 +0,0 @@ -[package] -authors = ['Substrate DevHub '] -description = 'FRAME pallet template for defining custom runtime logic.' -edition = '2018' -homepage = 'https://substrate.dev' -license = 'Unlicense' -name = 'pallet-template' -repository = 'https://github.com/substrate-developer-hub/substrate-node-template/' -version = '2.0.0' - -[package.metadata.docs.rs] -targets = ['x86_64-unknown-linux-gnu'] - -# alias "parity-scale-code" to "codec" -[dependencies.codec] -default-features = false -features = ['derive'] -package = 'parity-scale-codec' -version = '1.3.4' - -[dependencies] -frame-support = { default-features = false, version = '2.0.0' } -frame-system = { default-features = false, version = '2.0.0' } - -[dev-dependencies] -sp-core = { default-features = false, version = '2.0.0' } -sp-io = { default-features = false, version = '2.0.0' } -sp-runtime = { default-features = false, version = '2.0.0' } - -[features] -default = ['std'] -std = [ - 'codec/std', - 'frame-support/std', - 'frame-system/std', -] diff --git a/pallets/template/src/lib.rs b/pallets/template/src/lib.rs deleted file mode 100644 index 729a71278aa9f..0000000000000 --- a/pallets/template/src/lib.rs +++ /dev/null @@ -1,103 +0,0 @@ -#![cfg_attr(not(feature = "std"), no_std)] - -/// Edit this file to define custom logic or remove it if it is not needed. -/// Learn more about FRAME and the core library of Substrate FRAME pallets: -/// https://substrate.dev/docs/en/knowledgebase/runtime/frame - -use frame_support::{decl_module, decl_storage, decl_event, decl_error, dispatch, traits::Get}; -use frame_system::ensure_signed; - -#[cfg(test)] -mod mock; - -#[cfg(test)] -mod tests; - -/// Configure the pallet by specifying the parameters and types on which it depends. -pub trait Trait: frame_system::Trait { - /// Because this pallet emits events, it depends on the runtime's definition of an event. - type Event: From> + Into<::Event>; -} - -// The pallet's runtime storage items. -// https://substrate.dev/docs/en/knowledgebase/runtime/storage -decl_storage! { - // A unique name is used to ensure that the pallet's storage items are isolated. - // This name may be updated, but each pallet in the runtime must use a unique name. - // ---------------------------------vvvvvvvvvvvvvv - trait Store for Module as TemplateModule { - // Learn more about declaring storage items: - // https://substrate.dev/docs/en/knowledgebase/runtime/storage#declaring-storage-items - Something get(fn something): Option; - } -} - -// Pallets use events to inform users when important changes are made. -// https://substrate.dev/docs/en/knowledgebase/runtime/events -decl_event!( - pub enum Event where AccountId = ::AccountId { - /// Event documentation should end with an array that provides descriptive names for event - /// parameters. [something, who] - SomethingStored(u32, AccountId), - } -); - -// Errors inform users that something went wrong. -decl_error! { - pub enum Error for Module { - /// Error names should be descriptive. - NoneValue, - /// Errors should have helpful documentation associated with them. - StorageOverflow, - } -} - -// Dispatchable functions allows users to interact with the pallet and invoke state changes. -// These functions materialize as "extrinsics", which are often compared to transactions. -// Dispatchable functions must be annotated with a weight and must return a DispatchResult. -decl_module! { - pub struct Module for enum Call where origin: T::Origin { - // Errors must be initialized if they are used by the pallet. - type Error = Error; - - // Events must be initialized if they are used by the pallet. - fn deposit_event() = default; - - /// An example dispatchable that takes a singles value as a parameter, writes the value to - /// storage and emits an event. This function must be dispatched by a signed extrinsic. - #[weight = 10_000 + T::DbWeight::get().writes(1)] - pub fn do_something(origin, something: u32) -> dispatch::DispatchResult { - // Check that the extrinsic was signed and get the signer. - // This function will return an error if the extrinsic is not signed. - // https://substrate.dev/docs/en/knowledgebase/runtime/origin - let who = ensure_signed(origin)?; - - // Update storage. - Something::put(something); - - // Emit an event. - Self::deposit_event(RawEvent::SomethingStored(something, who)); - // Return a successful DispatchResult - Ok(()) - } - - /// An example dispatchable that may throw a custom error. - #[weight = 10_000 + T::DbWeight::get().reads_writes(1,1)] - pub fn cause_error(origin) -> dispatch::DispatchResult { - let _who = ensure_signed(origin)?; - - // Read a value from storage. - match Something::get() { - // Return an error if the value has not been set. - None => Err(Error::::NoneValue)?, - Some(old) => { - // Increment the value read from storage; will error in the event of overflow. - let new = old.checked_add(1).ok_or(Error::::StorageOverflow)?; - // Update the value in storage with the incremented result. - Something::put(new); - Ok(()) - }, - } - } - } -} diff --git a/pallets/template/src/mock.rs b/pallets/template/src/mock.rs deleted file mode 100644 index a3dff240e4847..0000000000000 --- a/pallets/template/src/mock.rs +++ /dev/null @@ -1,61 +0,0 @@ -use crate::{Module, Trait}; -use sp_core::H256; -use frame_support::{impl_outer_origin, parameter_types, weights::Weight}; -use sp_runtime::{ - traits::{BlakeTwo256, IdentityLookup}, testing::Header, Perbill, -}; -use frame_system as system; - -impl_outer_origin! { - pub enum Origin for Test {} -} - -// Configure a mock runtime to test the pallet. - -#[derive(Clone, Eq, PartialEq)] -pub struct Test; -parameter_types! { - pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: Weight = 1024; - pub const MaximumBlockLength: u32 = 2 * 1024; - pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); -} - -impl system::Trait for Test { - type BaseCallFilter = (); - type Origin = Origin; - type Call = (); - type Index = u64; - type BlockNumber = u64; - type Hash = H256; - type Hashing = BlakeTwo256; - type AccountId = u64; - type Lookup = IdentityLookup; - type Header = Header; - type Event = (); - type BlockHashCount = BlockHashCount; - type MaximumBlockWeight = MaximumBlockWeight; - type DbWeight = (); - type BlockExecutionWeight = (); - type ExtrinsicBaseWeight = (); - type MaximumExtrinsicWeight = MaximumBlockWeight; - type MaximumBlockLength = MaximumBlockLength; - type AvailableBlockRatio = AvailableBlockRatio; - type Version = (); - type PalletInfo = (); - type AccountData = (); - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); -} - -impl Trait for Test { - type Event = (); -} - -pub type TemplateModule = Module; - -// Build genesis storage according to the mock runtime. -pub fn new_test_ext() -> sp_io::TestExternalities { - system::GenesisConfig::default().build_storage::().unwrap().into() -} diff --git a/pallets/template/src/tests.rs b/pallets/template/src/tests.rs deleted file mode 100644 index 3356b29ff3598..0000000000000 --- a/pallets/template/src/tests.rs +++ /dev/null @@ -1,23 +0,0 @@ -use crate::{Error, mock::*}; -use frame_support::{assert_ok, assert_noop}; - -#[test] -fn it_works_for_default_value() { - new_test_ext().execute_with(|| { - // Dispatch a signed extrinsic. - assert_ok!(TemplateModule::do_something(Origin::signed(1), 42)); - // Read pallet storage and assert an expected result. - assert_eq!(TemplateModule::something(), Some(42)); - }); -} - -#[test] -fn correct_error_for_none_value() { - new_test_ext().execute_with(|| { - // Ensure the expected error is thrown when no value is present. - assert_noop!( - TemplateModule::cause_error(Origin::signed(1)), - Error::::NoneValue - ); - }); -} diff --git a/pallets/xyk/src/lib.rs b/pallets/xyk/src/lib.rs index d3550800ee6ea..ee92ea2a8ba91 100644 --- a/pallets/xyk/src/lib.rs +++ b/pallets/xyk/src/lib.rs @@ -1,3 +1,5 @@ +// Copyright (C) 2020 Mangata team + #![cfg_attr(not(feature = "std"), no_std)] /// For more guidance on Substrate modules, see the example module diff --git a/pallets/xyk/src/mock.rs b/pallets/xyk/src/mock.rs index 9c3b1f1a5f40c..37fa2919bba01 100644 --- a/pallets/xyk/src/mock.rs +++ b/pallets/xyk/src/mock.rs @@ -1,3 +1,5 @@ +// Copyright (C) 2020 Mangata team + use crate::{Module, Trait}; use sp_core::H256; diff --git a/pallets/xyk/src/tests.rs b/pallets/xyk/src/tests.rs index 5ac4d06639afc..b6fe2f0c10544 100644 --- a/pallets/xyk/src/tests.rs +++ b/pallets/xyk/src/tests.rs @@ -1,3 +1,5 @@ +// Copyright (C) 2020 Mangata team + use super::*; use crate::mock::*; use crate::mock::Test; diff --git a/primitives/core/build.rs b/primitives/core/build.rs index 6e7da8cb5c682..1252803cb604d 100644 --- a/primitives/core/build.rs +++ b/primitives/core/build.rs @@ -1,3 +1,5 @@ +// Copyright (C) 2020 Mangata team +// Based on Snowfork bridge implementation use std::env; use std::fs; use std::path::Path; diff --git a/primitives/core/src/registry.rs b/primitives/core/src/registry.rs index 4cc86115b5b6a..f220a22b61cb5 100644 --- a/primitives/core/src/registry.rs +++ b/primitives/core/src/registry.rs @@ -1,4 +1,5 @@ - +// Copyright (C) 2020 Mangata team +// Based on Snowfork bridge implementation use crate::types::AppId; use sp_std::convert::TryInto; diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index a2543e6852031..48d769904aa40 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -24,7 +24,6 @@ hex-literal = { optional = true, version = '0.3.1' } serde = { features = ['derive'], optional = true, version = '1.0.101' } # local dependencies -pallet-template = { path = '../pallets/template', default-features = false, version = '2.0.0' } pallet-xyk = { path = '../pallets/xyk', default-features = false, version = '0.1.0' } pallet-assets = { path = '../pallets/assets', default-features = false, version = '2.0.0' } frame-executive = { path = '../pallets/executive', default-features = false, version = '2.0.0' } @@ -121,7 +120,6 @@ std = [ 'pallet-grandpa/std', 'pallet-randomness-collective-flip/std', 'pallet-sudo/std', - 'pallet-template/std', 'pallet-timestamp/std', 'pallet-transaction-payment/std', 'pallet-transaction-payment-rpc-runtime-api/std', diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 370c7724d85c8..665b8e477d2cf 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -1,3 +1,5 @@ +// Copyright (C) 2020 Mangata team + #![cfg_attr(not(feature = "std"), no_std)] // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit="256"] @@ -41,8 +43,6 @@ pub use frame_support::{ }, }; -/// Import the template pallet. -pub use pallet_template; pub use pallet_xyk; pub use pallet_assets; pub use pallet_assets_info; @@ -421,11 +421,6 @@ impl pallet_assets::Trait for Runtime { type Event = Event; } -/// Configure the template pallet in pallets/template. -impl pallet_template::Trait for Runtime { - type Event = Event; -} - impl pallet_xyk::Trait for Runtime { type Event = Event; type Randomness = RandomnessCollectiveFlip; @@ -497,8 +492,6 @@ construct_runtime!( Sudo: pallet_sudo::{Module, Call, Config, Storage, Event}, Assets: pallet_assets::{Module, Call, Storage, Event}, Offences: pallet_offences::{Module, Call, Storage, Event}, - // Include the custom logic from the template pallet in the runtime. - TemplateModule: pallet_template::{Module, Call, Storage, Event}, Xyk: pallet_xyk::{Module, Call, Storage, Event}, // Snowfork pallets Bridge: bridge::{Module, Call, Storage, Event},