Skip to content

Commit

Permalink
Merge pull request #55 from AstarNetwork/feature/assets-frame-ce
Browse files Browse the repository at this point in the history
Assets CE from astar-frame
  • Loading branch information
PierreOssun authored Mar 20, 2023
2 parents 9958967 + cf59d72 commit 0e3fe0c
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 84 deletions.
111 changes: 35 additions & 76 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "swanky-node"
version = "1.2.0"
version = "1.3.0"
description = "Local Substrate node for wasm contract development & testing"
authors = ["Astar Network"]
homepage = "https://astar.network"
Expand Down
7 changes: 3 additions & 4 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "swanky-runtime"
version = "1.2.0"
version = "1.3.0"
description = "A fresh FRAME-based Substrate runtime, ready for hacking."
authors = ["Astar Network"]
homepage = "https://astar.network"
Expand Down Expand Up @@ -48,7 +48,7 @@ pallet-chain-extension-dapps-staking = { git = "https://github.com/AstarNetwork/
pallet-dapps-staking = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.37", default-features = false }

# pallet-asset chain-extension
pallet-assets-chain-extension = { git = "https://github.com/AstarNetwork/pallet-assets-chain-extension", default-features = false, features = ["substrate"], branch = "polkadot-v0.9.37" }
pallet-chain-extension-assets = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.37", default-features = false }

# Used for the node template's RPCs
frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.37" }
Expand Down Expand Up @@ -95,7 +95,7 @@ std = [
"sp-std/std",
"sp-transaction-pool/std",
"sp-version/std",
"pallet-assets-chain-extension/substrate-std",
"pallet-chain-extension-assets/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
Expand All @@ -109,7 +109,6 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"pallet-contracts/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-assets-chain-extension/runtime-benchmarks",
]
try-runtime = [
"log",
Expand Down
9 changes: 7 additions & 2 deletions runtime/src/chain_extensions.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
//!
use super::Runtime;
pub use pallet_chain_extension_assets::{weights::WeightInfo, AssetsExtension};
pub use pallet_chain_extension_dapps_staking::DappsStakingExtension;
/// Registered WASM contracts chain extensions.
use pallet_contracts::chain_extension::RegisteredChainExtension;

pub use pallet_chain_extension_dapps_staking::DappsStakingExtension;

// Following impls defines chain extension IDs.

impl RegisteredChainExtension<Runtime> for DappsStakingExtension<Runtime> {
const ID: u16 = 0x0000;
}

/// Based on chain-extension registry https://github.com/paritytech/chainextension-registry
impl<W: WeightInfo> RegisteredChainExtension<Runtime> for AssetsExtension<Runtime, W> {
const ID: u16 = 18678;
}
6 changes: 5 additions & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ use frame_system::{
EnsureSigned,
};
pub use pallet_balances::Call as BalancesCall;
use pallet_chain_extension_assets::weights::SubstrateWeight;
pub use pallet_chain_extension_assets::weights::WeightInfo as ChainExtensionWeightInfo;
pub use pallet_timestamp::Call as TimestampCall;
use pallet_transaction_payment::CurrencyAdapter;

#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
pub use sp_runtime::{Perbill, Permill};

// Chain extensions
use pallet_chain_extension_assets::AssetsExtension;
use pallet_chain_extension_dapps_staking::DappsStakingExtension;

mod chain_extensions;
Expand Down Expand Up @@ -344,7 +348,7 @@ impl pallet_contracts::Config for Runtime {
type WeightPrice = pallet_transaction_payment::Pallet<Self>;
type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
type ChainExtension =
(DappsStakingExtension<Self>, pallet_assets_chain_extension::substrate::AssetsExtension);
(DappsStakingExtension<Self>, AssetsExtension<Self, SubstrateWeight<Self>>);
type DeletionQueueDepth = ConstU32<128>;
type DeletionWeightLimit = DeletionWeightLimit;
type Schedule = Schedule;
Expand Down

0 comments on commit 0e3fe0c

Please sign in to comment.