Skip to content

Commit

Permalink
feat: make root curator be able to manage allocators
Browse files Browse the repository at this point in the history
  • Loading branch information
devwckd committed Jan 7, 2025
1 parent fb6a0c7 commit 7a2215a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pallets/governance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,20 @@ pub mod pallet {
#[pallet::call_index(2)]
#[pallet::weight((<T as Config>::WeightInfo::add_allocator(), DispatchClass::Normal, Pays::Yes))]
pub fn add_allocator(origin: OriginFor<T>, key: AccountIdOf<T>) -> DispatchResult {
ensure_root(origin)?;
if ensure_signed_or_root(origin.clone())?.is_some() {
roles::ensure_root_curator::<T>(origin)?;
}

roles::manage_role::<T, Allocators<T>>(key, true, Error::<T>::AlreadyAllocator)
}

#[pallet::call_index(3)]
#[pallet::weight((<T as Config>::WeightInfo::remove_allocator(), DispatchClass::Normal, Pays::Yes))]
pub fn remove_allocator(origin: OriginFor<T>, key: AccountIdOf<T>) -> DispatchResult {
ensure_root(origin)?;
if ensure_signed_or_root(origin.clone())?.is_some() {
roles::ensure_root_curator::<T>(origin)?;
}

roles::manage_role::<T, Allocators<T>>(key, false, Error::<T>::NotAllocator)
}

Expand Down

0 comments on commit 7a2215a

Please sign in to comment.