git.delta.rocks / unique-network / refs/commits / bbd154a47827

difftreelog

test fix unit

Yaroslav Bolyukin2022-04-13parent: #f082ca5.patch.diff
in: master

19 files changed

modifiedCargo.lockdiffbeforeafterboth
6829name = "pallet-unique"6829name = "pallet-unique"
6830version = "0.1.0"6830version = "0.1.0"
6831dependencies = [6831dependencies = [
6832 "ethereum",
6833 "evm-coder",
6834 "fp-evm",
6835 "fp-evm-mapping",
6836 "frame-benchmarking",6832 "frame-benchmarking",
6837 "frame-support",6833 "frame-support",
6838 "frame-system",6834 "frame-system",
6839 "hex-literal",
6840 "pallet-balances",
6841 "pallet-common",6835 "pallet-common",
6842 "pallet-ethereum",
6843 "pallet-evm",6836 "pallet-evm",
6844 "pallet-evm-coder-substrate",
6845 "pallet-fungible",
6846 "pallet-nonfungible",
6847 "pallet-randomness-collective-flip",
6848 "pallet-refungible",
6849 "pallet-timestamp",
6850 "pallet-transaction-payment",
6851 "parity-scale-codec",6837 "parity-scale-codec",
6852 "primitive-types",
6853 "rlp",
6854 "scale-info",6838 "scale-info",
6855 "serde",
6856 "sp-api",
6857 "sp-core",6839 "sp-core",
6858 "sp-io",6840 "sp-io",
6859 "sp-runtime",6841 "sp-runtime",
6860 "sp-std",6842 "sp-std",
6861 "up-data-structs",6843 "up-data-structs",
6862 "up-sponsorship",
6863]6844]
68646845
6865[[package]]6846[[package]]
11917 "sp-runtime",11898 "sp-runtime",
11918]11899]
11900
11901[[package]]
11902name = "tests"
11903version = "0.1.0"
11904dependencies = [
11905 "fp-evm-mapping",
11906 "frame-support",
11907 "frame-system",
11908 "pallet-balances",
11909 "pallet-common",
11910 "pallet-ethereum",
11911 "pallet-evm",
11912 "pallet-evm-coder-substrate",
11913 "pallet-fungible",
11914 "pallet-nonfungible",
11915 "pallet-refungible",
11916 "pallet-structure",
11917 "pallet-timestamp",
11918 "pallet-transaction-payment",
11919 "pallet-unique",
11920 "parity-scale-codec",
11921 "scale-info",
11922 "sp-core",
11923 "sp-io",
11924 "sp-runtime",
11925 "sp-std",
11926 "unique-runtime-common",
11927 "up-data-structs",
11928]
1191911929
11920[[package]]11930[[package]]
11921name = "textwrap"11931name = "textwrap"
12677name = "unique-runtime-common"12687name = "unique-runtime-common"
12678version = "0.9.18"12688version = "0.9.18"
12679dependencies = [12689dependencies = [
12690 "evm-coder",
12680 "fp-rpc",12691 "fp-rpc",
12681 "frame-support",12692 "frame-support",
12682 "frame-system",12693 "frame-system",
12693 "sp-runtime",12704 "sp-runtime",
12694 "sp-std",12705 "sp-std",
12695 "up-data-structs",12706 "up-data-structs",
12707 "up-sponsorship",
12696]12708]
1269712709
12698[[package]]12710[[package]]
modifiedCargo.tomldiffbeforeafterboth
5 'pallets/*',
6 'client/*',
7 'primitives/*',
8 'crates/*',
9 'runtime/tests',
10]
4exclude = ["runtime/unique", "runtime/quartz"]11exclude = [
12 "runtime/unique",
modifiedpallets/unique/Cargo.tomldiffbeforeafterboth
19runtime-benchmarks = ['frame-benchmarking', 'pallet-common/runtime-benchmarks']19runtime-benchmarks = ['frame-benchmarking', 'pallet-common/runtime-benchmarks']
20std = [20std = [
21 'codec/std',21 'codec/std',
22 'serde/std',
23 'frame-support/std',22 'frame-support/std',
24 'frame-system/std',23 'frame-system/std',
25 'pallet-balances/std',
26 'pallet-evm/std',24 'pallet-evm/std',
27 'pallet-timestamp/std',
28 'pallet-randomness-collective-flip/std',
29 'pallet-transaction-payment/std',
30 'pallet-common/std',25 'pallet-common/std',
31 'pallet-fungible/std',
32 'pallet-nonfungible/std',
33 'pallet-refungible/std',
34 'fp-evm/std',
35 'up-data-structs/std',26 'up-data-structs/std',
36 'up-sponsorship/std',
37 'fp-evm-mapping/std',
38 'sp-std/std',27 'sp-std/std',
39 'sp-api/std',
40 'sp-runtime/std',28 'sp-runtime/std',
41 'frame-benchmarking/std',29 'frame-benchmarking/std',
42 'ethereum/std',
43 'rlp/std',
44
45 'primitive-types/std',
46 'evm-coder/std',
47 'pallet-evm-coder-substrate/std',
48]30]
49limit-testing = ["up-data-structs/limit-testing"]31limit-testing = ["up-data-structs/limit-testing"]
5032
73git = "https://github.com/paritytech/substrate"55git = "https://github.com/paritytech/substrate"
74branch = "polkadot-v0.9.20"56branch = "polkadot-v0.9.20"
75
76[dependencies.pallet-balances]
77default-features = false
78git = "https://github.com/paritytech/substrate"
79branch = "polkadot-v0.9.20"
80
81[dependencies.pallet-timestamp]
82default-features = false
83git = "https://github.com/paritytech/substrate"
84branch = "polkadot-v0.9.20"
85
86[dependencies.pallet-randomness-collective-flip]
87default-features = false
88git = "https://github.com/paritytech/substrate"
89branch = "polkadot-v0.9.20"
9057
91[dependencies.sp-std]58[dependencies.sp-std]
92default-features = false59default-features = false
93git = "https://github.com/paritytech/substrate"60git = "https://github.com/paritytech/substrate"
94branch = "polkadot-v0.9.20"61branch = "polkadot-v0.9.20"
95
96[dependencies.pallet-transaction-payment]
97default-features = false
98git = "https://github.com/paritytech/substrate"
99branch = "polkadot-v0.9.20"
100
101[dependencies.serde]
102default-features = false
103features = ['derive']
104version = '1.0.130'
10562
106[dependencies.sp-runtime]63[dependencies.sp-runtime]
107default-features = false64default-features = false
127scale-info = { version = "2.0.1", default-features = false, features = [83scale-info = { version = "2.0.1", default-features = false, features = [
128 "derive",84 "derive",
129] }85] }
130ethereum = { version = "0.12.0", default-features = false }
131rlp = { default-features = false, version = "0.5.0" }
132sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.20" }
133
134up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.20" }
135fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.20" }
136evm-coder = { default-features = false, path = "../../crates/evm-coder" }
137pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
138primitive-types = { version = "0.11.1", default-features = false, features = [
139 "serde_no_std",
140] }
141
142pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.20" }86pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.18-2" }
143pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.20" }
144fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.20" }
145hex-literal = "0.3.3"
146
147pallet-common = { default-features = false, path = "../common" }87pallet-common = { default-features = false, path = "../common" }
148pallet-fungible = { default-features = false, path = "../fungible" }
149pallet-nonfungible = { default-features = false, path = "../nonfungible" }
150pallet-refungible = { default-features = false, path = "../refungible" }
15188
deletedpallets/unique/src/common.rsdiffbeforeafterboth

no changes

deletedpallets/unique/src/eth/mod.rsdiffbeforeafterboth

no changes

deletedpallets/unique/src/eth/sponsoring.rsdiffbeforeafterboth

no changes

modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
22 clippy::unused_unit22 clippy::unused_unit
23)]23)]
24
25extern crate alloc;
26
27pub use serde::{Serialize, Deserialize};
2824
29use frame_support::{25use frame_support::{
30 decl_module, decl_storage, decl_error, decl_event,26 decl_module, decl_storage, decl_error, decl_event,
51 dispatch::dispatch_call, dispatch::CollectionDispatch,47 dispatch::dispatch_call, dispatch::CollectionDispatch,
52};48};
53
54#[cfg(test)]
55mod mock;
56
57#[cfg(test)]
58mod tests;
59
60mod eth;
61mod sponsorship;
62pub use sponsorship::{UniqueSponsorshipHandler, UniqueSponsorshipPredict};
63pub use eth::sponsoring::UniqueEthSponsorshipHandler;
64
65pub mod common;
66use common::CommonWeights;
6749
68#[cfg(feature = "runtime-benchmarks")]50#[cfg(feature = "runtime-benchmarks")]
69mod benchmarking;51mod benchmarking;
9072
91pub trait Config:73pub trait Config: system::Config + pallet_common::Config + Sized + TypeInfo {
92 system::Config
93 + pallet_evm_coder_substrate::Config
94 + pallet_common::Config
95 + pallet_nonfungible::Config
96 + pallet_refungible::Config
97 + pallet_fungible::Config
98 + Sized
99 + TypeInfo
100{
101 type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;74 type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
10275
103 /// Weight information for extrinsics in this pallet.76 /// Weight information for extrinsics in this pallet.
104 type WeightInfo: WeightInfo;77 type WeightInfo: WeightInfo;
78 type CommonWeightInfo: CommonWeightInfo<Self::CrossAccountId>;
105}79}
10680
107decl_event! {81decl_event! {
689 /// * owner: Address, initial owner of the NFT.663 /// * owner: Address, initial owner of the NFT.
690 ///664 ///
691 /// * data: Token data to store on chain.665 /// * data: Token data to store on chain.
692 #[weight = <CommonWeights<T>>::create_item()]666 #[weight = T::CommonWeightInfo::create_item()]
693 #[transactional]667 #[transactional]
694 pub fn create_item(origin, collection_id: CollectionId, owner: T::CrossAccountId, data: CreateItemData) -> DispatchResultWithPostInfo {668 pub fn create_item(origin, collection_id: CollectionId, owner: T::CrossAccountId, data: CreateItemData) -> DispatchResultWithPostInfo {
695 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);669 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
716 /// * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].690 /// * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].
717 ///691 ///
718 /// * owner: Address, initial owner of the NFT.692 /// * owner: Address, initial owner of the NFT.
719 #[weight = <CommonWeights<T>>::create_multiple_items(items_data.len() as u32)]693 #[weight = T::CommonWeightInfo::create_multiple_items(items_data.len() as u32)]
720 #[transactional]694 #[transactional]
721 pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResultWithPostInfo {695 pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResultWithPostInfo {
722 ensure!(!items_data.is_empty(), Error::<T>::EmptyArgument);696 ensure!(!items_data.is_empty(), Error::<T>::EmptyArgument);
726 dispatch_call::<T, _>(collection_id, |d| d.create_multiple_items(sender, owner, items_data, &budget))700 dispatch_call::<T, _>(collection_id, |d| d.create_multiple_items(sender, owner, items_data, &budget))
727 }701 }
728702
729 #[weight = <CommonWeights<T>>::create_multiple_items_ex(&data)]703 #[weight = T::CommonWeightInfo::create_multiple_items_ex(&data)]
730 #[transactional]704 #[transactional]
731 pub fn create_multiple_items_ex(origin, collection_id: CollectionId, data: CreateItemExData<T::CrossAccountId>) -> DispatchResultWithPostInfo {705 pub fn create_multiple_items_ex(origin, collection_id: CollectionId, data: CreateItemExData<T::CrossAccountId>) -> DispatchResultWithPostInfo {
732 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);706 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
774 /// * collection_id: ID of the collection.748 /// * collection_id: ID of the collection.
775 ///749 ///
776 /// * item_id: ID of NFT to burn.750 /// * item_id: ID of NFT to burn.
777 #[weight = <CommonWeights<T>>::burn_item()]751 #[weight = T::CommonWeightInfo::burn_item()]
778 #[transactional]752 #[transactional]
779 pub fn burn_item(origin, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {753 pub fn burn_item(origin, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {
780 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);754 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
806 /// * item_id: ID of NFT to burn.780 /// * item_id: ID of NFT to burn.
807 ///781 ///
808 /// * from: owner of item782 /// * from: owner of item
809 #[weight = <CommonWeights<T>>::burn_from()]783 #[weight = T::CommonWeightInfo::burn_from()]
810 #[transactional]784 #[transactional]
811 pub fn burn_from(origin, collection_id: CollectionId, from: T::CrossAccountId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {785 pub fn burn_from(origin, collection_id: CollectionId, from: T::CrossAccountId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {
812 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);786 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
838 /// * Non-Fungible Mode: Ignored812 /// * Non-Fungible Mode: Ignored
839 /// * Fungible Mode: Must specify transferred amount813 /// * Fungible Mode: Must specify transferred amount
840 /// * Re-Fungible Mode: Must specify transferred portion (between 0 and 1)814 /// * Re-Fungible Mode: Must specify transferred portion (between 0 and 1)
841 #[weight = <CommonWeights<T>>::transfer()]815 #[weight = T::CommonWeightInfo::transfer()]
842 #[transactional]816 #[transactional]
843 pub fn transfer(origin, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {817 pub fn transfer(origin, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {
844 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);818 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
862 /// * collection_id.836 /// * collection_id.
863 ///837 ///
864 /// * item_id: ID of the item.838 /// * item_id: ID of the item.
865 #[weight = <CommonWeights<T>>::approve()]839 #[weight = T::CommonWeightInfo::approve()]
866 #[transactional]840 #[transactional]
867 pub fn approve(origin, spender: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, amount: u128) -> DispatchResultWithPostInfo {841 pub fn approve(origin, spender: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, amount: u128) -> DispatchResultWithPostInfo {
868 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);842 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
889 /// * item_id: ID of the item.863 /// * item_id: ID of the item.
890 ///864 ///
891 /// * value: Amount to transfer.865 /// * value: Amount to transfer.
892 #[weight = <CommonWeights<T>>::transfer_from()]866 #[weight = T::CommonWeightInfo::transfer_from()]
893 #[transactional]867 #[transactional]
894 pub fn transfer_from(origin, from: T::CrossAccountId, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128 ) -> DispatchResultWithPostInfo {868 pub fn transfer_from(origin, from: T::CrossAccountId, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128 ) -> DispatchResultWithPostInfo {
895 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);869 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
910 /// * collection_id.884 /// * collection_id.
911 ///885 ///
912 /// * schema: String representing the offchain data schema.886 /// * schema: String representing the offchain data schema.
913 #[weight = <CommonWeights<T>>::set_variable_metadata(data.len() as u32)]887 #[weight = T::CommonWeightInfo::set_variable_metadata(data.len() as u32)]
914 #[transactional]888 #[transactional]
915 pub fn set_variable_meta_data (889 pub fn set_variable_meta_data (
916 origin,890 origin,
deletedpallets/unique/src/mock.rsdiffbeforeafterboth

no changes

deletedpallets/unique/src/sponsorship.rsdiffbeforeafterboth

no changes

deletedpallets/unique/src/tests.rsdiffbeforeafterboth

no changes

modifiedruntime/common/Cargo.tomldiffbeforeafterboth
104branch = "unique-polkadot-v0.9.20"104branch = "unique-polkadot-v0.9.20"
105105
106[dependencies]106[dependencies]
107pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.20" }107pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.18-2" }
108evm-coder = { default-features = false, path = '../../crates/evm-coder' }
109up-sponsorship = { default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.18' }
108110
addedruntime/common/src/eth_sponsoring.rsdiffbeforeafterboth

no changes

modifiedruntime/common/src/lib.rsdiffbeforeafterboth
22
3pub mod constants;3pub mod constants;
4pub mod dispatch;4pub mod dispatch;
5pub mod eth_sponsoring;
5pub mod runtime_apis;6pub mod runtime_apis;
7pub mod sponsoring;
6pub mod types;8pub mod types;
9pub mod weights;
710
addedruntime/common/src/sponsoring.rsdiffbeforeafterboth

no changes

addedruntime/common/src/weights.rsdiffbeforeafterboth

no changes

modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
120 types::*,120 types::*,
121 constants::*,121 constants::*,
122 dispatch::{CollectionDispatchT, CollectionDispatch},122 dispatch::{CollectionDispatchT, CollectionDispatch},
123 sponsoring::UniqueSponsorshipHandler,
124 eth_sponsoring::UniqueEthSponsorshipHandler,
125 weights::CommonWeights,
123};126};
124127
125pub const RUNTIME_NAME: &str = "opal";128pub const RUNTIME_NAME: &str = "opal";
902impl pallet_unique::Config for Runtime {905impl pallet_unique::Config for Runtime {
903 type Event = Event;906 type Event = Event;
904 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;907 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
908 type CommonWeightInfo = CommonWeights<Self>;
905}909}
906910
907parameter_types! {911parameter_types! {
923// }927// }
924928
925type EvmSponsorshipHandler = (929type EvmSponsorshipHandler = (
926 pallet_unique::UniqueEthSponsorshipHandler<Runtime>,930 UniqueEthSponsorshipHandler<Runtime>,
927 pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,931 pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,
928);932);
929type SponsorshipHandler = (933type SponsorshipHandler = (
930 pallet_unique::UniqueSponsorshipHandler<Runtime>,934 UniqueSponsorshipHandler<Runtime>,
931 //pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,935 //pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,
932 pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,936 pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,
933);937);
addedruntime/tests/Cargo.tomldiffbeforeafterboth

no changes

addedruntime/tests/src/lib.rsdiffbeforeafterboth

no changes

addedruntime/tests/src/tests.rsdiffbeforeafterboth

no changes