mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 13:17:56 +00:00
@@ -16,6 +16,7 @@
|
||||
|
||||
//! Primitives that may be used at (bridges) runtime level.
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use codec::{Decode, Encode, FullCodec, MaxEncodedLen};
|
||||
@@ -61,36 +62,6 @@ pub use sp_runtime::paste;
|
||||
/// Use this when something must be shared among all instances.
|
||||
pub const NO_INSTANCE_ID: ChainId = [0, 0, 0, 0];
|
||||
|
||||
/// Polkadot chain id.
|
||||
pub const POLKADOT_CHAIN_ID: ChainId = *b"pdot";
|
||||
|
||||
/// Polkadot Bulletin chain id.
|
||||
pub const POLKADOT_BULLETIN_CHAIN_ID: ChainId = *b"pdbc";
|
||||
|
||||
/// Kusama chain id.
|
||||
pub const KUSAMA_CHAIN_ID: ChainId = *b"ksma";
|
||||
|
||||
/// Westend chain id.
|
||||
pub const WESTEND_CHAIN_ID: ChainId = *b"wend";
|
||||
|
||||
/// `AssetHubWestmint` chain id.
|
||||
pub const ASSET_HUB_WESTEND_CHAIN_ID: ChainId = *b"ahwe";
|
||||
|
||||
/// Rococo chain id.
|
||||
pub const ROCOCO_CHAIN_ID: ChainId = *b"roco";
|
||||
|
||||
/// BridgeHubRococo chain id.
|
||||
pub const BRIDGE_HUB_ROCOCO_CHAIN_ID: ChainId = *b"bhro";
|
||||
|
||||
/// BridgeHubWestend chain id.
|
||||
pub const BRIDGE_HUB_WESTEND_CHAIN_ID: ChainId = *b"bhwd";
|
||||
|
||||
/// BridgeHubKusama chain id.
|
||||
pub const BRIDGE_HUB_KUSAMA_CHAIN_ID: ChainId = *b"bhks";
|
||||
|
||||
/// BridgeHubPolkadot chain id.
|
||||
pub const BRIDGE_HUB_POLKADOT_CHAIN_ID: ChainId = *b"bhpd";
|
||||
|
||||
/// Generic header Id.
|
||||
#[derive(
|
||||
RuntimeDebug,
|
||||
@@ -126,10 +97,10 @@ pub type HeaderIdOf<C> = HeaderId<HashOf<C>, BlockNumberOf<C>>;
|
||||
|
||||
/// Generic header id provider.
|
||||
pub trait HeaderIdProvider<Header: HeaderT> {
|
||||
// Get the header id.
|
||||
/// Get the header id.
|
||||
fn id(&self) -> HeaderId<Header::Hash, Header::Number>;
|
||||
|
||||
// Get the header id for the parent block.
|
||||
/// Get the header id for the parent block.
|
||||
fn parent_id(&self) -> Option<HeaderId<Header::Hash, Header::Number>>;
|
||||
}
|
||||
|
||||
@@ -342,7 +313,7 @@ pub trait StorageDoubleMapKeyProvider {
|
||||
}
|
||||
|
||||
/// Error generated by the `OwnedBridgeModule` trait.
|
||||
#[derive(Encode, Decode, TypeInfo, PalletError)]
|
||||
#[derive(Encode, Decode, PartialEq, Eq, TypeInfo, PalletError)]
|
||||
pub enum OwnedBridgeModuleError {
|
||||
/// All pallet operations are halted.
|
||||
Halted,
|
||||
@@ -350,7 +321,7 @@ pub enum OwnedBridgeModuleError {
|
||||
|
||||
/// Operating mode for a bridge module.
|
||||
pub trait OperatingMode: Send + Copy + Debug + FullCodec {
|
||||
// Returns true if the bridge module is halted.
|
||||
/// Returns true if the bridge module is halted.
|
||||
fn is_halted(&self) -> bool;
|
||||
}
|
||||
|
||||
@@ -392,8 +363,11 @@ pub trait OwnedBridgeModule<T: frame_system::Config> {
|
||||
/// The target that will be used when publishing logs related to this module.
|
||||
const LOG_TARGET: &'static str;
|
||||
|
||||
/// A storage entry that holds the module `Owner` account.
|
||||
type OwnerStorage: StorageValue<T::AccountId, Query = Option<T::AccountId>>;
|
||||
/// Operating mode type of the pallet.
|
||||
type OperatingMode: OperatingMode;
|
||||
/// A storage value that holds the pallet operating mode.
|
||||
type OperatingModeStorage: StorageValue<Self::OperatingMode, Query = Self::OperatingMode>;
|
||||
|
||||
/// Check if the module is halted.
|
||||
@@ -469,9 +443,11 @@ impl WeightExtraOps for Weight {
|
||||
|
||||
/// Trait that provides a static `str`.
|
||||
pub trait StaticStrProvider {
|
||||
/// Static string.
|
||||
const STR: &'static str;
|
||||
}
|
||||
|
||||
/// A macro that generates `StaticStrProvider` with the string set to its stringified argument.
|
||||
#[macro_export]
|
||||
macro_rules! generate_static_str_provider {
|
||||
($str:expr) => {
|
||||
@@ -485,6 +461,7 @@ macro_rules! generate_static_str_provider {
|
||||
};
|
||||
}
|
||||
|
||||
/// Error message that is only dispayable in `std` environment.
|
||||
#[derive(Encode, Decode, Clone, Eq, PartialEq, PalletError, TypeInfo)]
|
||||
#[scale_info(skip_type_params(T))]
|
||||
pub struct StrippableError<T> {
|
||||
|
||||
Reference in New Issue
Block a user