Skip to content

Commit

Permalink
Merge branch 'main' into region-pallet
Browse files Browse the repository at this point in the history
  • Loading branch information
Szegoo authored Apr 15, 2024
2 parents 0c3a703 + c8af1ac commit da3c3f2
Show file tree
Hide file tree
Showing 8 changed files with 218 additions and 18 deletions.
65 changes: 65 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ frame-system-rpc-runtime-api = { version = "26.0.0", default-features = false }
frame-try-runtime = { version = "0.34.0", default-features = false }
pallet-aura = { version = "27.0.0", default-features = false }
pallet-authorship = { version = "28.0.0", default-features = false }
pallet-assets = { version = "29.0.0", default-features = false }
pallet-balances = { version = "28.0.0", default-features = false }
pallet-broker = { version = "0.6.0", default-features = false }
pallet-session = { version = "28.0.0", default-features = false }
Expand Down Expand Up @@ -130,6 +131,10 @@ cumulus-client-collator = "0.7.0"
substrate-wasm-builder = { version = "17.0.0" }
substrate-build-script-utils = "11.0.0"

# Orml
orml-asset-registry = { version = "0.7.0", default-features = false }
orml-traits = { version = "0.7.0", default-features = false }

# Polytope Labs
ismp = { git="https://github.com/polytope-labs/hyperbridge.git", branch="main", default-features = false }
pallet-ismp = { git="https://github.com/polytope-labs/hyperbridge.git", branch="main", default-features = false }
Expand Down
4 changes: 4 additions & 0 deletions runtime/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ homepage.workspace = true
repository.workspace = true

[dependencies]
parity-scale-codec = { workspace = true }
scale-info = { workspace = true }

sp-core = { workspace = true, default-features = false }
sp-runtime = { workspace = true, default-features = false }

[features]
default = ["std"]
std = [
"parity-scale-codec/std",
"scale-info/std",
"sp-core/std",
"sp-runtime/std",
]
18 changes: 18 additions & 0 deletions runtime/primitives/src/assets.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;

#[derive(
Clone,
Copy,
Default,
PartialOrd,
Ord,
PartialEq,
Eq,
Debug,
Encode,
Decode,
TypeInfo,
MaxEncodedLen,
)]
pub struct CustomMetadata;
2 changes: 2 additions & 0 deletions runtime/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

#![cfg_attr(not(feature = "std"), no_std)]

pub mod assets;

use sp_runtime::{
generic,
traits::{BlakeTwo256, IdentifyAccount, Verify},
Expand Down
11 changes: 11 additions & 0 deletions runtime/regionx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ ismp-parachain = { workspace = true, default-features = false }
pallet-ismp-runtime-api = { workspace = true, default-features = false }
ismp-parachain-runtime-api = { workspace = true, default-features = false }

# Orml
orml-asset-registry = { workspace = true }
orml-traits = { workspace = true }

# Substrate
frame-benchmarking = { workspace = true, optional = true }
frame-executive = { workspace = true }
Expand All @@ -38,6 +42,7 @@ frame-system = { workspace = true }
frame-system-benchmarking = { workspace = true, optional = true }
frame-system-rpc-runtime-api = { workspace = true }
frame-try-runtime = { workspace = true, optional = true }
pallet-assets = { workspace = true }
pallet-aura = { workspace = true }
pallet-authorship = { workspace = true }
pallet-balances = { workspace = true }
Expand Down Expand Up @@ -107,6 +112,8 @@ std = [
"frame-system/std",
"frame-try-runtime?/std",
"log/std",
"orml-asset-registry/std",
"pallet-assets/std",
"pallet-aura/std",
"pallet-authorship/std",
"pallet-balances/std",
Expand Down Expand Up @@ -155,6 +162,8 @@ runtime-benchmarks = [
"frame-system-benchmarking/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"hex-literal",
"orml-asset-registry/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
Expand All @@ -180,8 +189,10 @@ try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"frame-try-runtime/try-runtime",
"orml-asset-registry/try-runtime",
"pallet-ismp/try-runtime",
"ismp-parachain/try-runtime",
"pallet-assets/try-runtime",
"pallet-aura/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
Expand Down
30 changes: 30 additions & 0 deletions runtime/regionx/src/impls.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use crate::{AssetId, Runtime};
use orml_asset_registry::DefaultAssetMetadata;
use orml_traits::asset_registry::AssetProcessor;
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_runtime::DispatchError;

#[derive(
Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Debug, Encode, Decode, TypeInfo, MaxEncodedLen,
)]
pub struct CustomAssetProcessor;

impl AssetProcessor<AssetId, DefaultAssetMetadata<Runtime>> for CustomAssetProcessor {
fn pre_register(
id: Option<AssetId>,
metadata: DefaultAssetMetadata<Runtime>,
) -> Result<(AssetId, DefaultAssetMetadata<Runtime>), DispatchError> {
match id {
Some(id) => Ok((id, metadata)),
None => Err(DispatchError::Other("asset-registry: AssetId is required")),
}
}

fn post_register(
_id: AssetId,
_metadata: DefaultAssetMetadata<Runtime>,
) -> Result<(), DispatchError> {
Ok(())
}
}
Loading

0 comments on commit da3c3f2

Please sign in to comment.