INNER CODE UNIT · Rust

leave_intent

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

        pub fn leave_intent(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
            let who = ensure_signed(origin)?;
            ensure!(
                Candidates::<T>::get().len() as u32 > T::MinCandidates::get(),
                Error::<T>::TooFewCandidates
            );
            let current_count = Self::try_remove_candidate(&who)?;
            Ok(Some(T::WeightInfo::leave_intent(current_count as u32)).into())
        }

        /// Withdraw `CandidacyBond` after un-bonding period has finished.
        /// This call will fail called during un-bonding or if there's no `CandidacyBound` reserved.
        #[pallet::call_index(5)]
        #[pallet::weight(T::WeightInfo::withdraw_bond())]
        pub fn withdraw_bond(origin: OriginFor<T>) -> DispatchResult {
            let who = ensure_signed(origin)?;

            <NonCandidates<T>>::try_mutate_exists(&who, |maybe| -> DispatchResult {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…