diff --git a/Cargo.lock b/Cargo.lock index 8b70b378c..5877243d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -939,6 +939,7 @@ dependencies = [ "pallet-contracts-primitives", "pallet-contracts-rpc-runtime-api", "pallet-ddc-metrics-offchain-worker", + "pallet-ddc-staking", "pallet-democracy", "pallet-election-provider-multi-phase", "pallet-election-provider-support-benchmarking", diff --git a/runtime/cere/Cargo.toml b/runtime/cere/Cargo.toml index 30c080f8f..1109484df 100644 --- a/runtime/cere/Cargo.toml +++ b/runtime/cere/Cargo.toml @@ -101,6 +101,7 @@ pallet-cere-ddc = { version = "4.8.0", default-features = false, path = "../../p pallet-erc721 = { version = "4.8.0", default-features = false, path = "../../pallets/erc721" } pallet-erc20 = { version = "4.8.0", default-features = false, path = "../../pallets/erc20" } pallet-ddc-metrics-offchain-worker = { version = "4.8.0", default-features = false, path = "../../pallets/ddc-metrics-offchain-worker" } +pallet-ddc-staking = { version = "4.8.0", default-features = false, path = "../../pallets/ddc-staking" } [build-dependencies] substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -177,6 +178,7 @@ std = [ "sp-io/std", "pallet-child-bounties/std", "pallet-ddc-metrics-offchain-worker/std", + "pallet-ddc-staking/std", "cere-runtime-common/std", "cere-runtime-constants/std" ] @@ -193,6 +195,7 @@ runtime-benchmarks = [ "pallet-child-bounties/runtime-benchmarks", "pallet-collective/runtime-benchmarks", "pallet-contracts/runtime-benchmarks", + "pallet-ddc-staking/runtime-benchmarks", "pallet-democracy/runtime-benchmarks", "pallet-election-provider-multi-phase/runtime-benchmarks", "pallet-election-provider-support-benchmarking/runtime-benchmarks", diff --git a/runtime/cere/src/lib.rs b/runtime/cere/src/lib.rs index 33150f46f..a51cdf7c6 100644 --- a/runtime/cere/src/lib.rs +++ b/runtime/cere/src/lib.rs @@ -52,6 +52,7 @@ pub use pallet_cere_ddc; pub use pallet_chainbridge; use pallet_contracts::weights::WeightInfo; pub use pallet_ddc_metrics_offchain_worker; +pub use pallet_ddc_staking; use pallet_election_provider_multi_phase::SolutionAccuracyOf; use pallet_grandpa::{ fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList, @@ -76,6 +77,7 @@ use sp_runtime::{ transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity}, ApplyExtrinsicResult, FixedPointNumber, FixedU128, Perbill, Percent, Permill, Perquintill, }; +use sp_staking::EraIndex; use sp_std::prelude::*; #[cfg(any(feature = "std", test))] use sp_version::NativeVersion; @@ -1315,6 +1317,25 @@ impl pallet_ddc_metrics_offchain_worker::Config for Runtime { type RuntimeCall = RuntimeCall; } +parameter_types! { + pub const DefaultEdgeBondSize: Balance = 100 * DOLLARS; + pub const DefaultEdgeChillDelay: EraIndex = 7 * 24 * 60 / 2; // approx. 1 week with 2 min DDC era + pub const DefaultStorageBondSize: Balance = 100 * DOLLARS; + pub const DefaultStorageChillDelay: EraIndex = 7 * 24 * 60 / 2; // approx. 1 week with 2 min DDC era +} + +impl pallet_ddc_staking::Config for Runtime { + type BondingDuration = BondingDuration; + type Currency = Balances; + type DefaultEdgeBondSize = DefaultEdgeBondSize; + type DefaultEdgeChillDelay = DefaultEdgeChillDelay; + type DefaultStorageBondSize = DefaultStorageBondSize; + type DefaultStorageChillDelay = DefaultStorageChillDelay; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Timestamp; + type WeightInfo = pallet_ddc_staking::weights::SubstrateWeight; +} + construct_runtime!( pub enum Runtime where Block = Block, @@ -1366,6 +1387,7 @@ construct_runtime!( Erc721: pallet_erc721::{Pallet, Call, Storage, Event}, Erc20: pallet_erc20::{Pallet, Call, Storage, Event}, DdcMetricsOffchainWorker: pallet_ddc_metrics_offchain_worker::{Pallet, Call, Storage, Event}, + DdcStaking: pallet_ddc_staking, } );