Skip to content

Commit ae40d0f

Browse files
author
Samuel Dare
committed
chore: add sudo calls for setting min/max childkey takes
1 parent 68ec4c6 commit ae40d0f

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

pallets/subtensor/src/macros/dispatches.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,53 @@ mod dispatches {
786786
Ok(())
787787
}
788788

789+
/// Sets the minimum allowed childkey take.
790+
///
791+
/// This function can only be called by the root origin.
792+
///
793+
/// # Arguments:
794+
/// * `origin` - The origin of the call, must be root.
795+
/// * `take` - The new minimum childkey take value.
796+
///
797+
/// # Errors:
798+
/// * `BadOrigin` - If the origin is not root.
799+
///
800+
#[pallet::call_index(76)]
801+
#[pallet::weight((
802+
Weight::from_parts(6_000, 0)
803+
.saturating_add(T::DbWeight::get().writes(1)),
804+
DispatchClass::Operational,
805+
Pays::No
806+
))]
807+
pub fn sudo_set_min_childkey_take(origin: OriginFor<T>, take: u16) -> DispatchResult {
808+
ensure_root(origin)?;
809+
Self::set_min_childkey_take(take);
810+
Ok(())
811+
}
812+
813+
/// Sets the maximum allowed childkey take.
814+
///
815+
/// This function can only be called by the root origin.
816+
///
817+
/// # Arguments:
818+
/// * `origin` - The origin of the call, must be root.
819+
/// * `take` - The new maximum childkey take value.
820+
///
821+
/// # Errors:
822+
/// * `BadOrigin` - If the origin is not root.
823+
///
824+
#[pallet::call_index(77)]
825+
#[pallet::weight((
826+
Weight::from_parts(6_000, 0)
827+
.saturating_add(T::DbWeight::get().writes(1)),
828+
DispatchClass::Operational,
829+
Pays::No
830+
))]
831+
pub fn sudo_set_max_childkey_take(origin: OriginFor<T>, take: u16) -> DispatchResult {
832+
ensure_root(origin)?;
833+
Self::set_max_childkey_take(take);
834+
Ok(())
835+
}
789836
// ==================================
790837
// ==== Parameter Sudo calls ========
791838
// ==================================

0 commit comments

Comments
 (0)