INNER CODE UNIT · Rust

kick_candidate

AstarNetwork/Astar · pallets/collator-selection/src/lib.rs:661

        pub fn kick_candidate(
            origin: OriginFor<T>,
            who: T::AccountId,
        ) -> DispatchResultWithPostInfo {
            T::ForceRemovalOrigin::ensure_origin(origin)?;
            ensure!(
                Candidates::<T>::get().len() > T::MinCandidates::get() as usize,
                Error::<T>::TooFewCandidates
            );
            let current_count = Self::try_remove_candidate(&who)?;
            // slashed funds are released immediately, this is safe since it can only be
            // called by force origin.
            Self::slash_non_candidate(&who);

            Self::deposit_event(Event::CandidateKicked(who));
            Ok(Some(T::WeightInfo::kick_candidate(current_count as u32)).into())
        }
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…