From b6c45409d67dbe49fd8b40ad1c75a34db564cc0f Mon Sep 17 00:00:00 2001 From: ndkazu Date: Wed, 28 Sep 2022 10:33:13 -0700 Subject: [PATCH] Added an event to dispatch --- pallets/onboarding/src/lib.rs | 17 ++++++++++++++++- pallets/roles/src/lib.rs | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pallets/onboarding/src/lib.rs b/pallets/onboarding/src/lib.rs index d3d27bfe..a0bc7ed0 100644 --- a/pallets/onboarding/src/lib.rs +++ b/pallets/onboarding/src/lib.rs @@ -212,7 +212,13 @@ pub mod pallet { FundsReserved { from_who: T::AccountId, amount: Option> }, ///Funds slashed SlashedFunds { from_who: T::AccountId, amount: Option> }, + ///StatusChanged + AssetStatusChanged { + changed_to: AssetStatus, + collection: T::NftCollectionId, + item: T::NftItemId, } +} // Errors inform users that something went wrong. #[pallet::error] @@ -278,7 +284,15 @@ pub mod pallet { status: AssetStatus, ) -> DispatchResult { let _caller = ensure_signed(origin.clone()).unwrap(); - Self::status(collection, item_id, status); + let coll_id: T::NftCollectionId = collection.clone().value().into(); + Self::status(collection.clone(), item_id.clone(), status.clone()); + Self::deposit_event(Event::AssetStatusChanged { + changed_to: status, + collection: coll_id, + item: item_id, + }); + + Ok(()) } @@ -474,6 +488,7 @@ pub mod pallet { let house = Self::houses(collection_id.clone(), item_id.clone()).unwrap(); let _new_call = VotingCalls::::new(collection_id.clone(), item_id.clone()).ok(); + //Create Call for collective-to-democracy status change let call1: T::Prop = Call::::change_status { collection: collection.clone(), diff --git a/pallets/roles/src/lib.rs b/pallets/roles/src/lib.rs index 6d76fd06..47243001 100644 --- a/pallets/roles/src/lib.rs +++ b/pallets/roles/src/lib.rs @@ -299,7 +299,7 @@ pub mod pallet { sender == SUDO::Pallet::::key().unwrap(), "only the current sudo key can sudo" ); - ensure!(sender != new0, "The same manager is given"); + //ensure!(sender != new0, "The same manager is given"); //Remove current Sudo from Servicers list if ServicerLog::::contains_key(sender.clone()) == true { ServicerLog::::remove(sender.clone());