#substrate #interop #ismp #polkadot-sdk

no-std pallet-hyperbridge

Pallet hyperbridge mediates the connection between hyperbridge and substrate-based chains

6 stable releases

new 15.0.0 Jan 10, 2025
1.15.3 Dec 10, 2024
1.15.1 Oct 15, 2024
1.15.0 Sep 19, 2024
1.6.2 May 10, 2024

#491 in Magic Beans

Download history 14/week @ 2024-09-25 5/week @ 2024-10-02 103/week @ 2024-10-09 62/week @ 2024-10-16 3/week @ 2024-10-23 3/week @ 2024-10-30 10/week @ 2024-11-06 21/week @ 2024-11-13 10/week @ 2024-11-20 160/week @ 2024-12-04 139/week @ 2024-12-11 2/week @ 2024-12-18 155/week @ 2025-01-08

158 downloads per month
Used in pallet-token-gateway

Apache-2.0

200KB
3.5K SLoC

Pallet Hyperbridge

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

  • An IsmpDispatcher implementation which collects protocol fees and commits the reciepts for these fees to child storage. Hyperbridge only accepts 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::Error;
use ismp::module::IsmpModule;
use ismp::router::IsmpRouter;
use pallet_hyperbridge::PALLET_HYPERBRIDGE_ID;

#[derive(Default)]
struct ModuleRouter;

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

License

This library is licensed under the Apache 2.0 License, Copyright (c) 2025 Polytope Labs.

Dependencies

~20–35MB
~576K SLoC