Skip to content

Commit

Permalink
primitive integration for shiden, local
Browse files Browse the repository at this point in the history
  • Loading branch information
gitofdeepanshu committed Jun 20, 2023
1 parent 527b1ff commit c708b4a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 45 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions runtime/local/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ pallet-evm-precompile-sr25519 = { workspace = true }
pallet-evm-precompile-substrate-ecdsa = { workspace = true }
pallet-evm-precompile-xvm = { workspace = true }
pallet-xvm = { workspace = true, features = ["evm", "wasm"] }
astar-core-primitives = { workspace = true }

# Moonbeam tracing
moonbeam-evm-tracer = { workspace = true, optional = true }
Expand Down Expand Up @@ -160,6 +161,7 @@ std = [
"moonbeam-rpc-primitives-txpool/std",
"substrate-wasm-builder",
"pallet-chain-extension-assets/std",
"astar-core-primitives/std",
]
runtime-benchmarks = [
"frame-benchmarking",
Expand Down
27 changes: 7 additions & 20 deletions runtime/local/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,21 @@ use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{
AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto,
DispatchInfoOf, Dispatchable, IdentifyAccount, NumberFor, PostDispatchInfoOf,
DispatchInfoOf, Dispatchable, NumberFor, PostDispatchInfoOf,
UniqueSaturatedInto, Verify,
},
transaction_validity::{
TransactionPriority, TransactionSource, TransactionValidity, TransactionValidityError,
},
ApplyExtrinsicResult, MultiSignature, RuntimeDebug,
ApplyExtrinsicResult, RuntimeDebug,
};
use sp_std::prelude::*;

pub use astar_core_primitives::{
AccountId, Address, AssetId, Balance, BlockNumber, Hash, Header,
Index, Signature
};

#[cfg(feature = "std")]
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;
Expand Down Expand Up @@ -138,7 +143,6 @@ pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
pub const HOURS: BlockNumber = MINUTES * 60;
pub const DAYS: BlockNumber = HOURS * 24;

pub type AssetId = u128;

impl AddressToAssetId<AssetId> for Runtime {
fn address_to_asset_id(address: H160) -> Option<AssetId> {
Expand Down Expand Up @@ -996,23 +1000,6 @@ construct_runtime!(
}
);

/// Balance of an account.
pub type Balance = u128;
/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
pub type Signature = MultiSignature;
/// Some way of identifying an account on the chain. We intentionally make it equivalent
/// to the public key of our transaction signing scheme.
pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;
/// Index of a transaction in the chain.
pub type Index = u32;
/// A hash of some data used by the chain.
pub type Hash = sp_core::H256;
/// An index to a block.
pub type BlockNumber = u32;
/// The address format for describing accounts.
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
/// Block header type as expected by this runtime.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Block type as expected by this runtime.
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
/// A Block signed with a Justification
Expand Down
2 changes: 2 additions & 0 deletions runtime/shiden/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ pallet-evm-precompile-xcm = { workspace = true }
pallet-xc-asset-config = { workspace = true }
pallet-xcm = { workspace = true }
xcm-primitives = { workspace = true }
astar-core-primitives = { workspace = true }

# Moonbeam tracing
moonbeam-evm-tracer = { workspace = true, optional = true }
Expand Down Expand Up @@ -212,6 +213,7 @@ std = [
"orml-xtokens/std",
"orml-traits/std",
"orml-xcm-support/std",
"astar-core-primitives/std",
]
runtime-benchmarks = [
"frame-benchmarking",
Expand Down
30 changes: 5 additions & 25 deletions runtime/shiden/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ use sp_runtime::{
};
use sp_std::prelude::*;

pub use astar_core_primitives::{
AccountId, Address, AssetId, Balance, BlockNumber, Hash, Header,
Index, Signature
};

use pallet_evm_precompile_assets_erc20::AddressToAssetId;
use xcm_primitives::AssetLocationIdConverter;

Expand Down Expand Up @@ -530,14 +535,6 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
}

/// Id used for identifying assets.
///
/// AssetId allocation:
/// [1; 2^32-1] Custom user assets (permissionless)
/// [2^32; 2^64-1] Statemine assets (simple map)
/// [2^64; 2^128-1] Ecosystem assets
/// 2^128-1 Relay chain token (KSM)
pub type AssetId = u128;

impl AddressToAssetId<AssetId> for Runtime {
fn address_to_asset_id(address: H160) -> Option<AssetId> {
Expand Down Expand Up @@ -1050,23 +1047,6 @@ construct_runtime!(
}
);

/// Balance of an account.
pub type Balance = u128;
/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
pub type Signature = sp_runtime::MultiSignature;
/// Some way of identifying an account on the chain. We intentionally make it equivalent
/// to the public key of our transaction signing scheme.
pub type AccountId = <<Signature as sp_runtime::traits::Verify>::Signer as sp_runtime::traits::IdentifyAccount>::AccountId;
/// Index of a transaction in the chain.
pub type Index = u32;
/// A hash of some data used by the chain.
pub type Hash = sp_core::H256;
/// An index to a block.
pub type BlockNumber = u32;
/// The address format for describing accounts.
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
/// Block header type as expected by this runtime.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Block type as expected by this runtime.
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
/// A Block signed with a Justification
Expand Down

0 comments on commit c708b4a

Please sign in to comment.