referrerpolicy=no-referrer-when-downgrade
bp_runtime

Trait OwnedBridgeModule

Source
pub trait OwnedBridgeModule<T: Config> {
    type OwnerStorage: StorageValue<T::AccountId, Query = Option<T::AccountId>>;
    type OperatingMode: OperatingMode;
    type OperatingModeStorage: StorageValue<Self::OperatingMode, Query = Self::OperatingMode>;

    const LOG_TARGET: &'static str;

    // Provided methods
    fn is_halted() -> bool { ... }
    fn ensure_owner_or_root(origin: T::RuntimeOrigin) -> Result<(), BadOrigin> { ... }
    fn ensure_not_halted() -> Result<(), OwnedBridgeModuleError> { ... }
    fn set_owner(
        origin: T::RuntimeOrigin,
        maybe_owner: Option<T::AccountId>,
    ) -> DispatchResult { ... }
    fn set_operating_mode(
        origin: T::RuntimeOrigin,
        operating_mode: Self::OperatingMode,
    ) -> DispatchResult { ... }
    fn module_owner() -> Option<T::AccountId> { ... }
    fn operating_mode() -> Self::OperatingMode { ... }
}
Expand description

Bridge module that has owner and operating mode

Required Associated Constants§

Source

const LOG_TARGET: &'static str

The target that will be used when publishing logs related to this module.

Required Associated Types§

Source

type OwnerStorage: StorageValue<T::AccountId, Query = Option<T::AccountId>>

A storage entry that holds the module Owner account.

Source

type OperatingMode: OperatingMode

Operating mode type of the pallet.

Source

type OperatingModeStorage: StorageValue<Self::OperatingMode, Query = Self::OperatingMode>

A storage value that holds the pallet operating mode.

Provided Methods§

Source

fn is_halted() -> bool

Check if the module is halted.

Source

fn ensure_owner_or_root(origin: T::RuntimeOrigin) -> Result<(), BadOrigin>

Ensure that the origin is either root, or PalletOwner.

Source

fn ensure_not_halted() -> Result<(), OwnedBridgeModuleError>

Ensure that the module is not halted.

Source

fn set_owner( origin: T::RuntimeOrigin, maybe_owner: Option<T::AccountId>, ) -> DispatchResult

Change the owner of the module.

Source

fn set_operating_mode( origin: T::RuntimeOrigin, operating_mode: Self::OperatingMode, ) -> DispatchResult

Halt or resume all/some module operations.

Source

fn module_owner() -> Option<T::AccountId>

Pallet owner has a right to halt all module operations and then resume it. If it is None, then there are no direct ways to halt/resume module operations, but other runtime methods may still be used to do that (i.e. democracy::referendum to update halt flag directly or call the set_operating_mode).

Source

fn operating_mode() -> Self::OperatingMode

The current operating mode of the module. Depending on the mode either all, some, or no transactions will be allowed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

impl<T: Config<I>, I: 'static> OwnedBridgeModule<T> for Pallet<T, I>

impl<T: Config<I>, I: 'static> OwnedBridgeModule<T> for Pallet<T, I>

impl<T: Config<I>, I: 'static> OwnedBridgeModule<T> for Pallet<T, I>

impl<T: Config<I>, I: 'static> OwnedBridgeModule<T> for Pallet<T, I>