Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
b6cc206
Add hyperbridge deps
F3Joule Jun 6, 2025
a84d96f
Add hyperbridge to a runtime
F3Joule Jun 6, 2025
86ab036
Add ismp rpc
F3Joule Jun 6, 2025
484ca87
Add ismp parachain inherent
F3Joule Jun 6, 2025
34e2b31
Add ismp parachain benchmarks
F3Joule Jun 6, 2025
f1b294b
Revert Cargo.lock
F3Joule Jun 9, 2025
ccf0e1f
Merge branch 'master' into feat/hyperbridge
F3Joule Jun 9, 2025
37f8539
Update Cargo.lock
F3Joule Jun 9, 2025
ecf4350
Update Cargo.lock
F3Joule Jun 9, 2025
02e4430
Fix runtime mock
F3Joule Jun 9, 2025
3d3c112
Move hyperbridge config to a separate file
F3Joule Jun 13, 2025
da4f488
Add pallet-token-gateway to deps
F3Joule Jun 13, 2025
34b6753
Add hyperbridge chopsticks config
F3Joule Jun 13, 2025
a10efee
Merge remote-tracking branch 'origin/master' into feat/hyperbridge
F3Joule Jun 13, 2025
5d66883
Add token gateway pallet src
F3Joule Jun 27, 2025
d478672
Add token gateway deps
F3Joule Jun 27, 2025
a187e92
Fix errors and code formatting
F3Joule Jun 27, 2025
d745f32
Merge branch 'master' into feat/hyperbridge
F3Joule Jul 9, 2025
722e745
Merge branch 'master' into feat/hyperbridge
F3Joule Aug 14, 2025
d10ac65
Update Cargo.lock
F3Joule Aug 14, 2025
bf4acd7
Merge branch 'master' into feat/hyperbridge
F3Joule Aug 18, 2025
de5193c
Merge branch 'master' into feat/hyperbridge
F3Joule Aug 20, 2025
27db299
Change MultiCurrency provider for ismp token gateway
F3Joule Aug 20, 2025
b6e30a9
Change ismp fee token to USDC
F3Joule Aug 20, 2025
19d48bb
Merge branch 'master' into feat/hyperbridge
F3Joule Aug 21, 2025
52978d7
fix ismp pallet config params
F3Joule Aug 21, 2025
d565d80
Merge branch 'master' into feat/hyperbridge
F3Joule Aug 22, 2025
5be6d70
Merge branch 'master' into feat/hyperbridge
F3Joule Sep 1, 2025
c466ad5
new ismp pallet config params
F3Joule Sep 1, 2025
12d4d29
Replace custom gateway implementation with standard one
F3Joule Sep 1, 2025
1c723d0
Implement fungibles::metadata::Inspect for FungibleCurrencies
F3Joule Sep 1, 2025
429de3a
Merge branch 'master' into feat/hyperbridge
F3Joule Sep 5, 2025
efe219a
Merge branch 'master' into feat/hyperbridge
F3Joule Sep 11, 2025
116a374
Refactor fungibles metadata implementation
F3Joule Sep 11, 2025
a8c06de
fix tests
F3Joule Sep 11, 2025
93123cf
bump crates versions
F3Joule Sep 11, 2025
0683b54
fix tests
F3Joule Sep 12, 2025
19c0b14
Enable offchain indexing for full nodes by default
F3Joule Sep 12, 2025
0a0cb72
Add initial weights for ismp_parachain
F3Joule Sep 12, 2025
dab1fe8
Fix token gateway benchmarks
F3Joule Sep 12, 2025
bad8a49
Merge branch 'master' into feat/hyperbridge
F3Joule Sep 15, 2025
eacb833
Merge branch 'master' into feat/hyperbridge
F3Joule Sep 16, 2025
6ec2315
Update pallets weights [ignore benchmarks]
F3Joule Sep 16, 2025
357e445
Provide EvmToSubstrate implementation for token gateway
F3Joule Oct 2, 2025
14012f7
Add ismp related weights to weights module
F3Joule Oct 2, 2025
424e3fb
Fix WeightInfo implementation in hyperbridge configs
F3Joule Oct 2, 2025
b857c43
Add benchmarks for token gateway ismp handlers
F3Joule Oct 7, 2025
5017ec8
Add IsmpWeightProvider
F3Joule Oct 7, 2025
70b46b4
Bump crates versions
F3Joule Oct 7, 2025
fb1bd75
Increment runtime version
F3Joule Oct 7, 2025
67889e1
Fix benchmarking for ismp modules
F3Joule Oct 7, 2025
7a1640f
Bump ismp dependencies
F3Joule Oct 9, 2025
89bb6bc
Remove redundant benchmarks feature from token gateway pallet
F3Joule Oct 9, 2025
7052b89
Merge branch 'master' into feat/hyperbridge
F3Joule Oct 9, 2025
3780572
Fix benchmarking script for ismp pallets
F3Joule Oct 9, 2025
7636b4f
Update pallets weights [ignore benchmarks]
F3Joule Oct 9, 2025
20ee745
Update pallets weights [ignore benchmarks]
F3Joule Oct 9, 2025
4e05598
Revert unneeded weights changes
F3Joule Oct 14, 2025
b4b9230
Merge branch 'master' into feat/hyperbridge
F3Joule Oct 14, 2025
6cb3113
Increase runtime version
F3Joule Oct 14, 2025
8993f5b
Bump crates versions
F3Joule Oct 14, 2025
4385222
Merge branch 'master' into feat/hyperbridge
F3Joule Oct 15, 2025
993f2d1
Update crates versions
F3Joule Oct 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,792 changes: 3,399 additions & 393 deletions Cargo.lock

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,25 @@ cumulus-client-pov-recovery = { git = "https://github.com/galacticcouncil/polkad
cumulus-pallet-parachain-system-proc-macro = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch4" }
cumulus-relay-chain-rpc-interface = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch4" }

# Hyperbridge
anyhow = { version = "1.0", default-features = false }
alloy-sol-macro = "0.7.7"
alloy-sol-types = { version = "0.7.7", default-features = false }
alloy-primitives = { version = "0.7.7", default-features = false, features = ["rlp"] }

pallet-hyperbridge = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409", default-features = false }
pallet-token-gateway = { path = "pallets/token-gateway", default-features = false }

pallet-ismp = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409", default-features = false }
pallet-ismp-runtime-api = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409", default-features = false }

ismp = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409", default-features = false }
ismp-parachain = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409", default-features = false }
ismp-parachain-runtime-api = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409", default-features = false }

pallet-ismp-rpc = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409" }
ismp-parachain-inherent = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409" }

[patch."https://github.com/moonbeam-foundation/open-runtime-module-library"]
# ORML dependencies
orml-benchmarking = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-stable2409" }
Expand Down Expand Up @@ -546,6 +565,7 @@ cumulus-pallet-parachain-system-proc-macro = { git = "https://github.com/galacti
cumulus-relay-chain-rpc-interface = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch4" }

[patch."https://github.com/paritytech/polkadot-sdk"]
polkadot-sdk = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch4" }
frame-benchmarking = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch4" }
frame-benchmarking-cli = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch4" }
frame-executive = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch4" }
Expand Down Expand Up @@ -702,3 +722,7 @@ westend-runtime = { git = "https://github.com/galacticcouncil/polkadot-sdk", bra
cumulus-client-pov-recovery = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch4" }
cumulus-pallet-parachain-system-proc-macro = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch4" }
cumulus-relay-chain-rpc-interface = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch4" }

[patch."https://github.com/bifrost-io/open-runtime-module-library"]
orml-xcm-support = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-stable2409" }
orml-traits = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-stable2409" }
16 changes: 16 additions & 0 deletions launch-configs/chopsticks/hyperbridge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
endpoint: wss://nexus.ibp.network
mock-signature-host: true
db: ./hyperbridge.db.sqlite

import-storage:
System:
Account:
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- data:
free: '10000000000000000000'
TechnicalCollective:
Members: [5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY]
Sudo:
Key: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
5 changes: 5 additions & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ fp-rpc = { workspace = true }
fp-storage = { workspace = true }
fp-consensus = { workspace = true }

# Hyperbridge
pallet-ismp-runtime-api = { workspace = true }
pallet-ismp-rpc = { workspace = true }
ismp-parachain-inherent = { workspace = true }

[features]
default = [
"frame-benchmarking-cli",
Expand Down
9 changes: 7 additions & 2 deletions node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ pub use fc_rpc::{EthBlockDataCacheTask, StorageOverride, StorageOverrideHandler}
pub use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool};
use fp_rpc::{ConvertTransaction, ConvertTransactionRuntimeApi, EthereumRuntimeRPCApi};
use hydradx_runtime::{opaque::Block, AccountId, Balance, Index};
use pallet_ismp_rpc::{IsmpApiServer, IsmpRpcHandler};
use sc_client_api::{
backend::{Backend, StateBackend, StorageProvider},
client::BlockchainEvents,
BlockBackend, ProofProvider,
};
use sc_network::service::traits::NetworkService;
use sc_network_sync::SyncingService;
Expand Down Expand Up @@ -107,11 +109,12 @@ pub type RpcExtension = jsonrpsee::RpcModule<()>;
/// Instantiate all full RPC extensions.
pub fn create_full<C, P, B>(deps: FullDeps<C, P, B>) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
where
C: ProvideRuntimeApi<Block>,
C: ProvideRuntimeApi<Block> + BlockBackend<Block> + ProofProvider<Block>,
C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError>,
C: Send + Sync + 'static,
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
C::Api: pallet_ismp_runtime_api::IsmpRuntimeApi<Block, sp_core::H256>,
C::Api: BlockBuilderApi<Block>,
P: TransactionPool + Sync + Send + 'static,
B: sc_client_api::Backend<Block> + Send + Sync + 'static,
Expand All @@ -126,7 +129,9 @@ where

module.merge(System::new(client.clone(), pool).into_rpc())?;
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
module.merge(StateMigration::new(client, backend).into_rpc())?;
module.merge(StateMigration::new(client.clone(), backend.clone()).into_rpc())?;

module.merge(IsmpRpcHandler::new(client, backend)?.into_rpc())?;

Ok(module)
}
Expand Down
13 changes: 12 additions & 1 deletion node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,19 @@ fn start_consensus(
client.clone(),
);

let (client_clone, relay_chain_interface_clone) = (client.clone(), relay_chain_interface.clone());
let params = AuraParams {
create_inherent_data_providers: move |_, ()| async move { Ok(()) },
create_inherent_data_providers: move |parent, ()| {
let client = client_clone.clone();
let relay_chain_interface = relay_chain_interface_clone.clone();
async move {
let inherent =
ismp_parachain_inherent::ConsensusInherentProvider::create(parent, client, relay_chain_interface)
.await?;

Ok(inherent)
}
},
block_import,
para_client: client.clone(),
para_backend: backend.clone(),
Expand Down
71 changes: 71 additions & 0 deletions pallets/token-gateway/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[package]
name = "pallet-token-gateway"
version = "16.2.0"
edition = "2021"
description = "A substrate implementation of the token gateway protocol"
authors = ["Polytope Labs <hello@polytope.technology>"]
license = "Apache-2.0"
repository = "https://github.com/polytope-labs/hyperbridge"
homepage = "https://docs.hyperbridge.network/developers/polkadot/token-gateway"
documentation = "https://docs.rs/pallet-token-gateway"
keywords = [
"substrate",
"polkadot-sdk",
"ISMP",
"interoperability",
"pallet-assets",
]
readme = "README.md"

[dependencies]
frame-benchmarking = { workspace = true, optional = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-runtime = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
primitive-types = { workspace = true }
log = { workspace = true }
codec = { workspace = true }
scale-info = { workspace = true }
anyhow = { workspace = true }
alloy-primitives = { workspace = true }
alloy-sol-macro = { workspace = true }
alloy-sol-types = { workspace = true }

ismp = { workspace = true }
pallet-ismp = { workspace = true }
token-gateway-primitives = { path = "./primitives", default-features = false }
pallet-hyperbridge = { workspace = true }

hydradx-traits = { workspace = true }
orml-traits = { workspace = true }
primitives = { workspace = true }

[features]
default = ["std"]
std = [
"frame-support/std",
"frame-system/std",
"sp-runtime/std",
"sp-core/std",
"sp-io/std",
"primitive-types/std",
"ismp/std",
"pallet-ismp/std",
"log/std",
"scale-info/std",
"anyhow/std",
"alloy-primitives/std",
"pallet-hyperbridge/std",
"token-gateway-primitives/std",
"hydradx-traits/std",
"orml-traits/std",
"primitives/std",
]
runtime-benchmarks = [
"frame-benchmarking",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
]
try-runtime = ["frame-support/try-runtime"]
89 changes: 89 additions & 0 deletions pallets/token-gateway/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Pallet Token Gateway

This allows polkadot-sdk chains make cross-chain asset transfers to and from each other as well EVM chains using Hyperbridge.

## Overview

The Pallet allows the [`CreateOrigin`](https://docs.rs/pallet-token-gateway/latest/pallet_token_gateway/pallet/trait.Config.html#associatedtype.CreateOrigin) to dispatch calls for setting token gateway addresses, creating and updating assets.
This enables receiving assets from those configured chains. Assets can also be received with a runtime call to be dispatched. This call must be signed by the beneficiary of the incoming assets. Assets can also be sent with some calldata, this calldata is an opaque blob of bytes
whose interpretation is left up to the recipient token gateway implementation. For polkadot-sdk chains, it must be a scale-encoded runtime call, for EVM chains it must be an abi-encoded contract call.

## Adding to Runtime

The first step is to implement the pallet config for the runtime.

```rust,ignore
use frame_support::parameter_types;
use ismp::module::IsmpModule;
use ismp::router::IsmpRouter;
use pallet_token_gateway::types::NativeAssetLocation;

parameter_types! {
// Set the correct precision for the native currency
pub const Decimals: u8 = 12;
}


/// A constant value that represents the native asset
const NativeAssetId: u32 = 0;


/// Should provide an account that is funded and can be used to pay for asset creation
pub struct AssetAdmin;

impl Get<AccountId> for AssetAdmin {
fn get() -> AccountId {
Treasury::account_id()
}
}

impl pallet_token_gateway::Config for Runtime {
// configure the runtime event
type RuntimeEvent = RuntimeEvent;
// pallet_ismp or pallet_hyperbridge
type Dispatcher = pallet_hyperbridge::Pallet<Runtime>;
// Pallet Assets
type Assets = Assets;
// Pallet balances
type Currency = Balances;
// AssetAdmin account
type AssetAdmin = AssetAdmin;
// The Native asset Id
type NativeAssetId = NativeAssetId;
// The precision of the native asset
type Decimals = Decimals;
}

// Add the pallet to your ISMP router to receive assets from external chains
#[derive(Default)]
struct Router;
impl IsmpRouter for Router {
fn module_for_id(&self, id: Vec<u8>) -> Result<Box<dyn IsmpModule>, anyhow::Error> {
let module = match id.as_slice() {
id if TokenGateway::is_token_gateway(&id) => Box::new(TokenGateway::default()),
_ => Err(Error::ModuleNotFound(id))?
};
Ok(module)
}
}
```

## Setting up

The pallet requires some setting up before the teleport function is available for use in the runtime.

1. Register your native assets directly on `Hyperbridge` by dispatching `create_erc6160_asset`.
3. Set token gateway addresses for the EVM chains of interest by dispatching the `set_token_gateway_addresses` extrinsic. These addresses are used to validate incoming messages.


## Dispatchable Functions

- `teleport` - This function is used to bridge assets through Hyperbridge.
- `set_token_gateway_addresses` - This call allows the `AdminOrigin` origin to set the token gateway address for supported chains.
- `create_erc6160_asset` - This call dispatches a request to Hyperbridge to create multi chain native assets on token gateway deployments
- `update_erc6160_asset` - This priviledged call dispatches a request to Hyperbridge to update multi chain native assets on token gateway deployments
- `update_asset_precision` - This priviledged call is used to set or update the precision for an asset deployed on a remote chain

## License

This library is licensed under the Apache 2.0 License, Copyright (c) 2025 Polytope Labs.
56 changes: 56 additions & 0 deletions pallets/token-gateway/primitives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[package]
name = "token-gateway-primitives"
version = "16.0.0"
edition = "2021"
description = "A collection of types used by token gateway"
authors = ["Polytope Labs <hello@polytope.technology>"]
license = "Apache-2.0"
repository = "https://github.com/polytope-labs/hyperbridge"
homepage = "https://docs.hyperbridge.network/developers/polkadot/tokengateway"
documentation = "https://docs.rs/pallet-token-gateway"
keywords = [
"substrate",
"polkadot-sdk",
"ISMP",
"interoperability",
"pallet-assets",
]
readme = "README.md"

[dependencies]
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-runtime = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
primitive-types = { workspace = true }

ismp = { workspace = true }
pallet-ismp = { workspace = true }

log = { workspace = true }
codec = { workspace = true }
scale-info = { workspace = true }
anyhow = { workspace = true }

alloy-primitives = { workspace = true }
alloy-sol-macro = { workspace = true }
alloy-sol-types = { workspace = true }

[features]
default = ["std"]
std = [
"frame-support/std",
"frame-system/std",
"sp-runtime/std",
"sp-core/std",
"sp-io/std",
"primitive-types/std",
"ismp/std",
"pallet-ismp/std",
"log/std",
"scale-info/std",
"anyhow/std",
"alloy-primitives/std",
]
try-runtime = ["frame-support/try-runtime"]
7 changes: 7 additions & 0 deletions pallets/token-gateway/primitives/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Token Gateway Primitives

A collection of types used by [pallet-token-gateway](https://crates.io/crates/pallet-token-gateway)

## License

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