INNER CODE UNIT · Rust
approve_application
AstarNetwork/Astar · pallets/collator-selection/src/lib.rs:610
pub fn approve_application(
origin: OriginFor<T>,
who: T::AccountId,
) -> DispatchResultWithPostInfo {
T::GovernanceOrigin::ensure_origin(origin)?;
let deposit =
PendingApplications::<T>::take(&who).ok_or(Error::<T>::NoApplicationFound)?;
ensure!(
T::AccountCheck::allowed_candidacy(&who),
Error::<T>::NotAllowedCandidate
);
// Check candidate limits
let current_candidates = Candidates::<T>::decode_len().unwrap_or_default() as u32;
ensure!(
current_candidates < DesiredCandidates::<T>::get(),