diff --git a/Cargo.lock b/Cargo.lock index dcb27a0da..f5e462612 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4235,6 +4235,32 @@ dependencies = [ "sp-std 2.0.0", ] +[[package]] +name = "pallet-corporate-actions" +version = "0.1.0" +dependencies = [ + "frame-support", + "frame-system", + "libsecp256k1", + "pallet-balances 0.1.0", + "pallet-identity", + "pallet-session", + "pallet-timestamp", + "parity-scale-codec", + "polymesh-common-utilities", + "polymesh-primitives", + "polymesh-primitives-derive", + "serde", + "serde_derive", + "sp-api", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "sp-version", +] + [[package]] name = "pallet-finality-tracker" version = "2.0.0" @@ -5392,6 +5418,7 @@ dependencies = [ "pallet-contracts", "pallet-contracts-primitives", "pallet-contracts-rpc-runtime-api", + "pallet-corporate-actions", "pallet-finality-tracker", "pallet-grandpa", "pallet-group", diff --git a/Cargo.toml b/Cargo.toml index 5bb755a98..a9ced7796 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ members = [ "pallets/common", "pallets/compliance-manager", "pallets/confidential", + "pallets/corporate-actions", "pallets/group", "pallets/group/rpc", "pallets/group/rpc/runtime-api", diff --git a/pallets/corporate-actions/Cargo.toml b/pallets/corporate-actions/Cargo.toml new file mode 100644 index 000000000..cd23a87a8 --- /dev/null +++ b/pallets/corporate-actions/Cargo.toml @@ -0,0 +1,56 @@ +[package] +name = "pallet-corporate-actions" +version = "0.1.0" +authors = ["Polymath"] +edition = "2018" + +[dependencies] +# Common +polymesh-primitives = { path = "../../primitives", default-features = false } +polymesh-primitives-derive = { path = "../../primitives_derive", default-features = false } +polymesh-common-utilities = { path = "../common", default-features = false } + +# Our Pallets +pallet-balances = { path = "../balances", default-features = false } +pallet-identity = { path = "../identity", default-features = false } + +# Other +serde = { version = "1.0.104", default-features = false } +serde_derive = { version = "1.0.104", optional = true, default-features = false } + +# Substrate +codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] } +sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, tag = "v2.0.0" } +libsecp256k1 = { version = "0.3.5", default-features = false, features = ["hmac"] } + +[features] +default = ["std"] +no_std = [] +std = [ + "codec/std", + "frame-support/std", + "frame-system/std", + "pallet-balances/std", + "pallet-timestamp/std", + "polymesh-common-utilities/std", + "polymesh-primitives/std", + "serde/std", + "serde_derive", + "sp-api/std", + "sp-core/std", + "sp-io/std", + "sp-runtime/std", + "sp-std/std", + "sp-version/std", + "sp-arithmetic/std" +] diff --git a/pallets/corporate-actions/src/lib.rs b/pallets/corporate-actions/src/lib.rs new file mode 100644 index 000000000..ae29367b9 --- /dev/null +++ b/pallets/corporate-actions/src/lib.rs @@ -0,0 +1,88 @@ +// This file is part of the Polymesh distribution (https://github.com/PolymathNetwork/Polymesh). +// Copyright (c) 2020 Polymath + +// This program 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, version 3. + +// This program 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 this program. If not, see . + +//! # Corporate Actions module. +//! +//! TODO +//! +//! ## Overview +//! +//! TODO +//! +//! ## Interface +//! +//! TODO +//! +//! ### Dispatchable Functions +//! +//! TODO +//! +//! ### Public Functions +//! +//! TODO +//! + +#![cfg_attr(not(feature = "std"), no_std)] + +use frame_support::{decl_error, decl_event, decl_module, decl_storage, traits::Currency}; +use polymesh_common_utilities::{ + balances::Trait as BalancesTrait, identity::Trait as IdentityTrait, +}; +use sp_std::prelude::*; + +/// The module's configuration trait. +pub trait Trait: frame_system::Trait + BalancesTrait + IdentityTrait { + /// The overarching event type. + type Event: From> + Into<::Event>; + type Currency: Currency; +} + +decl_storage! { + trait Store for Module as Asset { + // TODO + } +} + +// Public interface for this runtime module. +decl_module! { + pub struct Module for enum Call where origin: T::Origin { + type Error = Error; + + /// initialize the default event for this module + fn deposit_event() = default; + + // TODO + } +} + +decl_event! { + pub enum Event + where + AccountId = ::AccountId, + { + /// TODO + TODO(AccountId), + } +} + +decl_error! { + pub enum Error for Module { + // TODO + } +} + +impl Module { + // TODO +} diff --git a/pallets/runtime/develop/Cargo.toml b/pallets/runtime/develop/Cargo.toml index 1f490c800..e3fc55e5b 100644 --- a/pallets/runtime/develop/Cargo.toml +++ b/pallets/runtime/develop/Cargo.toml @@ -22,6 +22,7 @@ pallet-bridge = { path = "../../bridge", default-features = false } pallet-committee = { path = "../../committee", default-features = false } pallet-compliance-manager = { path = "../../compliance-manager", default-features = false } pallet-confidential = { path = "../../confidential", default-features = false } +pallet-corporate-actions = { path = "../../corporate-actions", default-features = false } pallet-group = { path = "../../group", default-features = false } pallet-identity = { path = "../../identity", default-features = false } pallet-im-online = { path = "../../im-online", default-features = false } @@ -123,6 +124,7 @@ std = [ "pallet-contracts-primitives/std", "pallet-contracts-rpc-runtime-api/std", "pallet-contracts/std", + "pallet-corporate-actions/std", "pallet-executive/std", "pallet-finality-tracker/std", "pallet-grandpa/std",