Skip to content

Commit fcaab50

Browse files
authored
add missing permissions in afloat (#18)
* 🐛 fix(functions.rs): add call to do_add_account_to_afloat_frunique to ensure consistency with admin role assignment ✨ feat(lib.rs): add support for adding afloat and frunique roles during initial setup 🔧 chore(types.rs): add AddAfloatRole and AddFruniqueRole variants to InitialSetupArgs enum for role assignment * 🐛 fix(afloat): fix incorrect role parameter in do_add_account_to_afloat_frunique function call 🔧 chore(types): import FruniqueRole from pallet_fruniques to fix type error in InitialSetupArgs * 🔥 refactor(lib.rs): remove unused `spam_spawning` function from the `pallet` module The `spam_spawning` function was commented out and not being used. Removing it to improve code cleanliness and readability.
1 parent 7ec0bdf commit fcaab50

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

pallets/afloat/src/functions.rs

+2
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,8 @@ impl<T: Config> Pallet<T> {
856856

857857
Self::give_role_to_user(user_address.clone(), AfloatRole::Admin)?;
858858

859+
Self::do_add_account_to_afloat_frunique(user_address.clone(), FruniqueRole::Admin)?;
860+
859861
Self::deposit_event(Event::AdminAdded(authority, user_address));
860862
Ok(())
861863
}

pallets/afloat/src/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,14 @@ pub mod pallet {
223223
Self::do_setup_roles(creator, admin)?;
224224
Ok(())
225225
},
226+
InitialSetupArgs::AddAfloatRole { who, role } => {
227+
Self::give_role_to_user(who, role)?;
228+
Ok(())
229+
},
230+
InitialSetupArgs::AddFruniqueRole { who, role } => {
231+
Self::do_add_account_to_afloat_frunique(who, role)?;
232+
Ok(())
233+
},
226234
}
227235
}
228236

pallets/afloat/src/types.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use super::*;
22
use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256};
3+
use pallet_fruniques::types::FruniqueRole;
34
use sp_runtime::sp_std::vec::Vec;
45

56
pub type ShortString = BoundedVec<u8, ConstU32<55>>;
@@ -197,6 +198,8 @@ pub enum CreateAsset<T: Config> {
197198
pub enum InitialSetupArgs<T: Config> {
198199
All { creator: T::AccountId, admin: T::AccountId, asset: CreateAsset<T> },
199200
Roles { creator: T::AccountId, admin: T::AccountId },
201+
AddAfloatRole { who: T::AccountId, role: AfloatRole },
202+
AddFruniqueRole { who: T::AccountId, role: FruniqueRole },
200203
}
201204

202205
// ! Transaction structures

pallets/fruniques/src/lib.rs

-14
Original file line numberDiff line numberDiff line change
@@ -509,19 +509,5 @@ pub mod pallet {
509509
T::Rbac::remove_pallet_storage(Self::pallet_id())?;
510510
Ok(())
511511
}
512-
513-
#[pallet::call_index(10)]
514-
#[pallet::weight(Weight::from_parts(10_000,0) + T::DbWeight::get().writes(1))]
515-
pub fn spam_spawning(
516-
origin: OriginFor<T>,
517-
class_id: T::CollectionId,
518-
instances: u32,
519-
) -> DispatchResult {
520-
let _ = ensure_signed(origin)?;
521-
// for instance in instances {
522-
// let _ = Self::mint(instance, class_id, None, None, None, None, None, None, None)?;
523-
// }
524-
Ok(())
525-
}
526512
}
527513
}

0 commit comments

Comments
 (0)