difftreelog
feat connect split pallets via runtime
in: master
3 files changed
node/cli/src/chain_spec.rsdiffbeforeafterboth--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -5,7 +5,6 @@
use cumulus_primitives_core::ParaId;
use nft_runtime::*;
-use nft_data_structs::*;
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::ChainType;
use sp_core::{sr25519, Pair, Public};
@@ -175,34 +174,6 @@
.cloned()
.map(|k| (k, 1000, 100, 1 << 98))
.collect(),
- },
- nft: NftConfig {
- collection_id: vec![(
- 1,
- Collection {
- owner: get_account_id_from_seed::<sr25519::Public>("Alice"),
- mode: CollectionMode::NFT,
- access: AccessMode::Normal,
- decimal_points: 0,
- name: vec![],
- description: vec![],
- token_prefix: vec![],
- mint_mode: false,
- offchain_schema: vec![],
- schema_version: SchemaVersion::default(),
- sponsorship: SponsorshipState::Confirmed(get_account_id_from_seed::<
- sr25519::Public,
- >("Alice")),
- const_on_chain_schema: vec![],
- variable_on_chain_schema: vec![],
- limits: CollectionLimits::default(),
- meta_update_permission: MetaUpdatePermission::ItemOwner,
- transfers_enabled: true,
- },
- )],
- nft_item_id: vec![],
- fungible_item_id: vec![],
- refungible_item_id: vec![],
},
parachain_info: nft_runtime::ParachainInfoConfig { parachain_id: id },
aura: nft_runtime::AuraConfig {
runtime/Cargo.tomldiffbeforeafterboth--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -26,6 +26,10 @@
'pallet-evm-migration/runtime-benchmarks',
'pallet-balances/runtime-benchmarks',
'pallet-timestamp/runtime-benchmarks',
+ 'pallet-common/runtime-benchmarks',
+ 'pallet-fungible/runtime-benchmarks',
+ 'pallet-refungible/runtime-benchmarks',
+ 'pallet-nonfungible/runtime-benchmarks',
'pallet-nft/runtime-benchmarks',
'pallet-inflation/runtime-benchmarks',
'pallet-xcm/runtime-benchmarks',
@@ -67,6 +71,10 @@
'parachain-info/std',
'serde',
'pallet-inflation/std',
+ 'pallet-common/std',
+ 'pallet-fungible/std',
+ 'pallet-refungible/std',
+ 'pallet-nonfungible/std',
'pallet-nft/std',
'pallet-scheduler/std',
'pallet-nft-charge-transaction/std',
@@ -163,19 +171,19 @@
# [dependencies.pallet-contracts]
# git = 'https://github.com/paritytech/substrate.git'
# default-features = false
-# branch = 'polkadot-v0.9.9'
+# branch = 'polkadot-v0.9.10'
# version = '4.0.0-dev'
# [dependencies.pallet-contracts-primitives]
# git = 'https://github.com/paritytech/substrate.git'
# default-features = false
-# branch = 'polkadot-v0.9.9'
+# branch = 'polkadot-v0.9.10'
# version = '4.0.0-dev'
# [dependencies.pallet-contracts-rpc-runtime-api]
# git = 'https://github.com/paritytech/substrate.git'
# default-features = false
-# branch = 'polkadot-v0.9.9'
+# branch = 'polkadot-v0.9.10'
# version = '4.0.0-dev'
[dependencies.pallet-randomness-collective-flip]
@@ -385,9 +393,14 @@
[dependencies]
derivative = "2.2.0"
pallet-nft = { path = '../pallets/nft', default-features = false, version = '3.0.0' }
+up-rpc = { path = "../primitives/rpc", default-features = false }
pallet-inflation = { path = '../pallets/inflation', default-features = false, version = '3.0.0' }
nft-data-structs = { path = '../primitives/nft', default-features = false, version = '0.9.0' }
pallet-scheduler = { path = '../pallets/scheduler', default-features = false, version = '3.0.0' }
+pallet-common = { default-features = false, path = "../pallets/common" }
+pallet-fungible = { default-features = false, path = "../pallets/fungible" }
+pallet-refungible = { default-features = false, path = "../pallets/refungible" }
+pallet-nonfungible = { default-features = false, path = "../pallets/nonfungible" }
# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
pallet-nft-transaction-payment = { path = '../pallets/nft-transaction-payment', default-features = false, version = '3.0.0' }
pallet-nft-charge-transaction = { path = '../pallets/nft-charge-transaction', default-features = false, version = '3.0.0' }
runtime/src/lib.rsdiffbeforeafterboth102/// to the public key of our transaction signing scheme.102/// to the public key of our transaction signing scheme.103pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;103pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;104105pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;104106105/// The type for looking up accounts. We don't expect more than 4 billion of them, but you107/// The type for looking up accounts. We don't expect more than 4 billion of them, but you106/// never know...108/// never know...701 pub const CollectionCreationPrice: Balance = 100 * UNIQUE;703 pub const CollectionCreationPrice: Balance = 100 * UNIQUE;702}704}703705704/// Used for the pallet nft in `./nft.rs`705impl pallet_nft::Config for Runtime {706impl pallet_common::Config for Runtime {706 type Event = Event;707 type Event = Event;707 type WeightInfo = pallet_nft::weights::SubstrateWeight<Self>;708709 type EvmBackwardsAddressMapping = pallet_nft::MapBackwardsAddressTruncated;708 type EvmBackwardsAddressMapping = pallet_common::account::MapBackwardsAddressTruncated;710 type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;709 type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;711 type CrossAccountId = pallet_nft::BasicCrossAccountId<Self>;710 type CrossAccountId = pallet_common::account::BasicCrossAccountId<Self>;712711713 type Currency = Balances;712 type Currency = Balances;714 type CollectionCreationPrice = CollectionCreationPrice;713 type CollectionCreationPrice = CollectionCreationPrice;715 type TreasuryAccountId = TreasuryAccountId;714 type TreasuryAccountId = TreasuryAccountId;716}715}716717impl pallet_fungible::Config for Runtime {718 type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;719}720impl pallet_refungible::Config for Runtime {721 type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;722}723impl pallet_nonfungible::Config for Runtime {724 type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;725}726727/// Used for the pallet nft in `./nft.rs`728impl pallet_nft::Config for Runtime {729 type WeightInfo = pallet_nft::weights::SubstrateWeight<Self>;730}717731718parameter_types! {732parameter_types! {719 pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied733 pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied820834821 // Unique Pallets835 // Unique Pallets822 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,836 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,823 Nft: pallet_nft::{Pallet, Call, Config<T>, Storage, Event<T>} = 61,837 Nft: pallet_nft::{Pallet, Call, Storage} = 61,824 Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 62,838 Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 62,825 NftPayment: pallet_nft_transaction_payment::{Pallet, Call, Storage} = 63,839 NftPayment: pallet_nft_transaction_payment::{Pallet, Call, Storage} = 63,826 Charging: pallet_nft_charge_transaction::{Pallet, Call, Storage } = 64,840 Charging: pallet_nft_charge_transaction::{Pallet, Call, Storage } = 64,827 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,841 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,842 Common: pallet_common::{Pallet, Storage, Event<T>} = 66,843 Fungible: pallet_fungible::{Pallet, Storage} = 67,844 Refungible: pallet_refungible::{Pallet, Storage} = 68,845 Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,828846829 // Frontier847 // Frontier830 EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,848 EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,901 }919 }902}920}921922macro_rules! dispatch_nft_runtime {923 ($collection:ident.$method:ident($($name:ident),*)) => {{924 use pallet_nft::dispatch::Dispatched;925926 let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::new($collection).unwrap());927 let dispatch = collection.as_dyn();928929 dispatch.$method($($name),*)930 }};931}903932904impl_runtime_apis! {933impl_runtime_apis! {905 impl pallet_nft::NftApi<Block>934 impl up_rpc::NftApi<Block, CrossAccountId, AccountId>906 for Runtime935 for Runtime907 {936 {937 fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId> {938 dispatch_nft_runtime!(collection.account_tokens(account))939 }940 fn token_exists(collection: CollectionId, token: TokenId) -> bool {941 dispatch_nft_runtime!(collection.token_exists(token))942 }943944 fn token_owner(collection: CollectionId, token: TokenId) -> CrossAccountId {945 dispatch_nft_runtime!(collection.token_owner(token))946 }947 fn const_metadata(collection: CollectionId, token: TokenId) -> Vec<u8> {948 dispatch_nft_runtime!(collection.const_metadata(token))949 }950 fn variable_metadata(collection: CollectionId, token: TokenId) -> Vec<u8> {951 dispatch_nft_runtime!(collection.variable_metadata(token))952 }953954 fn collection_tokens(collection: CollectionId) -> u32 {955 dispatch_nft_runtime!(collection.collection_tokens())956 }957 fn account_balance(collection: CollectionId, account: CrossAccountId) -> u32 {958 dispatch_nft_runtime!(collection.account_balance(account))959 }960 fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> u128 {961 dispatch_nft_runtime!(collection.balance(account, token))962 }963 fn allowance(964 collection: CollectionId,965 sender: CrossAccountId,966 spender: CrossAccountId,967 token: TokenId,968 ) -> u128 {969 dispatch_nft_runtime!(collection.allowance(sender, spender, token))970 }971908 fn eth_contract_code(account: H160) -> Option<Vec<u8>> {972 fn eth_contract_code(account: H160) -> Option<Vec<u8>> {909 <pallet_nft::NftErcSupport<Runtime>>::get_code(&account)973 <pallet_nft::NftErcSupport<Runtime>>::get_code(&account)