INNER CODE UNIT · Rust

add_invulnerable

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

        pub fn add_invulnerable(
            origin: OriginFor<T>,
            who: T::AccountId,
        ) -> DispatchResultWithPostInfo {
            T::UpdateOrigin::ensure_origin(origin)?;
            Self::is_validator_registered(&who)?;

            <Invulnerables<T>>::try_mutate(|invulnerables| -> DispatchResult {
                ensure!(
                    !invulnerables.contains(&who),
                    Error::<T>::AlreadyInvulnerable
                );
                invulnerables.push(who);
                Ok(())
            })?;

            Self::deposit_event(Event::NewInvulnerables(<Invulnerables<T>>::get()));
            Ok(().into())

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…