diff --git a/pallets/asset/Cargo.toml b/pallets/asset/Cargo.toml index 4df160094c..723b598071 100644 --- a/pallets/asset/Cargo.toml +++ b/pallets/asset/Cargo.toml @@ -55,6 +55,7 @@ std = [ "codec/std", "frame-support/std", "frame-system/std", + "pallet-base/std", "pallet-balances/std", "pallet-identity/std", #"polymesh-contracts/std", diff --git a/pallets/base/Cargo.toml b/pallets/base/Cargo.toml index b9a5212172..e0621ac9bb 100644 --- a/pallets/base/Cargo.toml +++ b/pallets/base/Cargo.toml @@ -25,3 +25,14 @@ frame-system = { git = "https://github.com/PolymeshAssociation/substrate", defau frame-support = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-05" } [features] +default = ["std"] +no_std = [] +std = [ + "codec/std", + "sp-runtime/std", + "frame-support/std", + "frame-system/std", + "sp-std/std", + "polymesh-primitives/std", + "polymesh-common-utilities/std", +] diff --git a/pallets/base/src/lib.rs b/pallets/base/src/lib.rs index 9e5bf84e41..80ab77dd4f 100644 --- a/pallets/base/src/lib.rs +++ b/pallets/base/src/lib.rs @@ -105,8 +105,6 @@ pub fn try_next_post(seq: &mut I) -> Result::CounterOverflow.into()) } -impl frame_support::traits::IntegrityTest for Module {} - impl StorageInfoTrait for Module { fn storage_info() -> Vec { Vec::new() diff --git a/pallets/bridge/Cargo.toml b/pallets/bridge/Cargo.toml index 59d43866ca..3bc9d171af 100644 --- a/pallets/bridge/Cargo.toml +++ b/pallets/bridge/Cargo.toml @@ -38,6 +38,7 @@ std = [ "frame-benchmarking/std", "frame-support/std", "frame-system/std", + "pallet-base/std", "pallet-balances/std", "pallet-identity/std", "pallet-multisig/std", diff --git a/pallets/common/src/batch_dispatch_info.rs b/pallets/common/src/batch_dispatch_info.rs deleted file mode 100644 index c3fc33cf3d..0000000000 --- a/pallets/common/src/batch_dispatch_info.rs +++ /dev/null @@ -1,59 +0,0 @@ -use polymesh_primitives::IdentityId; - -use frame_support::weights::{ClassifyDispatch, DispatchClass, Pays, PaysFee, WeighData, Weight}; -use sp_std::{cmp::max, vec::Vec}; - -/// It supports fee calculation when a transaction is made in batch mode (for a group of items). -/// The total fee is maximum between: -/// - `per_item_weight` multiplied by number of items of one or more parameters. -/// - and `min_weight`. It ensures a cost if number of items is 0, or you want a minimum threshold. -/// -pub struct BatchDispatchInfo { - pub dispatch_type: DispatchClass, - pub per_item_weight: Weight, - pub min_weight: Weight, -} - -impl BatchDispatchInfo { - pub fn new_normal(per_item: Weight, min: Weight) -> Self { - Self::new(DispatchClass::Normal, per_item, min) - } - - pub fn new_operational(per_item: Weight, min: Weight) -> Self { - Self::new(DispatchClass::Operational, per_item, min) - } - - pub fn new(dispatch_type: DispatchClass, per_item_weight: Weight, min_weight: Weight) -> Self { - BatchDispatchInfo { - dispatch_type, - per_item_weight, - min_weight, - } - } -} - -impl ClassifyDispatch for BatchDispatchInfo { - fn classify_dispatch(&self, _: T) -> DispatchClass { - self.dispatch_type - } -} - -impl PaysFee for BatchDispatchInfo { - fn pays_fee(&self, _target: T) -> Pays { - Pays::Yes - } -} - -/// It adds support to any function like `fn x( _: IdentityId, items: Vec<_>) -type IdentityAndVecParams<'a, T> = (&'a IdentityId, &'a Vec); - -impl<'a, T> WeighData> for BatchDispatchInfo { - /// The weight is calculated base on the number of elements of the second parameter of the - /// call. - fn weigh_data(&self, params: IdentityAndVecParams<'a, T>) -> Weight { - max( - self.min_weight, - self.per_item_weight * params.1.len() as Weight, - ) - } -} diff --git a/pallets/common/src/lib.rs b/pallets/common/src/lib.rs index 82670b523d..2770385e1d 100644 --- a/pallets/common/src/lib.rs +++ b/pallets/common/src/lib.rs @@ -25,9 +25,6 @@ pub use traits::{ pub mod context; pub use context::Context; -pub mod batch_dispatch_info; -pub use batch_dispatch_info::BatchDispatchInfo; - pub mod protocol_fee; pub use protocol_fee::ChargeProtocolFee; diff --git a/pallets/compliance-manager/Cargo.toml b/pallets/compliance-manager/Cargo.toml index b508fe8257..4b8d3e167d 100644 --- a/pallets/compliance-manager/Cargo.toml +++ b/pallets/compliance-manager/Cargo.toml @@ -46,25 +46,26 @@ default = ["std", "equalize"] no_std = [] only-staking = [] std = [ - "serde_derive", - "serde/std", - "codec/std", - "sp-std/std", - "sp-io/std", - "sp-core/std", - "sp-runtime/std", - "sp-version/std", - "sp-api/std", - "frame-system/std", - "frame-support/std", - "frame-benchmarking/std", - "pallet-timestamp/std", - "polymesh-common-utilities/std", - "polymesh-primitives/std", + "serde_derive", + "serde/std", + "codec/std", + "sp-std/std", + "sp-io/std", + "sp-core/std", + "sp-runtime/std", + "sp-version/std", + "sp-api/std", + "frame-system/std", + "frame-support/std", + "frame-benchmarking/std", + "pallet-base/std", + "pallet-timestamp/std", + "polymesh-common-utilities/std", + "polymesh-primitives/std", ] runtime-benchmarks = [ - "frame-benchmarking", - "pallet-asset/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", + "frame-benchmarking", + "pallet-asset/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", ] diff --git a/pallets/contracts/Cargo.toml b/pallets/contracts/Cargo.toml index db69868e00..3f649021b4 100644 --- a/pallets/contracts/Cargo.toml +++ b/pallets/contracts/Cargo.toml @@ -38,11 +38,12 @@ std = [ "sp-core/std", "frame-system/std", "frame-support/std", + "pallet-base/std", "pallet-identity/std", "pallet-contracts/std", "polymesh-primitives/std", "polymesh-common-utilities/std", - "pwasm-utils/std", + "pwasm-utils/std", ] runtime-benchmarks = [ "frame-benchmarking", diff --git a/pallets/corporate-actions/Cargo.toml b/pallets/corporate-actions/Cargo.toml index 72333d2749..9621e81da3 100644 --- a/pallets/corporate-actions/Cargo.toml +++ b/pallets/corporate-actions/Cargo.toml @@ -47,6 +47,7 @@ std = [ "codec/std", "frame-support/std", "frame-system/std", + "pallet-base/std", "pallet-balances/std", "pallet-timestamp/std", "polymesh-common-utilities/std", diff --git a/pallets/external-agents/Cargo.toml b/pallets/external-agents/Cargo.toml index 1fa4543637..a3d7d348a0 100644 --- a/pallets/external-agents/Cargo.toml +++ b/pallets/external-agents/Cargo.toml @@ -36,6 +36,7 @@ std = [ "codec/std", "frame-support/std", "frame-system/std", + "pallet-base/std", "pallet-identity/std", "polymesh-common-utilities/std", "polymesh-primitives/std", diff --git a/pallets/identity/Cargo.toml b/pallets/identity/Cargo.toml index e0fd3b6078..15760225af 100644 --- a/pallets/identity/Cargo.toml +++ b/pallets/identity/Cargo.toml @@ -54,6 +54,7 @@ std = [ "confidential_identity_v2/u64_backend", "frame-support/std", "frame-system/std", + "pallet-base/std", "pallet-balances/std", "pallet-permissions/std", "pallet-timestamp/std", diff --git a/pallets/pips/Cargo.toml b/pallets/pips/Cargo.toml index 28da0646d6..d1f497421e 100644 --- a/pallets/pips/Cargo.toml +++ b/pallets/pips/Cargo.toml @@ -53,6 +53,7 @@ std = [ "codec/std", "frame-support/std", "frame-system/std", + "pallet-base/std", "pallet-balances/std", "pallet-group/std", "pallet-identity/std", diff --git a/pallets/portfolio/Cargo.toml b/pallets/portfolio/Cargo.toml index cc052326d6..458c6b9862 100644 --- a/pallets/portfolio/Cargo.toml +++ b/pallets/portfolio/Cargo.toml @@ -38,6 +38,7 @@ std = [ "codec/std", "frame-support/std", "frame-system/std", + "pallet-base/std", "pallet-balances/std", "polymesh-common-utilities/std", "polymesh-primitives/std", diff --git a/pallets/runtime/develop/Cargo.toml b/pallets/runtime/develop/Cargo.toml index 06ea8ed6d7..aaa8fc654a 100644 --- a/pallets/runtime/develop/Cargo.toml +++ b/pallets/runtime/develop/Cargo.toml @@ -135,6 +135,7 @@ std = [ "pallet-asset/std", "pallet-authority-discovery/std", "pallet-authorship/std", + "pallet-base/std", "pallet-babe/std", "pallet-balances/std", "pallet-sto/std", diff --git a/pallets/runtime/mainnet/Cargo.toml b/pallets/runtime/mainnet/Cargo.toml index c092c5cf97..7378bf9195 100644 --- a/pallets/runtime/mainnet/Cargo.toml +++ b/pallets/runtime/mainnet/Cargo.toml @@ -123,6 +123,7 @@ std = [ "pallet-asset/std", "pallet-authority-discovery/std", "pallet-authorship/std", + "pallet-base/std", "pallet-babe/std", "pallet-balances/std", "pallet-bridge/std", diff --git a/pallets/runtime/testnet/Cargo.toml b/pallets/runtime/testnet/Cargo.toml index ea1bfba649..bcc82db40d 100644 --- a/pallets/runtime/testnet/Cargo.toml +++ b/pallets/runtime/testnet/Cargo.toml @@ -123,6 +123,7 @@ std = [ "pallet-asset/std", "pallet-authority-discovery/std", "pallet-authorship/std", + "pallet-base/std", "pallet-babe/std", "pallet-balances/std", "pallet-sto/std", diff --git a/pallets/runtime/tests/Cargo.toml b/pallets/runtime/tests/Cargo.toml index 638ce8b363..29a0c2dea6 100644 --- a/pallets/runtime/tests/Cargo.toml +++ b/pallets/runtime/tests/Cargo.toml @@ -135,6 +135,7 @@ std = [ "ink_primitives/std", "pallet-asset/std", "pallet-authorship/std", + "pallet-base/std", "pallet-babe/std", "pallet-balances/std", "pallet-sto/std", diff --git a/pallets/settlement/Cargo.toml b/pallets/settlement/Cargo.toml index 43d6ac2618..6efd99b806 100644 --- a/pallets/settlement/Cargo.toml +++ b/pallets/settlement/Cargo.toml @@ -50,8 +50,7 @@ std = [ "codec/std", "frame-support/std", "frame-system/std", - #"pallet-contracts/std", - #"polymesh-contracts/std", + "pallet-base/std", "pallet-balances/std", "pallet-asset/std", "pallet-identity/std", diff --git a/pallets/sto/Cargo.toml b/pallets/sto/Cargo.toml index 67b2cb1ad9..b3af24a53b 100644 --- a/pallets/sto/Cargo.toml +++ b/pallets/sto/Cargo.toml @@ -43,26 +43,27 @@ default = ["std", "equalize"] no_std = [] only-staking = [] std = [ - "serde_derive", - "serde/std", - "codec/std", - "sp-std/std", - "sp-io/std", - "sp-core/std", - "sp-runtime/std", - "sp-version/std", - "sp-api/std", - "frame-system/std", - "frame-support/std", - "frame-benchmarking/std", - "polymesh-common-utilities/std", - "pallet-balances/std", - "polymesh-primitives/std", - "pallet-identity/std", - "pallet-asset/std", - "pallet-settlement/std", - "pallet-timestamp/std" + "serde_derive", + "serde/std", + "codec/std", + "sp-std/std", + "sp-io/std", + "sp-core/std", + "sp-runtime/std", + "sp-version/std", + "sp-api/std", + "frame-system/std", + "frame-support/std", + "frame-benchmarking/std", + "polymesh-common-utilities/std", + "pallet-base/std", + "pallet-balances/std", + "polymesh-primitives/std", + "pallet-identity/std", + "pallet-asset/std", + "pallet-settlement/std", + "pallet-timestamp/std" ] runtime-benchmarks = [ - "frame-benchmarking" + "frame-benchmarking" ]