From e04677fdb06780f3df4ee4a696b6411cfc833eba Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Thu, 28 Sep 2023 19:09:28 -0600 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=90=9B=20fix(functions.rs):=20add=20c?= =?UTF-8?q?all=20to=20do=5Fadd=5Faccount=5Fto=5Fafloat=5Ffrunique=20to=20e?= =?UTF-8?q?nsure=20consistency=20with=20admin=20role=20assignment=20?= =?UTF-8?q?=E2=9C=A8=20feat(lib.rs):=20add=20support=20for=20adding=20aflo?= =?UTF-8?q?at=20and=20frunique=20roles=20during=20initial=20setup=20?= =?UTF-8?q?=F0=9F=94=A7=20chore(types.rs):=20add=20AddAfloatRole=20and=20A?= =?UTF-8?q?ddFruniqueRole=20variants=20to=20InitialSetupArgs=20enum=20for?= =?UTF-8?q?=20role=20assignment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/afloat/src/functions.rs | 2 ++ pallets/afloat/src/lib.rs | 8 ++++++++ pallets/afloat/src/types.rs | 2 ++ 3 files changed, 12 insertions(+) diff --git a/pallets/afloat/src/functions.rs b/pallets/afloat/src/functions.rs index ee955a4f..4c39a1ea 100644 --- a/pallets/afloat/src/functions.rs +++ b/pallets/afloat/src/functions.rs @@ -856,6 +856,8 @@ impl Pallet { Self::give_role_to_user(user_address.clone(), AfloatRole::Admin)?; + Self::do_add_account_to_afloat_frunique(user_address.clone(), FruniqueRole::Admin)?; + Self::deposit_event(Event::AdminAdded(authority, user_address)); Ok(()) } diff --git a/pallets/afloat/src/lib.rs b/pallets/afloat/src/lib.rs index 6a74f517..bd2be9d3 100644 --- a/pallets/afloat/src/lib.rs +++ b/pallets/afloat/src/lib.rs @@ -223,6 +223,14 @@ pub mod pallet { Self::do_setup_roles(creator, admin)?; Ok(()) }, + InitialSetupArgs::AddAfloatRole { who, role } => { + Self::give_role_to_user(who, role)?; + Ok(()) + }, + InitialSetupArgs::AddFruniqueRole { who, role } => { + Self::do_add_account_to_afloat_frunique(who, FruniqueRole::Admin)?; + Ok(()) + }, } } diff --git a/pallets/afloat/src/types.rs b/pallets/afloat/src/types.rs index d96b8517..205013a1 100644 --- a/pallets/afloat/src/types.rs +++ b/pallets/afloat/src/types.rs @@ -197,6 +197,8 @@ pub enum CreateAsset { pub enum InitialSetupArgs { All { creator: T::AccountId, admin: T::AccountId, asset: CreateAsset }, Roles { creator: T::AccountId, admin: T::AccountId }, + AddAfloatRole { who: T::AccountId, role: AfloatRole }, + AddFruniqueRole { who: T::AccountId, role: AfloatRole }, } // ! Transaction structures From a6d285582398eb807f1634b1aca1ae13b5fa2df3 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Thu, 28 Sep 2023 19:14:41 -0600 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=9B=20fix(afloat):=20fix=20incorre?= =?UTF-8?q?ct=20role=20parameter=20in=20do=5Fadd=5Faccount=5Fto=5Fafloat?= =?UTF-8?q?=5Ffrunique=20function=20call=20=F0=9F=94=A7=20chore(types):=20?= =?UTF-8?q?import=20FruniqueRole=20from=20pallet=5Ffruniques=20to=20fix=20?= =?UTF-8?q?type=20error=20in=20InitialSetupArgs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/afloat/src/lib.rs | 2 +- pallets/afloat/src/types.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pallets/afloat/src/lib.rs b/pallets/afloat/src/lib.rs index bd2be9d3..23cf5d40 100644 --- a/pallets/afloat/src/lib.rs +++ b/pallets/afloat/src/lib.rs @@ -228,7 +228,7 @@ pub mod pallet { Ok(()) }, InitialSetupArgs::AddFruniqueRole { who, role } => { - Self::do_add_account_to_afloat_frunique(who, FruniqueRole::Admin)?; + Self::do_add_account_to_afloat_frunique(who, role)?; Ok(()) }, } diff --git a/pallets/afloat/src/types.rs b/pallets/afloat/src/types.rs index 205013a1..8eb5d8c1 100644 --- a/pallets/afloat/src/types.rs +++ b/pallets/afloat/src/types.rs @@ -1,5 +1,6 @@ use super::*; use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256}; +use pallet_fruniques::types::FruniqueRole; use sp_runtime::sp_std::vec::Vec; pub type ShortString = BoundedVec>; @@ -198,7 +199,7 @@ pub enum InitialSetupArgs { All { creator: T::AccountId, admin: T::AccountId, asset: CreateAsset }, Roles { creator: T::AccountId, admin: T::AccountId }, AddAfloatRole { who: T::AccountId, role: AfloatRole }, - AddFruniqueRole { who: T::AccountId, role: AfloatRole }, + AddFruniqueRole { who: T::AccountId, role: FruniqueRole }, } // ! Transaction structures From ecf1dadda711e242e8b6a804852daf61c36ee76a Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Thu, 28 Sep 2023 19:20:32 -0600 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=94=A5=20refactor(lib.rs):=20remove?= =?UTF-8?q?=20unused=20`spam=5Fspawning`=20function=20from=20the=20`pallet?= =?UTF-8?q?`=20module?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `spam_spawning` function was commented out and not being used. Removing it to improve code cleanliness and readability. --- pallets/fruniques/src/lib.rs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/pallets/fruniques/src/lib.rs b/pallets/fruniques/src/lib.rs index 8444d03d..b862cfa1 100644 --- a/pallets/fruniques/src/lib.rs +++ b/pallets/fruniques/src/lib.rs @@ -509,19 +509,5 @@ pub mod pallet { T::Rbac::remove_pallet_storage(Self::pallet_id())?; Ok(()) } - - #[pallet::call_index(10)] - #[pallet::weight(Weight::from_parts(10_000,0) + T::DbWeight::get().writes(1))] - pub fn spam_spawning( - origin: OriginFor, - class_id: T::CollectionId, - instances: u32, - ) -> DispatchResult { - let _ = ensure_signed(origin)?; - // for instance in instances { - // let _ = Self::mint(instance, class_id, None, None, None, None, None, None, None)?; - // } - Ok(()) - } } }