Skip to content

Commit

Permalink
mesh-1097: add corporate-actions pallet
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Oct 12, 2020
1 parent 7837422 commit 37f01f8
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Expand Up @@ -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",
Expand Down
56 changes: 56 additions & 0 deletions 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"
]
88 changes: 88 additions & 0 deletions 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 <http://www.gnu.org/licenses/>.

//! # 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<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
type Currency: Currency<Self::AccountId>;
}

decl_storage! {
trait Store for Module<T: Trait> as Asset {
// TODO
}
}

// Public interface for this runtime module.
decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
type Error = Error<T>;

/// initialize the default event for this module
fn deposit_event() = default;

// TODO
}
}

decl_event! {
pub enum Event<T>
where
AccountId = <T as frame_system::Trait>::AccountId,
{
/// TODO
TODO(AccountId),
}
}

decl_error! {
pub enum Error for Module<T: Trait> {
// TODO
}
}

impl<T: Trait> Module<T> {
// TODO
}
2 changes: 2 additions & 0 deletions pallets/runtime/develop/Cargo.toml
Expand Up @@ -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 }
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 37f01f8

Please sign in to comment.