Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

[Feature] Add deposit to fast-unstake #12366

Merged
merged 22 commits into from
Sep 27, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions frame/fast-unstake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ pub mod pallet {
NotQueued,
/// The provided un-staker is already in Head, and cannot deregister.
AlreadyHead,
/// The call is not allowed at this point.
CallNotAllowed,
}

#[pallet::hooks]
Expand Down Expand Up @@ -214,6 +216,8 @@ pub mod pallet {
/// the chain's resources.
#[pallet::weight(<T as Config>::WeightInfo::register_fast_unstake())]
pub fn register_fast_unstake(origin: OriginFor<T>) -> DispatchResult {
ensure!(ErasToCheckPerBlock::<T>::get() != 0, <Error<T>>::CallNotAllowed);

let ctrl = ensure_signed(origin)?;

let ledger =
Expand Down Expand Up @@ -249,6 +253,8 @@ pub mod pallet {
/// `Staking::rebond`.
#[pallet::weight(<T as Config>::WeightInfo::deregister())]
pub fn deregister(origin: OriginFor<T>) -> DispatchResult {
ensure!(ErasToCheckPerBlock::<T>::get() != 0, <Error<T>>::CallNotAllowed);

let ctrl = ensure_signed(origin)?;
let stash = pallet_staking::Ledger::<T>::get(&ctrl)
.map(|l| l.stash)
Expand Down