From 1bd9105a0397bd5eb79318d18ed85546293e19bd Mon Sep 17 00:00:00 2001 From: Amiya Behera Date: Fri, 24 Nov 2023 11:47:43 +0530 Subject: [PATCH] apply staking period department-funding --- pallets/department-funding/src/lib.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pallets/department-funding/src/lib.rs b/pallets/department-funding/src/lib.rs index 8c0a8e8..cea90c0 100644 --- a/pallets/department-funding/src/lib.rs +++ b/pallets/department-funding/src/lib.rs @@ -148,7 +148,7 @@ pub mod pallet { account: T::AccountId, department_required_fund_id: DepartmentRequiredFundId, }, - StakinPeriodStarted { + StakingPeriodStarted { department_required_fund_id: DepartmentRequiredFundId, block_number: BlockNumberOf, }, @@ -228,6 +228,7 @@ pub mod pallet { origin: OriginFor, department_required_fund_id: DepartmentRequiredFundId, ) -> DispatchResult { + let who = ensure_signed(origin)?; Self::ensure_validation_to_do(department_required_fund_id)?; let department_id = Self::get_department_id_from_department_required_fund_id( department_required_fund_id, @@ -237,6 +238,23 @@ pub mod pallet { department_id, department_funding_status, ); + let now = >::block_number(); + let key = SumTreeName::DepartmentRequiredFund { + department_required_fund_id, + block_number: now.clone(), + }; + ValidationDepartmentRequiredFundsBlock::::insert( + department_required_fund_id, + now.clone(), + ); + T::SchellingGameSharedSource::set_to_staking_period_pe_link(key.clone(), now.clone())?; + T::SchellingGameSharedSource::create_tree_helper_link(key, 3)?; + + Self::deposit_event(Event::StakingPeriodStarted { + department_required_fund_id, + block_number: now, + }); + Ok(()) }