difftreelog
feat connect split pallets via runtime
in: master
3 files changed
node/cli/src/chain_spec.rsdiffbeforeafterboth556use cumulus_primitives_core::ParaId;6use cumulus_primitives_core::ParaId;7use nft_runtime::*;7use nft_runtime::*;8use nft_data_structs::*;9use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};8use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};10use sc_service::ChainType;9use sc_service::ChainType;11use sp_core::{sr25519, Pair, Public};10use sp_core::{sr25519, Pair, Public};176 .map(|k| (k, 1000, 100, 1 << 98))175 .map(|k| (k, 1000, 100, 1 << 98))177 .collect(),176 .collect(),178 },177 },179 nft: NftConfig {180 collection_id: vec![(181 1,182 Collection {183 owner: get_account_id_from_seed::<sr25519::Public>("Alice"),184 mode: CollectionMode::NFT,185 access: AccessMode::Normal,186 decimal_points: 0,187 name: vec![],188 description: vec![],189 token_prefix: vec![],190 mint_mode: false,191 offchain_schema: vec![],192 schema_version: SchemaVersion::default(),193 sponsorship: SponsorshipState::Confirmed(get_account_id_from_seed::<194 sr25519::Public,195 >("Alice")),196 const_on_chain_schema: vec![],197 variable_on_chain_schema: vec![],198 limits: CollectionLimits::default(),199 meta_update_permission: MetaUpdatePermission::ItemOwner,200 transfers_enabled: true,201 },202 )],203 nft_item_id: vec![],204 fungible_item_id: vec![],205 refungible_item_id: vec![],206 },207 parachain_info: nft_runtime::ParachainInfoConfig { parachain_id: id },178 parachain_info: nft_runtime::ParachainInfoConfig { parachain_id: id },208 aura: nft_runtime::AuraConfig {179 aura: nft_runtime::AuraConfig {209 authorities: initial_authorities,180 authorities: initial_authorities,runtime/Cargo.tomldiffbeforeafterboth26 'pallet-evm-migration/runtime-benchmarks',26 'pallet-evm-migration/runtime-benchmarks',27 'pallet-balances/runtime-benchmarks',27 'pallet-balances/runtime-benchmarks',28 'pallet-timestamp/runtime-benchmarks',28 'pallet-timestamp/runtime-benchmarks',29 'pallet-common/runtime-benchmarks',30 'pallet-fungible/runtime-benchmarks',31 'pallet-refungible/runtime-benchmarks',32 'pallet-nonfungible/runtime-benchmarks',29 'pallet-nft/runtime-benchmarks',33 'pallet-nft/runtime-benchmarks',30 'pallet-inflation/runtime-benchmarks',34 'pallet-inflation/runtime-benchmarks',31 'pallet-xcm/runtime-benchmarks',35 'pallet-xcm/runtime-benchmarks',67 'parachain-info/std',71 'parachain-info/std',68 'serde',72 'serde',69 'pallet-inflation/std',73 'pallet-inflation/std',74 'pallet-common/std',75 'pallet-fungible/std',76 'pallet-refungible/std',77 'pallet-nonfungible/std',70 'pallet-nft/std',78 'pallet-nft/std',71 'pallet-scheduler/std',79 'pallet-scheduler/std',72 'pallet-nft-charge-transaction/std',80 'pallet-nft-charge-transaction/std',163# [dependencies.pallet-contracts]171# [dependencies.pallet-contracts]164# git = 'https://github.com/paritytech/substrate.git'172# git = 'https://github.com/paritytech/substrate.git'165# default-features = false173# default-features = false166# branch = 'polkadot-v0.9.9'174# branch = 'polkadot-v0.9.10'167# version = '4.0.0-dev'175# version = '4.0.0-dev'168176169# [dependencies.pallet-contracts-primitives]177# [dependencies.pallet-contracts-primitives]170# git = 'https://github.com/paritytech/substrate.git'178# git = 'https://github.com/paritytech/substrate.git'171# default-features = false179# default-features = false172# branch = 'polkadot-v0.9.9'180# branch = 'polkadot-v0.9.10'173# version = '4.0.0-dev'181# version = '4.0.0-dev'174182175# [dependencies.pallet-contracts-rpc-runtime-api]183# [dependencies.pallet-contracts-rpc-runtime-api]176# git = 'https://github.com/paritytech/substrate.git'184# git = 'https://github.com/paritytech/substrate.git'177# default-features = false185# default-features = false178# branch = 'polkadot-v0.9.9'186# branch = 'polkadot-v0.9.10'179# version = '4.0.0-dev'187# version = '4.0.0-dev'180188181[dependencies.pallet-randomness-collective-flip]189[dependencies.pallet-randomness-collective-flip]385[dependencies]393[dependencies]386derivative = "2.2.0"394derivative = "2.2.0"387pallet-nft = { path = '../pallets/nft', default-features = false, version = '3.0.0' }395pallet-nft = { path = '../pallets/nft', default-features = false, version = '3.0.0' }396up-rpc = { path = "../primitives/rpc", default-features = false }388pallet-inflation = { path = '../pallets/inflation', default-features = false, version = '3.0.0' }397pallet-inflation = { path = '../pallets/inflation', default-features = false, version = '3.0.0' }389nft-data-structs = { path = '../primitives/nft', default-features = false, version = '0.9.0' }398nft-data-structs = { path = '../primitives/nft', default-features = false, version = '0.9.0' }390pallet-scheduler = { path = '../pallets/scheduler', default-features = false, version = '3.0.0' }399pallet-scheduler = { path = '../pallets/scheduler', default-features = false, version = '3.0.0' }400pallet-common = { default-features = false, path = "../pallets/common" }401pallet-fungible = { default-features = false, path = "../pallets/fungible" }402pallet-refungible = { default-features = false, path = "../pallets/refungible" }403pallet-nonfungible = { default-features = false, path = "../pallets/nonfungible" }391# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }404# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }392pallet-nft-transaction-payment = { path = '../pallets/nft-transaction-payment', default-features = false, version = '3.0.0' }405pallet-nft-transaction-payment = { path = '../pallets/nft-transaction-payment', default-features = false, version = '3.0.0' }393pallet-nft-charge-transaction = { path = '../pallets/nft-charge-transaction', default-features = false, version = '3.0.0' }406pallet-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)