Crate pallet_hyperbridge

Source
Expand description

§Pallet Hyperbridge

Pallet hyperbridge mediates the connection between hyperbridge and substrate-based chains. This pallet provides:

  • An IsmpDispatcher implementation which collects hyperbridge’s protocol fees and commits the reciepts for these fees to child storage. Hyperbridge will only accept messages that have been paid for using this module.
  • An IsmpModule which recieves and processes requests from hyperbridge. These requests are dispatched by hyperbridge governance and may adjust fees or request payouts for both relayers and protocol revenue.

This pallet contains no calls and dispatches no requests. Substrate based chains should use this to dispatch requests that should be processed by hyperbridge.

§Usage

This module must be configured as an IsmpModule in your IsmpRouter implementation so that it may receive important messages from hyperbridge such as paramter updates or relayer fee withdrawals.

use ismp::module::IsmpModule;
use ismp::router::IsmpRouter;

#[derive(Default)]
struct ModuleRouter;

impl IsmpRouter for ModuleRouter {
    fn module_for_id(&self, id: Vec<u8>) -> Result<Box<dyn IsmpModule>, anyhow::Error> {
        return match id.as_slice() {
            pallet_hyperbridge::PALLET_HYPERBRIDGE_ID => Ok(Box::new(pallet_hyperbridge::Pallet::<Runtime>::default())),
            _ => Err(Error::ModuleNotFound(id)),
        };
    }
}

Re-exports§

pub use pallet::*;

Modules§

child_trie
Child trie storage layout for pallet-hyperbridge
pallet
The pallet module in each FRAME pallet hosts the most important items needed to construct this pallet.

Structs§

SubstrateHostParams
Host params for substrate based chains
WithdrawalRequest
A request to withdraw some funds. Could either be for protocol revenue or relayer fees.

Enums§

Message
Cross-chain messages to this module. This module will only accept messages from the hyperbridge chain. Assumed to be configured in pallet_ismp::Config
VersionedHostParams
Parameters that govern the working operations of this module. Versioned for ease of migration.