git.delta.rocks / unique-network / refs/commits / 1062e172486e

difftreelog

Merge pull request #343 from UniqueNetwork/feature/CORE-302

bugrazoid2022-05-27parents: #459d9af #e5c2d12.patch.diff
in: master
Feature/core 302

49 files changed

added.maintain/scripts/generate_abi.shdiffbeforeafterboth

no changes

deleted.maintain/scripts/generate_api.shdiffbeforeafterboth

no changes

added.maintain/scripts/generate_sol.shdiffbeforeafterboth

no changes

modifiedCargo.lockdiffbeforeafterboth
4290version = "1.4.0"4290version = "1.4.0"
4291source = "registry+https://github.com/rust-lang/crates.io-index"4291source = "registry+https://github.com/rust-lang/crates.io-index"
4292checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"4292checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
4293dependencies = [
4294 "spin",
4295]
42934296
4294[[package]]4297[[package]]
4295name = "lazycell"4298name = "lazycell"
54675470
5468[[package]]5471[[package]]
5469name = "once_cell"5472name = "once_cell"
5470version = "1.11.0"5473version = "1.12.0"
5471source = "registry+https://github.com/rust-lang/crates.io-index"5474source = "registry+https://github.com/rust-lang/crates.io-index"
5472checksum = "7b10983b38c53aebdf33f542c6275b0f58a238129d00c4ae0e6fb59738d783ca"5475checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
54735476
5474[[package]]5477[[package]]
5475name = "opal-runtime"5478name = "opal-runtime"
5917 "frame-benchmarking",5920 "frame-benchmarking",
5918 "frame-support",5921 "frame-support",
5919 "frame-system",5922 "frame-system",
5923 "lazy_static",
5920 "pallet-evm",5924 "pallet-evm",
5921 "pallet-evm-coder-substrate",5925 "pallet-evm-coder-substrate",
5922 "parity-scale-codec 3.1.2",5926 "parity-scale-codec 3.1.2",
6083 "frame-support",6087 "frame-support",
6084 "frame-system",6088 "frame-system",
6085 "log",6089 "log",
6090 "pallet-common",
6086 "pallet-evm",6091 "pallet-evm",
6087 "pallet-evm-coder-substrate",6092 "pallet-evm-coder-substrate",
6088 "parity-scale-codec 3.1.2",6093 "parity-scale-codec 3.1.2",
6089 "scale-info",6094 "scale-info",
6090 "sp-core",6095 "sp-core",
6091 "sp-runtime",6096 "sp-runtime",
6092 "sp-std",6097 "sp-std",
6098 "up-data-structs",
6093 "up-sponsorship",6099 "up-sponsorship",
6094]6100]
60956101
6814name = "pallet-unique"6820name = "pallet-unique"
6815version = "0.1.0"6821version = "0.1.0"
6816dependencies = [6822dependencies = [
6823 "ethereum",
6824 "evm-coder",
6817 "frame-benchmarking",6825 "frame-benchmarking",
6818 "frame-support",6826 "frame-support",
6819 "frame-system",6827 "frame-system",
6820 "pallet-common",6828 "pallet-common",
6821 "pallet-evm",6829 "pallet-evm",
6830 "pallet-evm-coder-substrate",
6831 "pallet-nonfungible",
6822 "parity-scale-codec 3.1.2",6832 "parity-scale-codec 3.1.2",
6823 "scale-info",6833 "scale-info",
6834 "serde",
6824 "sp-core",6835 "sp-core",
6825 "sp-io",6836 "sp-io",
6826 "sp-runtime",6837 "sp-runtime",
1200512016
12006[[package]]12017[[package]]
12007name = "target-lexicon"12018name = "target-lexicon"
12008version = "0.12.3"12019version = "0.12.4"
12009source = "registry+https://github.com/rust-lang/crates.io-index"12020source = "registry+https://github.com/rust-lang/crates.io-index"
12010checksum = "d7fa7e55043acb85fca6b3c01485a2eeb6b69c5d21002e273c79e465f43b7ac1"12021checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1"
1201112022
12012[[package]]12023[[package]]
12013name = "tempfile"12024name = "tempfile"
modifiedMakefilediffbeforeafterboth
1.PHONY: _help1.PHONY: _help
2_help:2_help:
3 @echo "regenerate_solidity - generate stubs/interfaces for contracts defined in native (via evm-coder)"3 @echo "regenerate_solidity - generate stubs/interfaces for contracts defined in native (via evm-coder)"
4 @echo "evm_stubs - recompile contract stubs"4 @echo "evm_stubs - recompile contract stubs and ABI"
5 @echo "bench - run frame-benchmarking"5 @echo "bench - run frame-benchmarking"
6 @echo " bench-evm-migration"6 @echo " bench-evm-migration"
7 @echo " bench-unique"7 @echo " bench-unique"
8
9.PHONY: regenerate_solidity
10regenerate_solidity:
11 PACKAGE=pallet-fungible NAME=erc::gen_iface OUTPUT=./tests/src/eth/api/UniqueFungible.sol ./.maintain/scripts/generate_api.sh
12 PACKAGE=pallet-nonfungible NAME=erc::gen_iface OUTPUT=./tests/src/eth/api/UniqueNFT.sol ./.maintain/scripts/generate_api.sh
13 PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_iface OUTPUT=./tests/src/eth/api/ContractHelpers.sol ./.maintain/scripts/generate_api.sh
14
15 PACKAGE=pallet-fungible NAME=erc::gen_impl OUTPUT=./pallets/fungible/src/stubs/UniqueFungible.sol ./.maintain/scripts/generate_api.sh
16 PACKAGE=pallet-nonfungible NAME=erc::gen_impl OUTPUT=./pallets/nonfungible/src/stubs/UniqueNFT.sol ./.maintain/scripts/generate_api.sh
17 PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_impl OUTPUT=./pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol ./.maintain/scripts/generate_api.sh
188
19FUNGIBLE_EVM_STUBS=./pallets/fungible/src/stubs9FUNGIBLE_EVM_STUBS=./pallets/fungible/src/stubs
10FUNGIBLE_EVM_ABI=./tests/src/eth/fungibleAbi.json
11
20NONFUNGIBLE_EVM_STUBS=./pallets/nonfungible/src/stubs12NONFUNGIBLE_EVM_STUBS=./pallets/nonfungible/src/stubs
13NONFUNGIBLE_EVM_ABI=./tests/src/eth/nonFungibleAbi.json
14
21CONTRACT_HELPERS_STUBS=./pallets/evm-contract-helpers/src/stubs/15CONTRACT_HELPERS_STUBS=./pallets/evm-contract-helpers/src/stubs/
16CONTRACT_HELPERS_ABI=./tests/src/eth/util/contractHelpersAbi.json
17
18COLLECTION_HELPER_STUBS=./pallets/unique/src/eth/stubs/
19COLLECTION_HELPER_ABI=./tests/src/eth/collectionHelperAbi.json
20
21TESTS_API=./tests/src/eth/api/
2222
23$(FUNGIBLE_EVM_STUBS)/UniqueFungible.raw: $(FUNGIBLE_EVM_STUBS)/UniqueFungible.sol23.PHONY: regenerate_solidity
24regenerate_solidity: UniqueFungible.sol UniqueNFT.sol ContractHelpers.sol CollectionHelper.sol
25
26UniqueFungible.sol:
24 INPUT=$< OUTPUT=$@ ./.maintain/scripts/compile_stub.sh27 PACKAGE=pallet-fungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh
28 PACKAGE=pallet-fungible NAME=erc::gen_impl OUTPUT=$(FUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh
29
30UniqueNFT.sol:
31 PACKAGE=pallet-nonfungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh
32 PACKAGE=pallet-nonfungible NAME=erc::gen_impl OUTPUT=$(NONFUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh
33
25$(NONFUNGIBLE_EVM_STUBS)/UniqueNFT.raw: $(NONFUNGIBLE_EVM_STUBS)/UniqueNFT.sol34ContractHelpers.sol:
35 PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh
36 PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_impl OUTPUT=$(CONTRACT_HELPERS_STUBS)/$@ ./.maintain/scripts/generate_sol.sh
37
38CollectionHelper.sol:
39 PACKAGE=pallet-unique NAME=eth::collection_helper_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh
40 PACKAGE=pallet-unique NAME=eth::collection_helper_impl OUTPUT=$(COLLECTION_HELPER_STUBS)/$@ ./.maintain/scripts/generate_sol.sh
41
42UniqueFungible: UniqueFungible.sol
26 INPUT=$< OUTPUT=$@ ./.maintain/scripts/compile_stub.sh43 INPUT=$(FUNGIBLE_EVM_STUBS)/$< OUTPUT=$(FUNGIBLE_EVM_STUBS)/UniqueFungible.raw ./.maintain/scripts/compile_stub.sh
44 INPUT=$(FUNGIBLE_EVM_STUBS)/$< OUTPUT=$(FUNGIBLE_EVM_ABI) ./.maintain/scripts/generate_abi.sh
45
46UniqueNFT: UniqueNFT.sol
47 INPUT=$(NONFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(NONFUNGIBLE_EVM_STUBS)/UniqueNFT.raw ./.maintain/scripts/compile_stub.sh
48 INPUT=$(NONFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(NONFUNGIBLE_EVM_ABI) ./.maintain/scripts/generate_abi.sh
49
27$(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw: $(CONTRACT_HELPERS_STUBS)/ContractHelpers.sol50ContractHelpers: ContractHelpers.sol
51 INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw ./.maintain/scripts/compile_stub.sh
52 INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_ABI) ./.maintain/scripts/generate_abi.sh
53
54CollectionHelper: CollectionHelper.sol
28 INPUT=$< OUTPUT=$@ ./.maintain/scripts/compile_stub.sh55 INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_STUBS)/CollectionHelper.raw ./.maintain/scripts/compile_stub.sh
56 INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_ABI) ./.maintain/scripts/generate_abi.sh
2957
30evm_stubs: $(FUNGIBLE_EVM_STUBS)/UniqueFungible.raw $(NONFUNGIBLE_EVM_STUBS)/UniqueNFT.raw $(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw58evm_stubs: UniqueFungible UniqueNFT ContractHelpers CollectionHelper
3159
32.PHONY: _bench60.PHONY: _bench
33_bench:61_bench:
modifiedcrates/evm-coder/src/solidity.rsdiffbeforeafterboth
327 }327 }
328}328}
329329
330#[impl_for_tuples(1, 5)]330#[impl_for_tuples(1, 12)]
331impl SolidityArguments for Tuple {331impl SolidityArguments for Tuple {
332 for_tuples!( where #( Tuple: SolidityArguments ),* );332 for_tuples!( where #( Tuple: SolidityArguments ),* );
333333
modifiedpallets/common/Cargo.tomldiffbeforeafterboth
16sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }16sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }
17sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }17sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }
18sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }18sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }
19frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }
19fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }20fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
20up-data-structs = { default-features = false, path = '../../primitives/data-structs' }21up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
21pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }22pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }
25scale-info = { version = "2.0.1", default-features = false, features = [27scale-info = { version = "2.0.1", default-features = false, features = [
26 "derive",28 "derive",
27] }29] }
28frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }30lazy_static = { version = "1.4.0", default-features = false, features = ["spin_no_std"] }
2931
30[features]32[features]
31default = ["std"]33default = ["std"]
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
17use evm_coder::{solidity_interface, types::*, execution::Result};17use evm_coder::{
18 solidity_interface,
19 types::*,
20 execution::{Result, Error},
21};
18pub use pallet_evm::{PrecompileOutput, PrecompileResult, account::CrossAccountId};22pub use pallet_evm::{PrecompileOutput, PrecompileResult, account::CrossAccountId};
19use pallet_evm_coder_substrate::dispatch_to_evm;23use pallet_evm_coder_substrate::dispatch_to_evm;
20use sp_core::{H160, U256};24use sp_core::{H160, U256};
21use sp_std::vec::Vec;25use sp_std::vec::Vec;
22use up_data_structs::Property;26use up_data_structs::{Property, SponsoringRateLimit};
27use alloc::format;
2328
24use crate::{Pallet, CollectionHandle, Config, CollectionProperties};29use crate::{Pallet, CollectionHandle, Config, CollectionProperties};
2530
31 fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileResult>;36 fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileResult>;
32}37}
3338
34#[solidity_interface(name = "CollectionProperties")]39#[solidity_interface(name = "Collection")]
35impl<T: Config> CollectionHandle<T> {40impl<T: Config> CollectionHandle<T> {
36 fn set_collection_property(&mut self, caller: caller, key: string, value: bytes) -> Result<()> {41 fn set_collection_property(&mut self, caller: caller, key: string, value: bytes) -> Result<()> {
37 let caller = T::CrossAccountId::from_eth(caller);42 let caller = T::CrossAccountId::from_eth(caller);
65 Ok(prop.to_vec())70 Ok(prop.to_vec())
66 }71 }
72
73 fn eth_set_sponsor(&mut self, caller: caller, sponsor: address) -> Result<void> {
74 check_is_owner(caller, self)?;
75
76 let sponsor = T::CrossAccountId::from_eth(sponsor);
77 self.set_sponsor(sponsor.as_sub().clone());
78 save(self);
79 Ok(())
80 }
81
82 fn eth_confirm_sponsorship(&mut self, caller: caller) -> Result<void> {
83 let caller = T::CrossAccountId::from_eth(caller);
84 if !self.confirm_sponsorship(caller.as_sub()) {
85 return Err(Error::Revert("Caller is not set as sponsor".into()));
86 }
87 save(self);
88 Ok(())
89 }
90
91 fn set_limit(&mut self, caller: caller, limit: string, value: string) -> Result<void> {
92 check_is_owner(caller, self)?;
93 let mut limits = self.limits.clone();
94
95 match limit.as_str() {
96 "accountTokenOwnershipLimit" => {
97 limits.account_token_ownership_limit = parse_int(value)?;
98 }
99 "sponsoredDataSize" => {
100 limits.sponsored_data_size = parse_int(value)?;
101 }
102 "sponsoredDataRateLimit" => {
103 limits.sponsored_data_rate_limit =
104 Some(SponsoringRateLimit::Blocks(parse_int(value)?.unwrap()));
105 }
106 "tokenLimit" => {
107 limits.token_limit = parse_int(value)?;
108 }
109 "sponsorTransferTimeout" => {
110 limits.sponsor_transfer_timeout = parse_int(value)?;
111 }
112 "sponsorApproveTimeout" => {
113 limits.sponsor_approve_timeout = parse_int(value)?;
114 }
115 "ownerCanTransfer" => {
116 limits.owner_can_transfer = parse_bool(value)?;
117 }
118 "ownerCanDestroy" => {
119 limits.owner_can_destroy = parse_bool(value)?;
120 }
121 "transfersEnabled" => {
122 limits.transfers_enabled = parse_bool(value)?;
123 }
124 _ => return Err(Error::Revert(format!("Unknown limit \"{}\"", limit))),
125 }
126 self.limits = <Pallet<T>>::clamp_limits(self.mode.clone(), &self.limits, limits)
127 .map_err(dispatch_to_evm::<T>)?;
128 save(self);
129 Ok(())
130 }
131
132 fn contract_address(&self, _caller: caller) -> Result<address> {
133 Ok(crate::eth::collection_id_to_address(self.id))
134 }
67}135}
136
137fn check_is_owner<T: Config>(caller: caller, collection: &CollectionHandle<T>) -> Result<()> {
138 let caller = T::CrossAccountId::from_eth(caller);
139 collection
140 .check_is_owner(&caller)
141 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
142 Ok(())
143}
144
145fn save<T: Config>(collection: &CollectionHandle<T>) {
146 <crate::CollectionById<T>>::insert(collection.id, collection.collection.clone());
147}
148
149fn parse_int(value: string) -> Result<Option<u32>> {
150 value
151 .parse::<u32>()
152 .map_err(|e| Error::Revert(format!("Int value \"{}\" parse error: {}", value, e)))
153 .map(|value| Some(value))
154}
155
156fn parse_bool(value: string) -> Result<Option<bool>> {
157 value
158 .parse::<bool>()
159 .map_err(|e| Error::Revert(format!("Bool value \"{}\" parse error: {}", value, e)))
160 .map(|value| Some(value))
161}
68162
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
17use up_data_structs::CollectionId;17use up_data_structs::CollectionId;
18use sp_core::H160;18use sp_core::H160;
19
20lazy_static::lazy_static! {
21 pub static ref KEY_TOKEN_URI: up_data_structs::PropertyKey = {
22 let key: evm_coder::types::string = "tokenURI".into(); //TODO: make static
23 let key: up_data_structs::PropertyKey = key.into_bytes().try_into().expect("Can't create \"tokenURI\" key");
24 key
25 };
26}
1927
20// 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection 128// 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection 1
21// TODO: Unhardcode prefix29// TODO: Unhardcode prefix
38 H160(out)46 H160(out)
39}47}
48
49pub fn is_collection(address: &H160) -> bool {
50 address[0..16] == ETH_COLLECTION_PREFIX
51}
4052
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
115 })115 })
116 }116 }
117
118 pub fn new_with_recorder(id: CollectionId, recorder: SubstrateRecorder<T>) -> Option<Self> {
119 <CollectionById<T>>::get(id).map(|collection| Self {
120 id,
121 collection,
122 recorder,
123 })
124 }
125
117 pub fn new(id: CollectionId) -> Option<Self> {126 pub fn new(id: CollectionId) -> Option<Self> {
118 Self::new_with_gas_limit(id, u64::MAX)127 Self::new_with_gas_limit(id, u64::MAX)
141 Ok(())150 Ok(())
142 }151 }
152
153 pub fn set_sponsor(&mut self, sponsor: T::AccountId) {
154 self.collection.sponsorship = SponsorshipState::Unconfirmed(sponsor);
155 }
156
157 pub fn confirm_sponsorship(&mut self, sender: &T::AccountId) -> bool {
158 if self.collection.sponsorship.pending_sponsor() != Some(sender) {
159 return false;
160 };
161
162 self.collection.sponsorship = SponsorshipState::Confirmed(sender.clone());
163 true
164 }
143}165}
144impl<T: Config> Deref for CollectionHandle<T> {166impl<T: Config> Deref for CollectionHandle<T> {
145 type Target = Collection<T::AccountId>;167 type Target = Collection<T::AccountId>;
modifiedpallets/evm-contract-helpers/Cargo.tomldiffbeforeafterboth
8scale-info = { version = "2.0.1", default-features = false, features = [8scale-info = { version = "2.0.1", default-features = false, features = [
9 "derive",9 "derive",
10] }10] }
11log = { default-features = false, version = "0.4.14" }
12
13# Substrate
11frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }14frame-support = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.21' }
12frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }15frame-system = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.21' }
13sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }16sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.21' }
14sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }17sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.21' }
15sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }18sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.21' }
16evm-coder = { default-features = false, path = '../../crates/evm-coder' }19
17pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }20# Unique
18pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }21pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
19fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }22fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
20up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.21" }23up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.21" }
24
25# Locals
26evm-coder = { default-features = false, path = '../../crates/evm-coder' }
21log = "0.4.14"27pallet-common = { default-features = false, path = '../../pallets/common' }
28pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }
29up-data-structs = { default-features = false, path = '../../primitives/data-structs', features = ['serde1'] }
2230
23[dependencies.codec]31[dependencies.codec]
24default-features = false32default-features = false
modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
24use pallet_evm::account::CrossAccountId;24use pallet_evm::account::CrossAccountId;
25use pallet_evm_coder_substrate::{call, dispatch_to_evm};25use pallet_evm_coder_substrate::{call, dispatch_to_evm};
26use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};26use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};
27use pallet_common::{CollectionHandle, erc::CollectionPropertiesCall};27use pallet_common::{CollectionHandle, erc::CollectionCall};
2828
29use crate::{29use crate::{
30 Allowance, Balance, Config, FungibleHandle, Pallet, SelfWeightOf, TotalSupply,30 Allowance, Balance, Config, FungibleHandle, Pallet, SelfWeightOf, TotalSupply,
150 is(150 is(
151 ERC20,151 ERC20,
152 ERC20UniqueExtensions,152 ERC20UniqueExtensions,
153 via("CollectionHandle<T>", common_mut, CollectionProperties)153 via("CollectionHandle<T>", common_mut, Collection)
154 )154 )
155)]155)]
156impl<T: Config> FungibleHandle<T> {}156impl<T: Config> FungibleHandle<T> {}
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
33use pallet_evm_coder_substrate::WithRecorder;33use pallet_evm_coder_substrate::WithRecorder;
34use sp_core::H160;34use sp_core::H160;
35use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};35use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};
36use sp_std::collections::btree_map::BTreeMap;36use sp_std::{collections::btree_map::BTreeMap};
3737
38pub use pallet::*;38pub use pallet::*;
3939
modifiedpallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
127 }127 }
128}128}
129129
130// Selector: 9b5e29c5130// Selector: f5652829
131contract CollectionProperties is Dummy, ERC165 {131contract Collection is Dummy, ERC165 {
132 // Selector: setCollectionProperty(string,bytes) 2f073f66132 // Selector: setCollectionProperty(string,bytes) 2f073f66
133 function setCollectionProperty(string memory key, bytes memory value)133 function setCollectionProperty(string memory key, bytes memory value)
134 public134 public
160 return hex"";160 return hex"";
161 }161 }
162
163 // Selector: ethSetSponsor(address) 8f9af356
164 function ethSetSponsor(address sponsor) public {
165 require(false, stub_error);
166 sponsor;
167 dummy = 0;
168 }
169
170 // Selector: ethConfirmSponsorship() a8580d1a
171 function ethConfirmSponsorship() public {
172 require(false, stub_error);
173 dummy = 0;
174 }
175
176 // Selector: setLimit(string,string) bf4d2014
177 function setLimit(string memory limit, string memory value) public {
178 require(false, stub_error);
179 limit;
180 value;
181 dummy = 0;
182 }
183
184 // Selector: contractAddress() f6b4dfb4
185 function contractAddress() public view returns (address) {
186 require(false, stub_error);
187 dummy;
188 return 0x0000000000000000000000000000000000000000;
189 }
162}190}
163191
164contract UniqueFungible is192contract UniqueFungible is
165 Dummy,193 Dummy,
166 ERC165,194 ERC165,
167 ERC20,195 ERC20,
168 ERC20UniqueExtensions,196 ERC20UniqueExtensions,
169 CollectionProperties197 Collection
170{}198{}
171199
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
22 PropertyKeyPermission, PropertyValue,22 PropertyKeyPermission, PropertyValue,
23};23};
24use pallet_common::{24use pallet_common::{
25 CommonCollectionOperations, CommonWeightInfo, with_weight, weights::WeightInfo as _,25 CommonCollectionOperations, CommonWeightInfo, with_weight, weights::WeightInfo as _
26};26};
27use sp_runtime::DispatchError;27use sp_runtime::DispatchError;
28use sp_std::vec::Vec;28use sp_std::vec::Vec;
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
22use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};22use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};
23use frame_support::BoundedVec;23use frame_support::BoundedVec;
24use up_data_structs::{TokenId, SchemaVersion, PropertyPermission, PropertyKeyPermission, Property};24use up_data_structs::{
25 TokenId, SchemaVersion, PropertyPermission, PropertyKeyPermission, Property, CollectionId,
26 PropertyKey, CollectionPropertiesVec,
27};
25use pallet_evm_coder_substrate::dispatch_to_evm;28use pallet_evm_coder_substrate::dispatch_to_evm;
26use sp_core::{H160, U256};29use sp_core::{H160, U256};
27use sp_std::vec::Vec;30use sp_std::vec::Vec;
28use pallet_common::{31use pallet_common::{
29 erc::{CommonEvmHandler, PrecompileResult, CollectionPropertiesCall},32 erc::{CommonEvmHandler, PrecompileResult, CollectionCall},
30 CollectionHandle,33 CollectionHandle, CollectionPropertyPermissions,
31};34};
32use pallet_evm::account::CrossAccountId;35use pallet_evm::account::CrossAccountId;
33use pallet_evm_coder_substrate::call;36use pallet_evm_coder_substrate::call;
158 /// Returns token's const_metadata161 /// Returns token's const_metadata
159 #[solidity(rename_selector = "tokenURI")]162 #[solidity(rename_selector = "tokenURI")]
160 fn token_uri(&self, token_id: uint256) -> Result<string> {163 fn token_uri(&self, token_id: uint256) -> Result<string> {
164 let key = pallet_common::eth::KEY_TOKEN_URI.clone();
165 if !has_token_permission::<T>(self.id, &key) {
166 return Err("No tokenURI permission".into());
167 }
168
161 self.consume_store_reads(1)?;169 self.consume_store_reads(1)?;
162 let _token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;170 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
171
172 let properties = <TokenProperties<T>>::try_get((self.id, token_id))
173 .map_err(|_| Error::Revert("Token properties not found".into()))?;
174 if let Some(property) = properties.get(&key) {
163 Ok(string::from_utf8_lossy(175 return Ok(string::from_utf8_lossy(property).into());
164 todo!()176 }
165 )177
166 .into())178 Err("Property tokenURI not found".into())
167 }179 }
168}180}
169181
350 token_id: uint256,362 token_id: uint256,
351 token_uri: string,363 token_uri: string,
352 ) -> Result<bool> {364 ) -> Result<bool> {
365 let key = pallet_common::eth::KEY_TOKEN_URI.clone();
366 let permission = get_token_permission::<T>(self.id, &key)?;
367 if !permission.collection_admin {
368 return Err("Operation is not allowed".into());
369 }
370
353 let caller = T::CrossAccountId::from_eth(caller);371 let caller = T::CrossAccountId::from_eth(caller);
354 let to = T::CrossAccountId::from_eth(to);372 let to = T::CrossAccountId::from_eth(to);
365 return Err("item id should be next".into());383 return Err("item id should be next".into());
366 }384 }
367385
386 let mut properties = CollectionPropertiesVec::default();
387 properties
388 .try_push(Property {
389 key,
390 value: token_uri
391 .into_bytes()
392 .try_into()
393 .map_err(|_| "token uri is too long")?,
394 })
368 todo!("token uri");395 .map_err(|e| Error::Revert(alloc::format!("Can't add property: {:?}", e)))?;
369396
370 <Pallet<T>>::create_item(397 <Pallet<T>>::create_item(
371 self,398 self,
372 &caller,399 &caller,
373 CreateItemData::<T> {400 CreateItemData::<T> {
374 properties: BoundedVec::default(),401 properties,
375 owner: to,402 owner: to,
376 },403 },
377 &budget,404 &budget,
386 }413 }
387}414}
415
416fn get_token_permission<T: Config>(
417 collection_id: CollectionId,
418 key: &PropertyKey,
419) -> Result<PropertyPermission> {
420 let token_property_permissions = CollectionPropertyPermissions::<T>::try_get(collection_id)
421 .map_err(|_| Error::Revert("No permissions for collection".into()))?;
422 let a = token_property_permissions
423 .get(key)
424 .map(|p| p.clone())
425 .ok_or_else(|| Error::Revert("No permission".into()))?;
426 Ok(a)
427}
428
429fn has_token_permission<T: Config>(
430 collection_id: CollectionId,
431 key: &PropertyKey,
432) -> bool {
433 if let Ok(token_property_permissions) = CollectionPropertyPermissions::<T>::try_get(collection_id) {
434 return token_property_permissions.contains_key(key);
435 }
436
437 false
438}
388439
389#[solidity_interface(name = "ERC721UniqueExtensions")]440#[solidity_interface(name = "ERC721UniqueExtensions")]
390impl<T: Config> NonfungibleHandle<T> {441impl<T: Config> NonfungibleHandle<T> {
491 }542 }
492 expected_index = expected_index.checked_add(1).ok_or("item id overflow")?;543 expected_index = expected_index.checked_add(1).ok_or("item id overflow")?;
493544
494 todo!("token uri");
495 data.push(CreateItemData::<T> {545 data.push(CreateItemData::<T> {
496 properties: BoundedVec::default(),546 properties: BoundedVec::default(),
497 owner: to.clone(),547 owner: to.clone(),
513 ERC721UniqueExtensions,563 ERC721UniqueExtensions,
514 ERC721Mintable,564 ERC721Mintable,
515 ERC721Burnable,565 ERC721Burnable,
516 via("CollectionHandle<T>", common_mut, CollectionProperties),566 via("CollectionHandle<T>", common_mut, Collection),
517 TokenProperties,567 TokenProperties,
518 )568 )
519)]569)]
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
33use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};33use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
34use sp_core::H160;34use sp_core::H160;
35use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, TransactionOutcome};35use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, TransactionOutcome};
36use sp_std::{vec::Vec, vec, collections::btree_set::BTreeSet};36use sp_std::{vec::Vec, vec, collections::btree_map::BTreeMap, collections::btree_set::BTreeSet};
37use core::ops::Deref;37use core::ops::Deref;
38use sp_std::collections::btree_map::BTreeMap;
39use codec::{Encode, Decode, MaxEncodedLen};38use codec::{Encode, Decode, MaxEncodedLen};
40use scale_info::TypeInfo;39use scale_info::TypeInfo;
4140
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
330 }330 }
331}331}
332
333// Selector: 9b5e29c5
334contract CollectionProperties is Dummy, ERC165 {
335 // Selector: setCollectionProperty(string,bytes) 2f073f66
336 function setCollectionProperty(string memory key, bytes memory value)
337 public
338 {
339 require(false, stub_error);
340 key;
341 value;
342 dummy = 0;
343 }
344
345 // Selector: deleteCollectionProperty(string) 7b7debce
346 function deleteCollectionProperty(string memory key) public {
347 require(false, stub_error);
348 key;
349 dummy = 0;
350 }
351
352 // Throws error if key not found
353 //
354 // Selector: collectionProperty(string) cf24fd6d
355 function collectionProperty(string memory key)
356 public
357 view
358 returns (bytes memory)
359 {
360 require(false, stub_error);
361 key;
362 dummy;
363 return hex"";
364 }
365}
366332
367// Selector: d74d154f333// Selector: d74d154f
368contract ERC721UniqueExtensions is Dummy, ERC165 {334contract ERC721UniqueExtensions is Dummy, ERC165 {
414 }380 }
415}381}
382
383// Selector: f5652829
384contract Collection is Dummy, ERC165 {
385 // Selector: setCollectionProperty(string,bytes) 2f073f66
386 function setCollectionProperty(string memory key, bytes memory value)
387 public
388 {
389 require(false, stub_error);
390 key;
391 value;
392 dummy = 0;
393 }
394
395 // Selector: deleteCollectionProperty(string) 7b7debce
396 function deleteCollectionProperty(string memory key) public {
397 require(false, stub_error);
398 key;
399 dummy = 0;
400 }
401
402 // Throws error if key not found
403 //
404 // Selector: collectionProperty(string) cf24fd6d
405 function collectionProperty(string memory key)
406 public
407 view
408 returns (bytes memory)
409 {
410 require(false, stub_error);
411 key;
412 dummy;
413 return hex"";
414 }
415
416 // Selector: ethSetSponsor(address) 8f9af356
417 function ethSetSponsor(address sponsor) public {
418 require(false, stub_error);
419 sponsor;
420 dummy = 0;
421 }
422
423 // Selector: ethConfirmSponsorship() a8580d1a
424 function ethConfirmSponsorship() public {
425 require(false, stub_error);
426 dummy = 0;
427 }
428
429 // Selector: setLimit(string,string) bf4d2014
430 function setLimit(string memory limit, string memory value) public {
431 require(false, stub_error);
432 limit;
433 value;
434 dummy = 0;
435 }
436
437 // Selector: contractAddress() f6b4dfb4
438 function contractAddress() public view returns (address) {
439 require(false, stub_error);
440 dummy;
441 return 0x0000000000000000000000000000000000000000;
442 }
443}
416444
417contract UniqueNFT is445contract UniqueNFT is
418 Dummy,446 Dummy,
423 ERC721UniqueExtensions,451 ERC721UniqueExtensions,
424 ERC721Mintable,452 ERC721Mintable,
425 ERC721Burnable,453 ERC721Burnable,
426 CollectionProperties,454 Collection,
427 TokenProperties455 TokenProperties
428{}456{}
429457
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',
22 'frame-support/std',23 'frame-support/std',
23 'frame-system/std',24 'frame-system/std',
24 'pallet-evm/std',25 'pallet-evm/std',
27 'sp-std/std',28 'sp-std/std',
28 'sp-runtime/std',29 'sp-runtime/std',
29 'frame-benchmarking/std',30 'frame-benchmarking/std',
31 'evm-coder/std',
32 'pallet-evm-coder-substrate/std',
33 'pallet-nonfungible/std',
30]34]
31limit-testing = ["up-data-structs/limit-testing"]35limit-testing = ["up-data-structs/limit-testing"]
3236
33################################################################################37################################################################################
34# Substrate Dependencies38# Standart Dependencies
39
40[dependencies.serde]
41default-features = false
42features = ['derive']
43version = '1.0.130'
44
45[dependencies.ethereum]
46version = "0.12.0"
47default-features = false
48
49################################################################################
50# Substrate Dependencies
3551
36[dependencies.codec]52[dependencies.codec]
37default-features = false53default-features = false
85] }100] }
86pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }101pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
87pallet-common = { default-features = false, path = "../common" }102pallet-common = { default-features = false, path = "../common" }
103evm-coder = { default-features = false, path = '../../crates/evm-coder' }
104pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }
105pallet-nonfungible = { default-features = false, path = '../../pallets/nonfungible' }
88106
addedpallets/unique/src/eth/mod.rsdiffbeforeafterboth

no changes

addedpallets/unique/src/eth/stubs/CollectionHelper.rawdiffbeforeafterboth

binary blob — no preview

addedpallets/unique/src/eth/stubs/CollectionHelper.soldiffbeforeafterboth

no changes

modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
22 clippy::unused_unit22 clippy::unused_unit
23)]23)]
24
25extern crate alloc;
2426
25use frame_support::{27use frame_support::{
26 decl_module, decl_storage, decl_error, decl_event,28 decl_module, decl_storage, decl_error, decl_event,
46 CollectionHandle, Pallet as PalletCommon, CommonWeightInfo, dispatch::dispatch_call,48 CollectionHandle, Pallet as PalletCommon, CommonWeightInfo, dispatch::dispatch_call,
47 dispatch::CollectionDispatch,49 dispatch::CollectionDispatch,
48};50};
51pub mod eth;
4952
50#[cfg(feature = "runtime-benchmarks")]53#[cfg(feature = "runtime-benchmarks")]
51mod benchmarking;54mod benchmarking;
520 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;523 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
521 target_collection.check_is_owner(&sender)?;524 target_collection.check_is_owner(&sender)?;
522525
523 target_collection.sponsorship = SponsorshipState::Unconfirmed(new_sponsor.clone());526 target_collection.set_sponsor(new_sponsor.clone());
524527
525 <Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorSet(528 <Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorSet(
526 collection_id,529 collection_id,
544547
545 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;548 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
546 ensure!(549 ensure!(
547 target_collection.sponsorship.pending_sponsor() == Some(&sender),550 target_collection.confirm_sponsorship(&sender),
548 Error::<T>::ConfirmUnsetSponsorFail551 Error::<T>::ConfirmUnsetSponsorFail
549 );552 );
550
551 target_collection.sponsorship = SponsorshipState::Confirmed(sender.clone());
552553
553 <Pallet<T>>::deposit_event(Event::<T>::SponsorshipConfirmed(554 <Pallet<T>>::deposit_event(Event::<T>::SponsorshipConfirmed(
554 collection_id,555 collection_id,
modifiedprimitives/data-structs/Cargo.tomldiffbeforeafterboth
40 "sp-std/std",40 "sp-std/std",
41 "pallet-evm/std",41 "pallet-evm/std",
42]42]
43serde1 = ["serde"]43serde1 = ["serde/alloc"]
44limit-testing = []44limit-testing = []
45runtime-benchmarks = []45runtime-benchmarks = []
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
506}506}
507507
508#[derive(Encode, Decode, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen)]508#[derive(Encode, Decode, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen)]
509#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
509pub enum MetaUpdatePermission {510pub enum MetaUpdatePermission {
510 ItemOwner,511 ItemOwner,
511 Admin,512 Admin,
760 self.0.get(key)761 self.0.get(key)
761 }762 }
763
764 pub fn contains_key(&self, key: &PropertyKey) -> bool {
765 self.0.contains_key(key)
766 }
762767
763 fn check_property_key(key: &PropertyKey) -> Result<(), PropertiesError> {768 fn check_property_key(key: &PropertyKey) -> Result<(), PropertiesError> {
764 if key.is_empty() {769 if key.is_empty() {
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
50pub use pallet_balances::Call as BalancesCall;50pub use pallet_balances::Call as BalancesCall;
51pub use pallet_evm::{51pub use pallet_evm::{
52 EnsureAddressTruncated, HashedAddressMapping, Runner, account::CrossAccountId as _,52 EnsureAddressTruncated, HashedAddressMapping, Runner, account::CrossAccountId as _,
53 OnMethodCall, Account as EVMAccount, FeeCalculator, GasWeightMapping,
53};54};
54pub use frame_support::{55pub use frame_support::{
55 construct_runtime, match_types,56 construct_runtime, match_types,
79};80};
80use smallvec::smallvec;81use smallvec::smallvec;
81use codec::{Encode, Decode};82use codec::{Encode, Decode};
82use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping};
83use fp_rpc::TransactionStatus;83use fp_rpc::TransactionStatus;
84use sp_runtime::{84use sp_runtime::{
85 traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},85 traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},
306 pallet_evm_migration::OnMethodCall<Self>,306 pallet_evm_migration::OnMethodCall<Self>,
307 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,307 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,
308 CollectionDispatchT<Self>,308 CollectionDispatchT<Self>,
309 pallet_unique::eth::CollectionHelperOnMethodCall<Self>,
309 );310 );
310 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;311 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;
311 type ChainId = ChainId;312 type ChainId = ChainId;
975 0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,976 0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,
976 ]);977 ]);
978
979 // 0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f
980 pub const EvmCollectionHelperAddress: H160 = H160([
981 0x6c, 0x4e, 0x9f, 0xe1, 0xae, 0x37, 0xa4, 0x1e, 0x93, 0xce, 0xe4, 0x29, 0xe8, 0xe1, 0x88, 0x1a, 0xbd, 0xcb, 0xb5, 0x4f,
982 ]);
977}983}
978984
979impl pallet_evm_contract_helpers::Config for Runtime {985impl pallet_evm_contract_helpers::Config for Runtime {
980 type ContractAddress = HelpersContractAddress;986 type ContractAddress = HelpersContractAddress;
981 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;987 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;
982}988}
989
990impl pallet_unique::eth::Config for Runtime {
991 type ContractAddress = EvmCollectionHelperAddress;
992}
983993
984construct_runtime!(994construct_runtime!(
985 pub enum Runtime where995 pub enum Runtime where
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
66 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,66 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,
67 },67 },
68};68};
69use unique_runtime_common::dispatch::{CollectionDispatchT, CollectionDispatch};
70use up_data_structs::*;69use up_data_structs::*;
71// use pallet_contracts::weights::WeightInfo;70// use pallet_contracts::weights::WeightInfo;
72// #[cfg(any(feature = "std", test))]71// #[cfg(any(feature = "std", test))]
119use unique_runtime_common::{impl_common_runtime_apis, types::*, constants::*};118use unique_runtime_common::{
119 impl_common_runtime_apis,
120 types::*,
121 constants::*,
122 dispatch::{CollectionDispatchT, CollectionDispatch},
123 sponsoring::UniqueSponsorshipHandler,
124 eth_sponsoring::UniqueEthSponsorshipHandler,
125 weights::CommonWeights,
126};
120127
121pub const RUNTIME_NAME: &str = "quartz";128pub const RUNTIME_NAME: &str = "quartz";
278 pallet_evm_migration::OnMethodCall<Self>,285 pallet_evm_migration::OnMethodCall<Self>,
279 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,286 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,
280 CollectionDispatchT<Self>,287 CollectionDispatchT<Self>,
288 pallet_unique::eth::CollectionHelperOnMethodCall<Self>,
281 );289 );
282 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;290 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;
283 type ChainId = ChainId;291 type ChainId = ChainId;
891impl pallet_unique::Config for Runtime {899impl pallet_unique::Config for Runtime {
892 type Event = Event;900 type Event = Event;
893 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;901 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
902 type CommonWeightInfo = CommonWeights<Self>;
894}903}
895904
896parameter_types! {905parameter_types! {
912// }921// }
913922
914type EvmSponsorshipHandler = (923type EvmSponsorshipHandler = (
915 pallet_unique::UniqueEthSponsorshipHandler<Runtime>,924 UniqueEthSponsorshipHandler<Runtime>,
916 pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,925 pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,
917);926);
918type SponsorshipHandler = (927type SponsorshipHandler = (
919 pallet_unique::UniqueSponsorshipHandler<Runtime>,928 UniqueSponsorshipHandler<Runtime>,
920 //pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,929 //pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,
921 pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,930 pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,
922);931);
952 0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,961 0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,
953 ]);962 ]);
963
964 // 0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f
965 pub const EvmCollectionHelperAddress: H160 = H160([
966 0x6c, 0x4e, 0x9f, 0xe1, 0xae, 0x37, 0xa4, 0x1e, 0x93, 0xce, 0xe4, 0x29, 0xe8, 0xe1, 0x88, 0x1a, 0xbd, 0xcb, 0xb5, 0x4f,
967 ]);
954}968}
955969
956impl pallet_evm_contract_helpers::Config for Runtime {970impl pallet_evm_contract_helpers::Config for Runtime {
957 type ContractAddress = HelpersContractAddress;971 type ContractAddress = HelpersContractAddress;
958 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;972 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;
959}973}
974
975impl pallet_unique::eth::Config for Runtime {
976 type ContractAddress = EvmCollectionHelperAddress;
977}
960978
961construct_runtime!(979construct_runtime!(
962 pub enum Runtime where980 pub enum Runtime where
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
49// A few exports that help ease life for downstream crates.49// A few exports that help ease life for downstream crates.
50pub use pallet_balances::Call as BalancesCall;50pub use pallet_balances::Call as BalancesCall;
51pub use pallet_evm::{51pub use pallet_evm::{
52 EnsureAddressTruncated, HashedAddressMapping, Runner, account::CrossAccountId as _,52 EnsureAddressTruncated, HashedAddressMapping, Runner, account::CrossAccountId as _, OnMethodCall,
53 Account as EVMAccount, FeeCalculator, GasWeightMapping,
53};54};
54pub use frame_support::{55pub use frame_support::{
55 construct_runtime, match_types,56 construct_runtime, match_types,
84};85};
85use smallvec::smallvec;86use smallvec::smallvec;
86use codec::{Encode, Decode};87use codec::{Encode, Decode};
87use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping};
88use fp_rpc::TransactionStatus;88use fp_rpc::TransactionStatus;
89use sp_runtime::{89use sp_runtime::{
90 traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},90 traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},
123use unique_runtime_common::{impl_common_runtime_apis, types::*, constants::*};123use unique_runtime_common::{
124 impl_common_runtime_apis,
125 types::*,
126 constants::*,
127 dispatch::{CollectionDispatchT, CollectionDispatch},
128 sponsoring::UniqueSponsorshipHandler,
129 eth_sponsoring::UniqueEthSponsorshipHandler,
130 weights::CommonWeights,
131};
124132
125pub const RUNTIME_NAME: &str = "unique";133pub const RUNTIME_NAME: &str = "unique";
282 pallet_evm_migration::OnMethodCall<Self>,290 pallet_evm_migration::OnMethodCall<Self>,
283 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,291 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,
284 CollectionDispatchT<Self>,292 CollectionDispatchT<Self>,
293 pallet_unique::eth::CollectionHelperOnMethodCall<Self>,
285 );294 );
286 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;295 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;
287 type ChainId = ChainId;296 type ChainId = ChainId;
957 0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,966 0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,
958 ]);967 ]);
968
969 // 0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f
970 pub const EvmCollectionHelperAddress: H160 = H160([
971 0x6c, 0x4e, 0x9f, 0xe1, 0xae, 0x37, 0xa4, 0x1e, 0x93, 0xce, 0xe4, 0x29, 0xe8, 0xe1, 0x88, 0x1a, 0xbd, 0xcb, 0xb5, 0x4f,
972 ]);
959}973}
960974
961impl pallet_evm_contract_helpers::Config for Runtime {975impl pallet_evm_contract_helpers::Config for Runtime {
962 type ContractAddress = HelpersContractAddress;976 type ContractAddress = HelpersContractAddress;
963 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;977 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;
964}978}
979
980impl pallet_unique::eth::Config for Runtime {
981 type ContractAddress = EvmCollectionHelperAddress;
982}
965983
966construct_runtime!(984construct_runtime!(
967 pub enum Runtime where985 pub enum Runtime where
modifiedtests/package.jsondiffbeforeafterboth
73 "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",73 "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",
74 "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",74 "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",
75 "testLimits": "mocha --timeout 9999999 -r ts-node/register ./**/limits.test.ts",75 "testLimits": "mocha --timeout 9999999 -r ts-node/register ./**/limits.test.ts",
76 "testEthCreateCollection": "mocha --timeout 9999999 -r ts-node/register ./**/eth/createCollection.test.ts",
76 "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",77 "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",
77 "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",78 "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",
78 "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .",79 "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .",
88 "bignumber.js": "^9.0.2",89 "bignumber.js": "^9.0.2",
89 "chai-as-promised": "^7.1.1",90 "chai-as-promised": "^7.1.1",
90 "find-process": "^1.4.7",91 "find-process": "^1.4.7",
91 "solc": "^0.8.13",92 "solc": "0.8.13",
92 "web3": "^1.7.3"93 "web3": "^1.7.3"
93 },94 },
94 "standard": {95 "standard": {
addedtests/src/eth/api/CollectionHelper.soldiffbeforeafterboth

no changes

modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
65 returns (uint256);65 returns (uint256);
66}66}
6767
68// Selector: 9b5e29c568// Selector: f5652829
69interface CollectionProperties is Dummy, ERC165 {69interface Collection is Dummy, ERC165 {
70 // Selector: setCollectionProperty(string,bytes) 2f073f6670 // Selector: setCollectionProperty(string,bytes) 2f073f66
71 function setCollectionProperty(string memory key, bytes memory value)71 function setCollectionProperty(string memory key, bytes memory value)
72 external;72 external;
82 view82 view
83 returns (bytes memory);83 returns (bytes memory);
84
85 // Selector: ethSetSponsor(address) 8f9af356
86 function ethSetSponsor(address sponsor) external;
87
88 // Selector: ethConfirmSponsorship() a8580d1a
89 function ethConfirmSponsorship() external;
90
91 // Selector: setLimit(string,string) bf4d2014
92 function setLimit(string memory limit, string memory value) external;
93
94 // Selector: contractAddress() f6b4dfb4
95 function contractAddress() external view returns (address);
84}96}
8597
86interface UniqueFungible is98interface UniqueFungible is
87 Dummy,99 Dummy,
88 ERC165,100 ERC165,
89 ERC20,101 ERC20,
90 ERC20UniqueExtensions,102 ERC20UniqueExtensions,
91 CollectionProperties103 Collection
92{}104{}
93105
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
191 function totalSupply() external view returns (uint256);191 function totalSupply() external view returns (uint256);
192}192}
193
194// Selector: 9b5e29c5
195interface CollectionProperties is Dummy, ERC165 {
196 // Selector: setCollectionProperty(string,bytes) 2f073f66
197 function setCollectionProperty(string memory key, bytes memory value)
198 external;
199
200 // Selector: deleteCollectionProperty(string) 7b7debce
201 function deleteCollectionProperty(string memory key) external;
202
203 // Throws error if key not found
204 //
205 // Selector: collectionProperty(string) cf24fd6d
206 function collectionProperty(string memory key)
207 external
208 view
209 returns (bytes memory);
210}
211193
212// Selector: d74d154f194// Selector: d74d154f
213interface ERC721UniqueExtensions is Dummy, ERC165 {195interface ERC721UniqueExtensions is Dummy, ERC165 {
231 returns (bool);213 returns (bool);
232}214}
215
216// Selector: f5652829
217interface Collection is Dummy, ERC165 {
218 // Selector: setCollectionProperty(string,bytes) 2f073f66
219 function setCollectionProperty(string memory key, bytes memory value)
220 external;
221
222 // Selector: deleteCollectionProperty(string) 7b7debce
223 function deleteCollectionProperty(string memory key) external;
224
225 // Throws error if key not found
226 //
227 // Selector: collectionProperty(string) cf24fd6d
228 function collectionProperty(string memory key)
229 external
230 view
231 returns (bytes memory);
232
233 // Selector: ethSetSponsor(address) 8f9af356
234 function ethSetSponsor(address sponsor) external;
235
236 // Selector: ethConfirmSponsorship() a8580d1a
237 function ethConfirmSponsorship() external;
238
239 // Selector: setLimit(string,string) bf4d2014
240 function setLimit(string memory limit, string memory value) external;
241
242 // Selector: contractAddress() f6b4dfb4
243 function contractAddress() external view returns (address);
244}
233245
234interface UniqueNFT is246interface UniqueNFT is
235 Dummy,247 Dummy,
240 ERC721UniqueExtensions,252 ERC721UniqueExtensions,
241 ERC721Mintable,253 ERC721Mintable,
242 ERC721Burnable,254 ERC721Burnable,
243 CollectionProperties,255 Collection,
244 TokenProperties256 TokenProperties
245{}257{}
246258
modifiedtests/src/eth/base.test.tsdiffbeforeafterboth
23 GAS_ARGS,
24 itWeb3,
25 recordEthFee,
26 usingWeb3,
27} from './util/helpers';
18import {expect} from 'chai';28import {expect} from 'chai';
19import {createCollectionExpectSuccess, createItemExpectSuccess, UNIQUE} from '../util/helpers';29import {createCollectionExpectSuccess, createItemExpectSuccess, UNIQUE} from '../util/helpers';
addedtests/src/eth/collectionHelperAbi.jsondiffbeforeafterboth

no changes

modifiedtests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth
29 normalizeEvents,29 normalizeEvents,
30 subToEth,30 subToEth,
31 executeEthTxOnSub,31 executeEthTxOnSub,
32 evmCollectionHelper,
33 getCollectionAddressFromResult,
34 evmCollection,
32} from './util/helpers';35} from './util/helpers';
33import {36import {
34 addCollectionAdminExpectSuccess,37 addCollectionAdminExpectSuccess,
35 createCollectionExpectSuccess,38 createCollectionExpectSuccess,
36 getCreateCollectionResult,39 getDetailedCollectionInfo,
37 transferBalanceTo,40 transferBalanceTo,
38} from '../util/helpers';41} from '../util/helpers';
39import nonFungibleAbi from './nonFungibleAbi.json';42import nonFungibleAbi from './nonFungibleAbi.json';
40import {
41 submitTransactionAsync,
42} from '../substrate/substrate-api';
43import getBalance from '../substrate/get-balance';43import getBalance from '../substrate/get-balance';
44import {alicesPublicKey} from '../accounts';44import {evmToAddress} from '@polkadot/util-crypto';
4545
46describe('Sponsoring EVM contracts', () => {46describe('Sponsoring EVM contracts', () => {
47 itWeb3('Sponsoring can be set by the address that has deployed the contract', async ({api, web3}) => {47 itWeb3('Sponsoring can be set by the address that has deployed the contract', async ({api, web3}) => {
221 expect(await helpers.methods.getSponsoringRateLimit(flipper.options.address).call()).to.be.equals('7200');221 expect(await helpers.methods.getSponsoringRateLimit(flipper.options.address).call()).to.be.equals('7200');
222 });222 });
223223
224 //TODO: CORE-302 add eth methods
224 itWeb3('Sponsoring evm address from substrate collection', async ({api, web3}) => {225 itWeb3.skip('Sponsoring evm address from substrate collection', async ({api, web3}) => {
225 const owner = privateKey('//Alice');226 const owner = await createEthAccountWithBalance(api, web3);
226 const userEth = createEthAccount(web3);227 const collectionHelper = evmCollectionHelper(web3, owner);
227 const collectionId = await createCollectionExpectSuccess();228 let result = await collectionHelper.methods.create721Collection('Sponsor collection', '1', '1').send();
228
229 {
230 const tx = api.tx.unique.setCollectionSponsor(collectionId, owner.address);229 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
231 const events = await submitTransactionAsync(owner, tx);230 const sponsor = await createEthAccountWithBalance(api, web3);
232 const result = getCreateCollectionResult(events);231 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
233 expect(result.success).to.be.true;
234 }
235 {
236 const tx = api.tx.unique.confirmSponsorship(collectionId);232 result = await collectionEvm.methods.ethSetSponsor(sponsor).send();
237 const events = await submitTransactionAsync(owner, tx);233 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;
238 const result = getCreateCollectionResult(events);
239 expect(result.success).to.be.true;234 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;
240 }
241
242 const address = collectionIdToAddress(collectionId);
243 const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: userEth, ...GAS_ARGS});
244
245 { // This part should fail, because user not in access list and user have no money
246 const nextTokenId = await contract.methods.nextTokenId().call();
247 expect(nextTokenId).to.be.equal('1');235 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));
248 await expect(contract.methods.mintWithTokenURI(236 await expect(collectionEvm.methods.ethConfirmSponsorship().call()).to.be.rejectedWith('Caller is not set as sponsor');
249 userEth,237
250 nextTokenId,
251 'Test URI',
252 ).call({from: userEth})).to.be.rejectedWith(/PublicMintingNotAllowed/);
253 }
254
255 {
256 const tx = api.tx.unique.setPublicAccessMode(collectionId, 'AllowList');238 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);
257 const events = await submitTransactionAsync(owner, tx);239 await sponsorCollection.methods.ethConfirmSponsorship().send();
258 const result = getCreateCollectionResult(events);240 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;
259 expect(result.success).to.be.true;241 expect(collectionSub.sponsorship.isConfirmed).to.be.true;
260 }
261 {
262 const tx = api.tx.unique.addToAllowList(collectionId, {Ethereum: userEth});
263 const events = await submitTransactionAsync(owner, tx);
264 const result = getCreateCollectionResult(events);
265 expect(result.success).to.be.true;242 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));
266 }243
267 {
268 const tx = api.tx.unique.setMintPermission(collectionId, true);244 const user = createEthAccount(web3);
269 const events = await submitTransactionAsync(owner, tx);245 const userContract = evmCollection(web3, user, collectionIdAddress);
270 const result = getCreateCollectionResult(events);246 const nextTokenId = await userContract.methods.nextTokenId().call();
247
271 expect(result.success).to.be.true;248 expect(nextTokenId).to.be.equal('1');
272 }
273
274 const [alicesBalanceBefore] = await getBalance(api, [alicesPublicKey]);249 await expect(userContract.methods.mintWithTokenURI(
250 user,
251 nextTokenId,
252 'Test URI',
253 ).call()).to.be.rejectedWith('PublicMintingNotAllowed');
254
255 // TODO: add this methods to eth
256 // {
257 // const tx = api.tx.unique.setPublicAccessMode(collectionId, 'AllowList');
258 // const events = await submitTransactionAsync(owner, tx);
259 // const result = getCreateCollectionResult(events);
260 // expect(result.success).to.be.true;
261 // }
262 // {
263 // const tx = api.tx.unique.addToAllowList(collectionId, {Ethereum: userEth});
264 // const events = await submitTransactionAsync(owner, tx);
265 // const result = getCreateCollectionResult(events);
266 // expect(result.success).to.be.true;
267 // }
268 // {
269 // const tx = api.tx.unique.setMintPermission(collectionId, true);
270 // const events = await submitTransactionAsync(owner, tx);
271 // const result = getCreateCollectionResult(events);
272 // expect(result.success).to.be.true;
273 // }
274
275 // const [alicesBalanceBefore] = await getBalance(api, [alicesPublicKey]);
275276
276 {277 {
277 const nextTokenId = await contract.methods.nextTokenId().call();278 const nextTokenId = await userContract.methods.nextTokenId().call();
278 expect(nextTokenId).to.be.equal('1');279 expect(nextTokenId).to.be.equal('1');
279 const result = await contract.methods.mintWithTokenURI(280 const result = await userContract.methods.mintWithTokenURI(
280 userEth,281 user,
281 nextTokenId,282 nextTokenId,
282 'Test URI',283 'Test URI',
283 ).send({from: userEth});284 ).send();
284 const events = normalizeEvents(result.events);285 const events = normalizeEvents(result.events);
285286
286 expect(events).to.be.deep.equal([287 expect(events).to.be.deep.equal([
287 {288 {
288 address,289 collectionIdAddress,
289 event: 'Transfer',290 event: 'Transfer',
290 args: {291 args: {
291 from: '0x0000000000000000000000000000000000000000',292 from: '0x0000000000000000000000000000000000000000',
292 to: userEth,293 to: user,
293 tokenId: nextTokenId,294 tokenId: nextTokenId,
294 },295 },
295 },296 },
296 ]);297 ]);
297298
298 expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');299 expect(await userContract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');
299 }300 }
300
301 const [alicesBalanceAfter] = await getBalance(api, [alicesPublicKey]);
302 expect(alicesBalanceAfter < alicesBalanceBefore).to.be.true;
303 });301 });
304302
305303 //TODO: CORE-302 add eth methods
306 itWeb3('Check that transaction via EVM spend money from substrate address', async ({api, web3}) => {304 itWeb3.skip('Check that transaction via EVM spend money from substrate address', async ({api, web3}) => {
307 const owner = privateKey('//Alice');305 const owner = privateKey('//Alice');
308 const user = privateKey(`//User/${Date.now()}`);306 const user = privateKey(`//User/${Date.now()}`);
309 const userEth = subToEth(user.address);307 const userEth = subToEth(user.address);
addedtests/src/eth/createCollection.test.tsdiffbeforeafterboth

no changes

modifiedtests/src/eth/fungibleAbi.jsondiffbeforeafterboth
1[1[
2 {2 {
3 "anonymous": false,
4 "inputs": [
5 {
6 "indexed": true,
7 "internalType": "address",
8 "name": "owner",
9 "type": "address"
10 },
11 {
12 "indexed": true,
13 "internalType": "address",
14 "name": "spender",
15 "type": "address"
16 },
17 {
18 "indexed": false,
19 "internalType": "uint256",
20 "name": "value",
21 "type": "uint256"
22 }
23 ],
24 "name": "Approval",
25 "type": "event"
26 },
27 {
28 "anonymous": false,
29 "inputs": [
30 {
31 "indexed": true,
32 "internalType": "address",
33 "name": "from",
34 "type": "address"
35 },
36 {
37 "indexed": true,
38 "internalType": "address",
39 "name": "to",
40 "type": "address"
41 },
42 {
43 "indexed": false,
44 "internalType": "uint256",
45 "name": "value",
46 "type": "uint256"
47 }
48 ],
49 "name": "Transfer",
50 "type": "event"
51 },
52 {
53 "inputs": [
54 { "internalType": "address", "name": "owner", "type": "address" },
55 { "internalType": "address", "name": "spender", "type": "address" }
56 ],
57 "name": "allowance",
3 "constant": false,58 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
59 "stateMutability": "view",
60 "type": "function"
61 },
62 {
4 "inputs": [63 "inputs": [
5 {64 { "internalType": "address", "name": "spender", "type": "address" },
6 "name": "_spender",
7 "type": "address"
8 },
9 {65 { "internalType": "uint256", "name": "amount", "type": "uint256" }
10 "name": "_value",
11 "type": "uint256"
12 }
13 ],66 ],
14 "name": "approve",67 "name": "approve",
15 "outputs": [68 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
16 {
17 "name": "",
18 "type": "bool"
19 }
20 ],
21 "payable": false,
22 "stateMutability": "nonpayable",69 "stateMutability": "nonpayable",
23 "type": "function"70 "type": "function"
24 },71 },
25 {72 {
73 "inputs": [
26 "constant": true,74 { "internalType": "address", "name": "owner", "type": "address" }
27 "inputs": [],75 ],
28 "name": "totalSupply",76 "name": "balanceOf",
29 "outputs": [77 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
30 {
31 "name": "",
32 "type": "uint256"
33 }
34 ],
35 "payable": false,
36 "stateMutability": "view",78 "stateMutability": "view",
37 "type": "function"79 "type": "function"
38 },80 },
39 {81 {
40 "constant": false,
41 "inputs": [82 "inputs": [
42 {
43 "name": "_from",
44 "type": "address"83 { "internalType": "address", "name": "from", "type": "address" },
45 },
46 {
47 "name": "_to",
48 "type": "address"
49 },
50 {84 { "internalType": "uint256", "name": "amount", "type": "uint256" }
51 "name": "_value",
52 "type": "uint256"
53 }
54 ],85 ],
55 "name": "transferFrom",86 "name": "burnFrom",
56 "outputs": [87 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
57 {
58 "name": "",
59 "type": "bool"
60 }
61 ],
62 "payable": false,
63 "stateMutability": "nonpayable",88 "stateMutability": "nonpayable",
64 "type": "function"89 "type": "function"
65 },90 },
66 {91 {
67 "constant": true,
68 "inputs": [92 "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
69 {
70 "name": "_owner",
71 "type": "address"
72 }
73 ],
74 "name": "balanceOf",93 "name": "collectionProperty",
75 "outputs": [94 "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
76 {
77 "name": "balance",
78 "type": "uint256"
79 }
80 ],
81 "payable": false,
82 "stateMutability": "view",95 "stateMutability": "view",
83 "type": "function"96 "type": "function"
84 },97 },
85 {98 {
99 "inputs": [],
100 "name": "contractAddress",
86 "constant": false,101 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
102 "stateMutability": "view",
103 "type": "function"
104 },
105 {
87 "inputs": [106 "inputs": [],
88 {
89 "name": "_to",107 "name": "decimals",
90 "type": "address"108 "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
91 },109 "stateMutability": "view",
110 "type": "function"
111 },
92 {112 {
93 "name": "_value",113 "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
114 "name": "deleteCollectionProperty",
115 "outputs": [],
116 "stateMutability": "nonpayable",
94 "type": "uint256"117 "type": "function"
95 }118 },
119 {
96 ],120 "inputs": [],
97 "name": "transfer",121 "name": "ethConfirmSponsorship",
98 "outputs": [122 "outputs": [],
123 "stateMutability": "nonpayable",
124 "type": "function"
125 },
126 {
127 "inputs": [
99 {128 { "internalType": "address", "name": "sponsor", "type": "address" }
100 "name": "",
101 "type": "bool"
102 }
103 ],129 ],
104 "payable": false,130 "name": "ethSetSponsor",
131 "outputs": [],
105 "stateMutability": "nonpayable",132 "stateMutability": "nonpayable",
106 "type": "function"133 "type": "function"
107 },134 },
108 {135 {
136 "inputs": [],
137 "name": "name",
109 "constant": true,138 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
139 "stateMutability": "view",
140 "type": "function"
141 },
142 {
110 "inputs": [143 "inputs": [
111 {144 { "internalType": "string", "name": "key", "type": "string" },
112 "name": "_owner",
113 "type": "address"
114 },
115 {145 { "internalType": "bytes", "name": "value", "type": "bytes" }
116 "name": "_spender",
117 "type": "address"
118 }
119 ],146 ],
147 "name": "setCollectionProperty",
148 "outputs": [],
149 "stateMutability": "nonpayable",
150 "type": "function"
151 },
152 {
153 "inputs": [
154 { "internalType": "string", "name": "limit", "type": "string" },
155 { "internalType": "string", "name": "value", "type": "string" }
156 ],
157 "name": "setLimit",
158 "outputs": [],
159 "stateMutability": "nonpayable",
160 "type": "function"
161 },
162 {
163 "inputs": [
164 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
165 ],
120 "name": "allowance",166 "name": "supportsInterface",
121 "outputs": [167 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
122 {168 "stateMutability": "view",
123 "name": "",
124 "type": "uint256"
125 }
126 ],
127 "payable": false,169 "type": "function"
170 },
171 {
172 "inputs": [],
173 "name": "symbol",
174 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
128 "stateMutability": "view",175 "stateMutability": "view",
129 "type": "function"176 "type": "function"
130 },177 },
131 {178 {
132 "anonymous": false,179 "inputs": [],
180 "name": "totalSupply",
133 "inputs": [181 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
134 {182 "stateMutability": "view",
135 "indexed": true,
136 "name": "owner",
137 "type": "address"183 "type": "function"
138 },184 },
185 {
186 "inputs": [
139 {187 { "internalType": "address", "name": "to", "type": "address" },
140 "indexed": true,
141 "name": "spender",
142 "type": "address"
143 },
144 {188 { "internalType": "uint256", "name": "amount", "type": "uint256" }
145 "indexed": false,
146 "name": "value",
147 "type": "uint256"
148 }
149 ],189 ],
150 "name": "Approval",190 "name": "transfer",
151 "type": "event"191 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
152 },192 "stateMutability": "nonpayable",
153 {
154 "anonymous": false,193 "type": "function"
194 },
195 {
155 "inputs": [196 "inputs": [
156 {197 { "internalType": "address", "name": "from", "type": "address" },
157 "indexed": true,
158 "name": "from",
159 "type": "address"
160 },
161 {198 { "internalType": "address", "name": "to", "type": "address" },
162 "indexed": true,
163 "name": "to",
164 "type": "address"
165 },
166 {199 { "internalType": "uint256", "name": "amount", "type": "uint256" }
167 "indexed": false,
168 "name": "value",
169 "type": "uint256"
170 }
171 ],200 ],
172 "name": "Transfer",201 "name": "transferFrom",
202 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
203 "stateMutability": "nonpayable",
173 "type": "event"204 "type": "function"
174 }205 }
175]206]
207
deletedtests/src/eth/fungibleMetadataAbi.jsondiffbeforeafterboth

no changes

deletedtests/src/eth/metadata.test.tsdiffbeforeafterboth

no changes

modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
1616
17import privateKey from '../substrate/privateKey';17import privateKey from '../substrate/privateKey';
18import {approveExpectSuccess, burnItemExpectSuccess, createCollectionExpectSuccess, createItemExpectSuccess, transferExpectSuccess, transferFromExpectSuccess, UNIQUE} from '../util/helpers';18import {approveExpectSuccess, burnItemExpectSuccess, createCollectionExpectSuccess, createItemExpectSuccess, transferExpectSuccess, transferFromExpectSuccess, UNIQUE} from '../util/helpers';
19import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, GAS_ARGS, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, transferBalanceToEth} from './util/helpers';19import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, evmCollection, evmCollectionHelper, GAS_ARGS, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, transferBalanceToEth} from './util/helpers';
20import nonFungibleAbi from './nonFungibleAbi.json';20import nonFungibleAbi from './nonFungibleAbi.json';
21import {expect} from 'chai';21import {expect} from 'chai';
22import {submitTransactionAsync} from '../substrate/substrate-api';22import {submitTransactionAsync} from '../substrate/substrate-api';
7575
76describe('NFT: Plain calls', () => {76describe('NFT: Plain calls', () => {
77 itWeb3('Can perform mint()', async ({web3, api}) => {77 itWeb3('Can perform mint()', async ({web3, api}) => {
78 const collection = await createCollectionExpectSuccess({78 const owner = await createEthAccountWithBalance(api, web3);
79 mode: {type: 'NFT'},
80 });
81 const alice = privateKey('//Alice');
82
83 const caller = await createEthAccountWithBalance(api, web3);79 const helper = evmCollectionHelper(web3, owner);
84 const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: caller});80 let result = await helper.methods.create721Collection('Mint collection', '6', '6').send();
85 await submitTransactionAsync(alice, changeAdminTx);81 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
86 const receiver = createEthAccount(web3);82 const receiver = createEthAccount(web3);
87
88 const address = collectionIdToAddress(collection);
89 const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS});83 const contract = evmCollection(web3, owner, collectionIdAddress);
90
91 {
92 const nextTokenId = await contract.methods.nextTokenId().call();84 const nextTokenId = await contract.methods.nextTokenId().call();
85
93 expect(nextTokenId).to.be.equal('1');86 expect(nextTokenId).to.be.equal('1');
94 const result = await contract.methods.mintWithTokenURI(87 result = await contract.methods.mintWithTokenURI(
95 receiver,88 receiver,
96 nextTokenId,89 nextTokenId,
97 'Test URI',90 'Test URI',
98 ).send({from: caller});91 ).send();
92
99 const events = normalizeEvents(result.events);93 const events = normalizeEvents(result.events);
94 const address = collectionIdToAddress(collectionId);
10095
101 expect(events).to.be.deep.equal([96 expect(events).to.be.deep.equal([
102 {97 {
111 ]);106 ]);
112107
113 expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');108 expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');
114 }109
110 // TODO: this wont work right now, need release 919000 first
111 // await helper.methods.setOffchainSchema(collectionIdAddress, 'https://offchain-service.local/token-info/{id}').send();
112 // const tokenUri = await contract.methods.tokenURI(nextTokenId).call();
113 // expect(tokenUri).to.be.equal(`https://offchain-service.local/token-info/${nextTokenId}`);
115 });114 });
115
116 //TODO: CORE-302 add eth methods
116 itWeb3('Can perform mintBulk()', async ({web3, api}) => {117 itWeb3.skip('Can perform mintBulk()', async ({web3, api}) => {
117 const collection = await createCollectionExpectSuccess({118 const collection = await createCollectionExpectSuccess({
118 mode: {type: 'NFT'},119 mode: {type: 'NFT'},
119 });120 });
540 });541 });
541});542});
542543
544describe('Common metadata', () => {
545 itWeb3('Returns collection name', async ({api, web3}) => {
546 const collection = await createCollectionExpectSuccess({
547 name: 'token name',
548 mode: {type: 'NFT'},
549 });
550 const caller = await createEthAccountWithBalance(api, web3);
551
552 const address = collectionIdToAddress(collection);
553 const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS});
554 const name = await contract.methods.name().call();
555
556 expect(name).to.equal('token name');
557 });
558
559 itWeb3('Returns symbol name', async ({api, web3}) => {
560 const collection = await createCollectionExpectSuccess({
561 tokenPrefix: 'TOK',
562 mode: {type: 'NFT'},
563 });
564 const caller = await createEthAccountWithBalance(api, web3);
565
566 const address = collectionIdToAddress(collection);
567 const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS});
568 const symbol = await contract.methods.symbol().call();
569
570 expect(symbol).to.equal('TOK');
571 });
572});
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
167 "stateMutability": "view",125 "stateMutability": "view",
168 "type": "function"126 "type": "function"
169 },127 },
128 {
129 "inputs": [],
130 "name": "contractAddress",
131 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
132 "stateMutability": "view",
133 "type": "function"
134 },
170 {135 {
171 "inputs": [136 "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
172 {
198 "stateMutability": "nonpayable",149 "stateMutability": "nonpayable",
199 "type": "function"150 "type": "function"
200 },151 },
152 {
153 "inputs": [],
154 "name": "ethConfirmSponsorship",
155 "outputs": [],
156 "stateMutability": "nonpayable",
157 "type": "function"
158 },
159 {
160 "inputs": [
161 { "internalType": "address", "name": "sponsor", "type": "address" }
162 ],
163 "name": "ethSetSponsor",
164 "outputs": [],
165 "stateMutability": "nonpayable",
166 "type": "function"
167 },
201 {168 {
202 "inputs": [],169 "inputs": [],
203 "name": "finishMinting",170 "name": "finishMinting",
536 "stateMutability": "nonpayable",323 "stateMutability": "nonpayable",
537 "type": "function"324 "type": "function"
538 },325 },
326 {
327 "inputs": [
328 { "internalType": "string", "name": "limit", "type": "string" },
329 { "internalType": "string", "name": "value", "type": "string" }
330 ],
331 "name": "setLimit",
332 "outputs": [],
333 "stateMutability": "nonpayable",
334 "type": "function"
335 },
539 {336 {
540 "inputs": [337 "inputs": [
541 {338 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
modifiedtests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth
88});88});
8989
90describe('NFT (Via EVM proxy): Plain calls', () => {90describe('NFT (Via EVM proxy): Plain calls', () => {
91 //TODO: CORE-302 add eth methods
91 itWeb3('Can perform mint()', async ({web3, api}) => {92 itWeb3.skip('Can perform mint()', async ({web3, api}) => {
92 const collection = await createCollectionExpectSuccess({93 const collection = await createCollectionExpectSuccess({
93 mode: {type: 'NFT'},94 mode: {type: 'NFT'},
94 });95 });
128 }129 }
129 });130 });
131
132 //TODO: CORE-302 add eth methods
130 itWeb3('Can perform mintBulk()', async ({web3, api}) => {133 itWeb3.skip('Can perform mintBulk()', async ({web3, api}) => {
131 const collection = await createCollectionExpectSuccess({134 const collection = await createCollectionExpectSuccess({
132 mode: {type: 'NFT'},135 mode: {type: 'NFT'},
133 });136 });
modifiedtests/src/eth/util/contractHelpersAbi.jsondiffbeforeafterboth
3 "inputs": [3 "inputs": [
4 {4 {
5 "internalType": "address",5 "internalType": "address",
6 "name": "contract",6 "name": "contractAddress",
7 "type": "address"7 "type": "address"
8 }8 },
9 { "internalType": "address", "name": "user", "type": "address" }
9 ],10 ],
10 "name": "allowlistEnabled",11 "name": "allowed",
11 "outputs": [12 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
12 {
13 "internalType": "bool",
22 "inputs": [17 "inputs": [
23 {18 {
24 "internalType": "address",19 "internalType": "address",
25 "name": "target",20 "name": "contractAddress",
26 "type": "address"21 "type": "address"
27 },22 }
28 {
29 "internalType": "address",
30 "name": "caller",
31 "type": "address"
32 }
33 ],23 ],
34 "name": "allowed",24 "name": "allowlistEnabled",
35 "outputs": [25 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
36 {
37 "internalType": "bool",
46 "inputs": [30 "inputs": [
47 {31 {
48 "internalType": "address",32 "internalType": "address",
49 "name": "target",33 "name": "contractAddress",
50 "type": "address"34 "type": "address"
51 }35 }
52 ],36 ],
65 "inputs": [43 "inputs": [
66 {44 {
67 "internalType": "address",45 "internalType": "address",
68 "name": "target",46 "name": "contractAddress",
69 "type": "address"47 "type": "address"
70 }48 }
71 ],49 ],
72 "name": "sponsoringEnabled",50 "name": "getSponsoringRateLimit",
73 "outputs": [51 "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }],
74 {
75 "internalType": "bool",
76 "name": "",
77 "type": "bool"
78 }
79 ],
80 "stateMutability": "view",52 "stateMutability": "view",
84 "inputs": [56 "inputs": [
85 {57 {
86 "internalType": "address",58 "internalType": "address",
87 "name": "target",59 "name": "contractAddress",
88 "type": "address"60 "type": "address"
89 },61 },
90 {
91 "internalType": "address",
92 "name": "user",
93 "type": "address"
94 },
95 {62 { "internalType": "uint8", "name": "mode", "type": "uint8" }
96 "internalType": "bool",
97 "name": "isAllowed",
98 "type": "bool"
99 }
100 ],63 ],
101 "name": "toggleAllowed",64 "name": "setSponsoringMode",
102 "outputs": [],65 "outputs": [],
103 "stateMutability": "nonpayable",66 "stateMutability": "nonpayable",
104 "type": "function"67 "type": "function"
107 "inputs": [70 "inputs": [
108 {71 {
109 "internalType": "address",72 "internalType": "address",
110 "name": "target",73 "name": "contractAddress",
111 "type": "address"74 "type": "address"
112 },75 },
113 {76 { "internalType": "uint32", "name": "rateLimit", "type": "uint32" }
114 "internalType": "bool",
115 "name": "enabled",
116 "type": "bool"
117 }
118 ],77 ],
119 "name": "toggleAllowlist",78 "name": "setSponsoringRateLimit",
120 "outputs": [],79 "outputs": [],
121 "stateMutability": "nonpayable",80 "stateMutability": "nonpayable",
122 "type": "function"81 "type": "function"
125 "inputs": [84 "inputs": [
126 {85 {
127 "internalType": "address",86 "internalType": "address",
128 "name": "target",87 "name": "contractAddress",
129 "type": "address"88 "type": "address"
130 },89 }
131 {
132 "internalType": "bool",
133 "name": "enabled",
134 "type": "bool"
135 }
136 ],90 ],
137 "name": "toggleSponsoring",91 "name": "sponsoringEnabled",
138 "outputs": [],92 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
139 "stateMutability": "nonpayable",93 "stateMutability": "view",
140 "type": "function"94 "type": "function"
141 },95 },
142 {96 {
143 "inputs": [97 "inputs": [
144 {98 {
145 "internalType": "address",99 "internalType": "address",
146 "name": "target",100 "name": "contractAddress",
147 "type": "address"101 "type": "address"
148 },102 }
149 {
150 "internalType": "uint8",
151 "name": "mode",
152 "type": "uint8"
153 }
154 ],103 ],
155 "name": "setSponsoringMode",104 "name": "sponsoringMode",
156 "outputs": [],105 "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
157 "stateMutability": "nonpayable",106 "stateMutability": "view",
158 "type": "function"107 "type": "function"
159 },108 },
160 {109 {
161 "inputs": [110 "inputs": [
162 {111 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
163 "internalType": "address",
164 "name": "target",
165 "type": "address"
166 }
167 ],112 ],
168 "name": "sponsoringMode",113 "name": "supportsInterface",
169 "outputs": [114 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
170 {
171 "internalType": "uint8",
172 "name": "",
173 "type": "uint8"
174 }
175 ],
176 "stateMutability": "nonpayable",115 "stateMutability": "view",
177 "type": "function"116 "type": "function"
178 },117 },
179 {118 {
180 "inputs": [119 "inputs": [
120 {
121 "internalType": "address",
122 "name": "contractAddress",
123 "type": "address"
124 },
181 {125 { "internalType": "address", "name": "user", "type": "address" },
182 "internalType": "address",
183 "name": "target",
184 "type": "address"
185 },
186 {126 { "internalType": "bool", "name": "allowed", "type": "bool" }
187 "internalType": "uint32",
188 "name": "limit",
189 "type": "uint32"
190 }
191 ],127 ],
192 "name": "setSponsoringRateLimit",128 "name": "toggleAllowed",
193 "outputs": [],129 "outputs": [],
194 "stateMutability": "nonpayable",130 "stateMutability": "nonpayable",
195 "type": "function"131 "type": "function"
196 },132 },
197 {133 {
198 "inputs": [134 "inputs": [
199 {135 {
200 "internalType": "address",136 "internalType": "address",
201 "name": "contractAddress",137 "name": "contractAddress",
202 "type": "address"138 "type": "address"
203 }139 },
140 { "internalType": "bool", "name": "enabled", "type": "bool" }
204 ],141 ],
205 "name": "getSponsoringRateLimit",142 "name": "toggleAllowlist",
206 "outputs": [143 "outputs": [],
144 "stateMutability": "nonpayable",
145 "type": "function"
146 },
147 {
148 "inputs": [
149 {
150 "internalType": "address",
151 "name": "contractAddress",
152 "type": "address"
153 },
207 {154 { "internalType": "bool", "name": "enabled", "type": "bool" }
208 "internalType": "uint32",
209 "name": "",
210 "type": "uint32"
211 }
212 ],155 ],
156 "name": "toggleSponsoring",
157 "outputs": [],
213 "stateMutability": "view",158 "stateMutability": "nonpayable",
214 "type": "function"159 "type": "function"
215 }160 }
216]161]
217162
modifiedtests/src/eth/util/helpers.tsdiffbeforeafterboth
23import usingApi, {submitTransactionAsync} from '../../substrate/substrate-api';23import usingApi, {submitTransactionAsync} from '../../substrate/substrate-api';
24import {IKeyringPair} from '@polkadot/types/types';24import {IKeyringPair} from '@polkadot/types/types';
25import {expect} from 'chai';25import {expect} from 'chai';
26import {CrossAccountId, getGenericResult, UNIQUE} from '../../util/helpers';26import {CrossAccountId, getDetailedCollectionInfo, getGenericResult, UNIQUE} from '../../util/helpers';
27import * as solc from 'solc';27import * as solc from 'solc';
28import config from '../../config';28import config from '../../config';
29import privateKey from '../../substrate/privateKey';29import privateKey from '../../substrate/privateKey';
30import contractHelpersAbi from './contractHelpersAbi.json';30import contractHelpersAbi from './contractHelpersAbi.json';
31import nonFungibleAbi from '../nonFungibleAbi.json';
32import collectionHelperAbi from '../collectionHelperAbi.json';
31import getBalance from '../../substrate/get-balance';33import getBalance from '../../substrate/get-balance';
32import waitNewBlocks from '../../substrate/wait-new-blocks';34import waitNewBlocks from '../../substrate/wait-new-blocks';
3335
66 ];68 ];
67}69}
70
71export async function getCollectionAddressFromResult(api: ApiPromise, result: any) {
72 const collectionIdAddress = normalizeAddress(result.events[0].raw.topics[2]);
73 const collectionId = collectionIdFromAddress(collectionIdAddress);
74 const collection = (await getDetailedCollectionInfo(api, collectionId))!;
75 return {collectionIdAddress, collectionId, collection};
76}
6877
69export function collectionIdToAddress(collection: number): string {78export function collectionIdToAddress(collection: number): string {
70 const buf = Buffer.from([0x17, 0xc4, 0xe6, 0x45, 0x3c, 0xc4, 0x9a, 0xaa, 0xae, 0xac, 0xa8, 0x94, 0xe6, 0xd9, 0x68, 0x3e,79 const buf = Buffer.from([0x17, 0xc4, 0xe6, 0x45, 0x3c, 0xc4, 0x9a, 0xaa, 0xae, 0xac, 0xa8, 0x94, 0xe6, 0xd9, 0x68, 0x3e,
71 ...encodeIntBE(collection),80 ...encodeIntBE(collection),
72 ]);81 ]);
73 return Web3.utils.toChecksumAddress('0x' + buf.toString('hex'));82 return Web3.utils.toChecksumAddress('0x' + buf.toString('hex'));
74}83}
84export function collectionIdFromAddress(address: string): number {
85 if (!address.startsWith('0x'))
86 throw 'address not starts with "0x"';
87 if (address.length > 42)
88 throw 'address length is more than 20 bytes';
89 return Number('0x' + address.substring(address.length - 8));
90}
91
92export function normalizeAddress(address: string): string {
93 return '0x' + address.substring(address.length - 40);
94}
7595
76export function tokenIdToAddress(collection: number, token: number): string {96export function tokenIdToAddress(collection: number, token: number): string {
77 const buf = Buffer.from([0xf8, 0x23, 0x8c, 0xcf, 0xff, 0x8e, 0xd8, 0x87, 0x46, 0x3f, 0xd5, 0xe0,97 const buf = Buffer.from([0xf8, 0x23, 0x8c, 0xcf, 0xff, 0x8e, 0xd8, 0x87, 0x46, 0x3f, 0xd5, 0xe0,
271 return new web3.eth.Contract(contractHelpersAbi as any, '0x842899ECF380553E8a4de75bF534cdf6fBF64049', {from: caller, ...GAS_ARGS});291 return new web3.eth.Contract(contractHelpersAbi as any, '0x842899ECF380553E8a4de75bF534cdf6fBF64049', {from: caller, ...GAS_ARGS});
272}292}
293
294/**
295 * evm collection helper
296 * @param web3
297 * @param caller - eth address
298 * @returns
299 */
300export function evmCollectionHelper(web3: Web3, caller: string) {
301 return new web3.eth.Contract(collectionHelperAbi as any, '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f', {from: caller, ...GAS_ARGS});
302}
303
304/**
305 * evm collection
306 * @param web3
307 * @param caller - eth address
308 * @returns
309 */
310export function evmCollection(web3: Web3, caller: string, collection: string) {
311 return new web3.eth.Contract(nonFungibleAbi as any, collection, {from: caller, ...GAS_ARGS});
312}
273313
274/**314/**
275 * Execute ethereum method call using substrate account315 * Execute ethereum method call using substrate account
modifiedtests/src/interfaces/augment-types.tsdiffbeforeafterboth
1// Auto-generated via `yarn polkadot-types-from-defs`, do not edit1// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
2/* eslint-disable */2/* eslint-disable */
33
4import type { CumulusPalletDmpQueueCall, CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueueError, CumulusPalletDmpQueueEvent, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemCall, CumulusPalletParachainSystemError, CumulusPalletParachainSystemEvent, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmCall, CumulusPalletXcmError, CumulusPalletXcmEvent, CumulusPalletXcmpQueueCall, CumulusPalletXcmpQueueError, CumulusPalletXcmpQueueEvent, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueInboundState, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueOutboundState, CumulusPalletXcmpQueueQueueConfigData, CumulusPrimitivesParachainInherentParachainInherentData, EthbloomBloom, EthereumBlock, EthereumHeader, EthereumLog, EthereumReceiptEip658ReceiptData, EthereumReceiptReceiptV3, EthereumTransactionAccessListItem, EthereumTransactionEip1559Transaction, EthereumTransactionEip2930Transaction, EthereumTransactionLegacyTransaction, EthereumTransactionTransactionAction, EthereumTransactionTransactionSignature, EthereumTransactionTransactionV2, EthereumTypesHashH64, EvmCoreErrorExitError, EvmCoreErrorExitFatal, EvmCoreErrorExitReason, EvmCoreErrorExitRevert, EvmCoreErrorExitSucceed, FpRpcTransactionStatus, FrameSupportPalletId, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchClass, FrameSupportWeightsDispatchInfo, FrameSupportWeightsPays, FrameSupportWeightsPerDispatchClassU32, FrameSupportWeightsPerDispatchClassU64, FrameSupportWeightsPerDispatchClassWeightsPerClass, FrameSupportWeightsRuntimeDbWeight, FrameSupportWeightsWeightToFeeCoefficient, FrameSystemAccountInfo, FrameSystemCall, FrameSystemError, FrameSystemEvent, FrameSystemEventRecord, FrameSystemExtensionsCheckGenesis, FrameSystemExtensionsCheckNonce, FrameSystemExtensionsCheckSpecVersion, FrameSystemExtensionsCheckWeight, FrameSystemLastRuntimeUpgradeInfo, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, FrameSystemLimitsWeightsPerClass, FrameSystemPhase, OpalRuntimeRuntime, OrmlVestingModuleCall, OrmlVestingModuleError, OrmlVestingModuleEvent, OrmlVestingVestingSchedule, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesCall, PalletBalancesError, PalletBalancesEvent, PalletBalancesReasons, PalletBalancesReleases, PalletBalancesReserveData, PalletCommonError, PalletCommonEvent, PalletEthereumCall, PalletEthereumError, PalletEthereumEvent, PalletEthereumFakeTransactionFinalizer, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmCall, PalletEvmCoderSubstrateError, PalletEvmContractHelpersError, PalletEvmContractHelpersSponsoringModeT, PalletEvmError, PalletEvmEvent, PalletEvmMigrationCall, PalletEvmMigrationError, PalletFungibleError, PalletInflationCall, PalletNonfungibleError, PalletNonfungibleItemData, PalletRefungibleError, PalletRefungibleItemData, PalletRmrkCoreCall, PalletRmrkCoreError, PalletRmrkCoreEvent, PalletRmrkEquipCall, PalletRmrkEquipError, PalletRmrkEquipEvent, PalletStructureCall, PalletStructureError, PalletStructureEvent, PalletSudoCall, PalletSudoError, PalletSudoEvent, PalletTemplateTransactionPaymentCall, PalletTemplateTransactionPaymentChargeTransactionPayment, PalletTimestampCall, PalletTransactionPaymentReleases, PalletTreasuryCall, PalletTreasuryError, PalletTreasuryEvent, PalletTreasuryProposal, PalletUniqueCall, PalletUniqueError, PalletUniqueRawEvent, PalletXcmCall, PalletXcmError, PalletXcmEvent, PhantomTypeUpDataStructsBaseInfo, PhantomTypeUpDataStructsCollectionInfo, PhantomTypeUpDataStructsNftChild, PhantomTypeUpDataStructsNftInfo, PhantomTypeUpDataStructsPartType, PhantomTypeUpDataStructsPropertyInfo, PhantomTypeUpDataStructsResourceInfo, PhantomTypeUpDataStructsRpcCollection, PhantomTypeUpDataStructsTheme, PhantomTypeUpDataStructsTokenData, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2AbridgedHrmpChannel, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, SpCoreEcdsaSignature, SpCoreEd25519Signature, SpCoreSr25519Signature, SpRuntimeArithmeticError, SpRuntimeDigest, SpRuntimeDigestDigestItem, SpRuntimeDispatchError, SpRuntimeModuleError, SpRuntimeMultiSignature, SpRuntimeTokenError, SpRuntimeTransactionalError, SpTrieStorageProof, SpVersionRuntimeVersion, UpDataStructsAccessMode, UpDataStructsCollection, UpDataStructsCollectionField, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCollectionStats, UpDataStructsCreateCollectionData, UpDataStructsCreateFungibleData, UpDataStructsCreateItemData, UpDataStructsCreateItemExData, UpDataStructsCreateNftData, UpDataStructsCreateNftExData, UpDataStructsCreateReFungibleData, UpDataStructsCreateRefungibleExData, UpDataStructsNestingRule, UpDataStructsProperties, UpDataStructsPropertiesMapBoundedVec, UpDataStructsPropertiesMapPropertyPermission, UpDataStructsProperty, UpDataStructsPropertyKeyPermission, UpDataStructsPropertyPermission, UpDataStructsRmrkAccountIdOrCollectionNftTuple, UpDataStructsRmrkBaseInfo, UpDataStructsRmrkBasicResource, UpDataStructsRmrkCollectionInfo, UpDataStructsRmrkComposableResource, UpDataStructsRmrkEquippableList, UpDataStructsRmrkFixedPart, UpDataStructsRmrkNftChild, UpDataStructsRmrkNftInfo, UpDataStructsRmrkPartType, UpDataStructsRmrkPropertyInfo, UpDataStructsRmrkResourceInfo, UpDataStructsRmrkResourceTypes, UpDataStructsRmrkRoyaltyInfo, UpDataStructsRmrkSlotPart, UpDataStructsRmrkSlotResource, UpDataStructsRmrkTheme, UpDataStructsRmrkThemeProperty, UpDataStructsRpcCollection, UpDataStructsSchemaVersion, UpDataStructsSponsoringRateLimit, UpDataStructsSponsorshipState, UpDataStructsTokenData, XcmDoubleEncoded, XcmV0Junction, XcmV0JunctionBodyId, XcmV0JunctionBodyPart, XcmV0JunctionNetworkId, XcmV0MultiAsset, XcmV0MultiLocation, XcmV0Order, XcmV0OriginKind, XcmV0Response, XcmV0Xcm, XcmV1Junction, XcmV1MultiAsset, XcmV1MultiLocation, XcmV1MultiassetAssetId, XcmV1MultiassetAssetInstance, XcmV1MultiassetFungibility, XcmV1MultiassetMultiAssetFilter, XcmV1MultiassetMultiAssets, XcmV1MultiassetWildFungibility, XcmV1MultiassetWildMultiAsset, XcmV1MultilocationJunctions, XcmV1Order, XcmV1Response, XcmV1Xcm, XcmV2Instruction, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2WeightLimit, XcmV2Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from './unique';
5import type { Data, StorageKey } from '@polkadot/types';4import type { Data, StorageKey } from '@polkadot/types';
6import type { BitVec, Bool, Bytes, I128, I16, I256, I32, I64, I8, Json, Null, Raw, Text, Type, U128, U16, U256, U32, U64, U8, USize, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types-codec';5import type { BitVec, Bool, Bytes, I128, I16, I256, I32, I64, I8, Json, Null, Raw, Text, Type, U128, U16, U256, U32, U64, U8, USize, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types-codec';
7import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDestroyWitness, AssetDetails, AssetMetadata, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets';6import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDestroyWitness, AssetDetails, AssetMetadata, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets';
291 CoreOccupied: CoreOccupied;290 CoreOccupied: CoreOccupied;
292 CrateVersion: CrateVersion;291 CrateVersion: CrateVersion;
293 CreatedBlock: CreatedBlock;292 CreatedBlock: CreatedBlock;
294 CumulusPalletDmpQueueCall: CumulusPalletDmpQueueCall;
295 CumulusPalletDmpQueueConfigData: CumulusPalletDmpQueueConfigData;
296 CumulusPalletDmpQueueError: CumulusPalletDmpQueueError;
297 CumulusPalletDmpQueueEvent: CumulusPalletDmpQueueEvent;
298 CumulusPalletDmpQueuePageIndexData: CumulusPalletDmpQueuePageIndexData;
299 CumulusPalletParachainSystemCall: CumulusPalletParachainSystemCall;
300 CumulusPalletParachainSystemError: CumulusPalletParachainSystemError;
301 CumulusPalletParachainSystemEvent: CumulusPalletParachainSystemEvent;
302 CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot: CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot;
303 CumulusPalletXcmCall: CumulusPalletXcmCall;
304 CumulusPalletXcmError: CumulusPalletXcmError;
305 CumulusPalletXcmEvent: CumulusPalletXcmEvent;
306 CumulusPalletXcmpQueueCall: CumulusPalletXcmpQueueCall;
307 CumulusPalletXcmpQueueError: CumulusPalletXcmpQueueError;
308 CumulusPalletXcmpQueueEvent: CumulusPalletXcmpQueueEvent;
309 CumulusPalletXcmpQueueInboundChannelDetails: CumulusPalletXcmpQueueInboundChannelDetails;
310 CumulusPalletXcmpQueueInboundState: CumulusPalletXcmpQueueInboundState;
311 CumulusPalletXcmpQueueOutboundChannelDetails: CumulusPalletXcmpQueueOutboundChannelDetails;
312 CumulusPalletXcmpQueueOutboundState: CumulusPalletXcmpQueueOutboundState;
313 CumulusPalletXcmpQueueQueueConfigData: CumulusPalletXcmpQueueQueueConfigData;
314 CumulusPrimitivesParachainInherentParachainInherentData: CumulusPrimitivesParachainInherentParachainInherentData;
315 Data: Data;293 Data: Data;
316 DeferredOffenceOf: DeferredOffenceOf;294 DeferredOffenceOf: DeferredOffenceOf;
317 DefunctVoter: DefunctVoter;295 DefunctVoter: DefunctVoter;
378 EthAddress: EthAddress;356 EthAddress: EthAddress;
379 EthBlock: EthBlock;357 EthBlock: EthBlock;
380 EthBloom: EthBloom;358 EthBloom: EthBloom;
381 EthbloomBloom: EthbloomBloom;
382 EthCallRequest: EthCallRequest;359 EthCallRequest: EthCallRequest;
383 EthereumAccountId: EthereumAccountId;360 EthereumAccountId: EthereumAccountId;
384 EthereumAddress: EthereumAddress;361 EthereumAddress: EthereumAddress;
385 EthereumBlock: EthereumBlock;
386 EthereumHeader: EthereumHeader;
387 EthereumLog: EthereumLog;
388 EthereumLookupSource: EthereumLookupSource;362 EthereumLookupSource: EthereumLookupSource;
389 EthereumReceiptEip658ReceiptData: EthereumReceiptEip658ReceiptData;
390 EthereumReceiptReceiptV3: EthereumReceiptReceiptV3;
391 EthereumSignature: EthereumSignature;363 EthereumSignature: EthereumSignature;
392 EthereumTransactionAccessListItem: EthereumTransactionAccessListItem;
393 EthereumTransactionEip1559Transaction: EthereumTransactionEip1559Transaction;
394 EthereumTransactionEip2930Transaction: EthereumTransactionEip2930Transaction;
395 EthereumTransactionLegacyTransaction: EthereumTransactionLegacyTransaction;
396 EthereumTransactionTransactionAction: EthereumTransactionTransactionAction;
397 EthereumTransactionTransactionSignature: EthereumTransactionTransactionSignature;
398 EthereumTransactionTransactionV2: EthereumTransactionTransactionV2;
399 EthereumTypesHashH64: EthereumTypesHashH64;
400 EthFilter: EthFilter;364 EthFilter: EthFilter;
401 EthFilterAddress: EthFilterAddress;365 EthFilterAddress: EthFilterAddress;
402 EthFilterChanges: EthFilterChanges;366 EthFilterChanges: EthFilterChanges;
433 EventMetadataV9: EventMetadataV9;397 EventMetadataV9: EventMetadataV9;
434 EventRecord: EventRecord;398 EventRecord: EventRecord;
435 EvmAccount: EvmAccount;399 EvmAccount: EvmAccount;
436 EvmCoreErrorExitError: EvmCoreErrorExitError;
437 EvmCoreErrorExitFatal: EvmCoreErrorExitFatal;
438 EvmCoreErrorExitReason: EvmCoreErrorExitReason;
439 EvmCoreErrorExitRevert: EvmCoreErrorExitRevert;
440 EvmCoreErrorExitSucceed: EvmCoreErrorExitSucceed;
441 EvmLog: EvmLog;400 EvmLog: EvmLog;
442 EvmVicinity: EvmVicinity;401 EvmVicinity: EvmVicinity;
443 ExecReturnValue: ExecReturnValue;402 ExecReturnValue: ExecReturnValue;
476 Forcing: Forcing;435 Forcing: Forcing;
477 ForkTreePendingChange: ForkTreePendingChange;436 ForkTreePendingChange: ForkTreePendingChange;
478 ForkTreePendingChangeNode: ForkTreePendingChangeNode;437 ForkTreePendingChangeNode: ForkTreePendingChangeNode;
479 FpRpcTransactionStatus: FpRpcTransactionStatus;
480 FrameSupportPalletId: FrameSupportPalletId;
481 FrameSupportTokensMiscBalanceStatus: FrameSupportTokensMiscBalanceStatus;
482 FrameSupportWeightsDispatchClass: FrameSupportWeightsDispatchClass;
483 FrameSupportWeightsDispatchInfo: FrameSupportWeightsDispatchInfo;
484 FrameSupportWeightsPays: FrameSupportWeightsPays;
485 FrameSupportWeightsPerDispatchClassU32: FrameSupportWeightsPerDispatchClassU32;
486 FrameSupportWeightsPerDispatchClassU64: FrameSupportWeightsPerDispatchClassU64;
487 FrameSupportWeightsPerDispatchClassWeightsPerClass: FrameSupportWeightsPerDispatchClassWeightsPerClass;
488 FrameSupportWeightsRuntimeDbWeight: FrameSupportWeightsRuntimeDbWeight;
489 FrameSupportWeightsWeightToFeeCoefficient: FrameSupportWeightsWeightToFeeCoefficient;
490 FrameSystemAccountInfo: FrameSystemAccountInfo;
491 FrameSystemCall: FrameSystemCall;
492 FrameSystemError: FrameSystemError;
493 FrameSystemEvent: FrameSystemEvent;
494 FrameSystemEventRecord: FrameSystemEventRecord;
495 FrameSystemExtensionsCheckGenesis: FrameSystemExtensionsCheckGenesis;
496 FrameSystemExtensionsCheckNonce: FrameSystemExtensionsCheckNonce;
497 FrameSystemExtensionsCheckSpecVersion: FrameSystemExtensionsCheckSpecVersion;
498 FrameSystemExtensionsCheckWeight: FrameSystemExtensionsCheckWeight;
499 FrameSystemLastRuntimeUpgradeInfo: FrameSystemLastRuntimeUpgradeInfo;
500 FrameSystemLimitsBlockLength: FrameSystemLimitsBlockLength;
501 FrameSystemLimitsBlockWeights: FrameSystemLimitsBlockWeights;
502 FrameSystemLimitsWeightsPerClass: FrameSystemLimitsWeightsPerClass;
503 FrameSystemPhase: FrameSystemPhase;
504 FullIdentification: FullIdentification;438 FullIdentification: FullIdentification;
505 FunctionArgumentMetadataLatest: FunctionArgumentMetadataLatest;439 FunctionArgumentMetadataLatest: FunctionArgumentMetadataLatest;
506 FunctionArgumentMetadataV10: FunctionArgumentMetadataV10;440 FunctionArgumentMetadataV10: FunctionArgumentMetadataV10;
716 OffchainAccuracyCompact: OffchainAccuracyCompact;650 OffchainAccuracyCompact: OffchainAccuracyCompact;
717 OffenceDetails: OffenceDetails;651 OffenceDetails: OffenceDetails;
718 Offender: Offender;652 Offender: Offender;
719 OpalRuntimeRuntime: OpalRuntimeRuntime;
720 OpaqueCall: OpaqueCall;653 OpaqueCall: OpaqueCall;
721 OpaqueMultiaddr: OpaqueMultiaddr;654 OpaqueMultiaddr: OpaqueMultiaddr;
722 OpaqueNetworkState: OpaqueNetworkState;655 OpaqueNetworkState: OpaqueNetworkState;
732 OriginKindV0: OriginKindV0;665 OriginKindV0: OriginKindV0;
733 OriginKindV1: OriginKindV1;666 OriginKindV1: OriginKindV1;
734 OriginKindV2: OriginKindV2;667 OriginKindV2: OriginKindV2;
735 OrmlVestingModuleCall: OrmlVestingModuleCall;
736 OrmlVestingModuleError: OrmlVestingModuleError;
737 OrmlVestingModuleEvent: OrmlVestingModuleEvent;
738 OrmlVestingVestingSchedule: OrmlVestingVestingSchedule;
739 OutboundHrmpMessage: OutboundHrmpMessage;668 OutboundHrmpMessage: OutboundHrmpMessage;
740 OutboundLaneData: OutboundLaneData;669 OutboundLaneData: OutboundLaneData;
741 OutboundMessageFee: OutboundMessageFee;670 OutboundMessageFee: OutboundMessageFee;
746 Owner: Owner;675 Owner: Owner;
747 PageCounter: PageCounter;676 PageCounter: PageCounter;
748 PageIndexData: PageIndexData;677 PageIndexData: PageIndexData;
749 PalletBalancesAccountData: PalletBalancesAccountData;
750 PalletBalancesBalanceLock: PalletBalancesBalanceLock;
751 PalletBalancesCall: PalletBalancesCall;
752 PalletBalancesError: PalletBalancesError;
753 PalletBalancesEvent: PalletBalancesEvent;
754 PalletBalancesReasons: PalletBalancesReasons;
755 PalletBalancesReleases: PalletBalancesReleases;
756 PalletBalancesReserveData: PalletBalancesReserveData;
757 PalletCallMetadataLatest: PalletCallMetadataLatest;678 PalletCallMetadataLatest: PalletCallMetadataLatest;
758 PalletCallMetadataV14: PalletCallMetadataV14;679 PalletCallMetadataV14: PalletCallMetadataV14;
759 PalletCommonError: PalletCommonError;
760 PalletCommonEvent: PalletCommonEvent;
761 PalletConstantMetadataLatest: PalletConstantMetadataLatest;680 PalletConstantMetadataLatest: PalletConstantMetadataLatest;
762 PalletConstantMetadataV14: PalletConstantMetadataV14;681 PalletConstantMetadataV14: PalletConstantMetadataV14;
763 PalletErrorMetadataLatest: PalletErrorMetadataLatest;682 PalletErrorMetadataLatest: PalletErrorMetadataLatest;
764 PalletErrorMetadataV14: PalletErrorMetadataV14;683 PalletErrorMetadataV14: PalletErrorMetadataV14;
765 PalletEthereumCall: PalletEthereumCall;
766 PalletEthereumError: PalletEthereumError;
767 PalletEthereumEvent: PalletEthereumEvent;
768 PalletEthereumFakeTransactionFinalizer: PalletEthereumFakeTransactionFinalizer;
769 PalletEventMetadataLatest: PalletEventMetadataLatest;684 PalletEventMetadataLatest: PalletEventMetadataLatest;
770 PalletEventMetadataV14: PalletEventMetadataV14;685 PalletEventMetadataV14: PalletEventMetadataV14;
771 PalletEvmAccountBasicCrossAccountIdRepr: PalletEvmAccountBasicCrossAccountIdRepr;
772 PalletEvmCall: PalletEvmCall;
773 PalletEvmCoderSubstrateError: PalletEvmCoderSubstrateError;
774 PalletEvmContractHelpersError: PalletEvmContractHelpersError;
775 PalletEvmContractHelpersSponsoringModeT: PalletEvmContractHelpersSponsoringModeT;
776 PalletEvmError: PalletEvmError;
777 PalletEvmEvent: PalletEvmEvent;
778 PalletEvmMigrationCall: PalletEvmMigrationCall;
779 PalletEvmMigrationError: PalletEvmMigrationError;
780 PalletFungibleError: PalletFungibleError;
781 PalletId: PalletId;686 PalletId: PalletId;
782 PalletInflationCall: PalletInflationCall;
783 PalletMetadataLatest: PalletMetadataLatest;687 PalletMetadataLatest: PalletMetadataLatest;
784 PalletMetadataV14: PalletMetadataV14;688 PalletMetadataV14: PalletMetadataV14;
785 PalletNonfungibleError: PalletNonfungibleError;
786 PalletNonfungibleItemData: PalletNonfungibleItemData;
787 PalletRefungibleError: PalletRefungibleError;
788 PalletRefungibleItemData: PalletRefungibleItemData;
789 PalletRmrkCoreCall: PalletRmrkCoreCall;
790 PalletRmrkCoreError: PalletRmrkCoreError;
791 PalletRmrkCoreEvent: PalletRmrkCoreEvent;
792 PalletRmrkEquipCall: PalletRmrkEquipCall;
793 PalletRmrkEquipError: PalletRmrkEquipError;
794 PalletRmrkEquipEvent: PalletRmrkEquipEvent;
795 PalletsOrigin: PalletsOrigin;689 PalletsOrigin: PalletsOrigin;
796 PalletStorageMetadataLatest: PalletStorageMetadataLatest;690 PalletStorageMetadataLatest: PalletStorageMetadataLatest;
797 PalletStorageMetadataV14: PalletStorageMetadataV14;691 PalletStorageMetadataV14: PalletStorageMetadataV14;
798 PalletStructureCall: PalletStructureCall;
799 PalletStructureError: PalletStructureError;
800 PalletStructureEvent: PalletStructureEvent;
801 PalletSudoCall: PalletSudoCall;
802 PalletSudoError: PalletSudoError;
803 PalletSudoEvent: PalletSudoEvent;
804 PalletTemplateTransactionPaymentCall: PalletTemplateTransactionPaymentCall;
805 PalletTemplateTransactionPaymentChargeTransactionPayment: PalletTemplateTransactionPaymentChargeTransactionPayment;
806 PalletTimestampCall: PalletTimestampCall;
807 PalletTransactionPaymentReleases: PalletTransactionPaymentReleases;
808 PalletTreasuryCall: PalletTreasuryCall;
809 PalletTreasuryError: PalletTreasuryError;
810 PalletTreasuryEvent: PalletTreasuryEvent;
811 PalletTreasuryProposal: PalletTreasuryProposal;
812 PalletUniqueCall: PalletUniqueCall;
813 PalletUniqueError: PalletUniqueError;
814 PalletUniqueRawEvent: PalletUniqueRawEvent;
815 PalletVersion: PalletVersion;692 PalletVersion: PalletVersion;
816 PalletXcmCall: PalletXcmCall;
817 PalletXcmError: PalletXcmError;
818 PalletXcmEvent: PalletXcmEvent;
819 ParachainDispatchOrigin: ParachainDispatchOrigin;693 ParachainDispatchOrigin: ParachainDispatchOrigin;
820 ParachainInherentData: ParachainInherentData;694 ParachainInherentData: ParachainInherentData;
821 ParachainProposal: ParachainProposal;695 ParachainProposal: ParachainProposal;
855 PerU16: PerU16;729 PerU16: PerU16;
856 Phantom: Phantom;730 Phantom: Phantom;
857 PhantomData: PhantomData;731 PhantomData: PhantomData;
858 PhantomTypeUpDataStructsBaseInfo: PhantomTypeUpDataStructsBaseInfo;
859 PhantomTypeUpDataStructsCollectionInfo: PhantomTypeUpDataStructsCollectionInfo;
860 PhantomTypeUpDataStructsNftChild: PhantomTypeUpDataStructsNftChild;
861 PhantomTypeUpDataStructsNftInfo: PhantomTypeUpDataStructsNftInfo;
862 PhantomTypeUpDataStructsPartType: PhantomTypeUpDataStructsPartType;
863 PhantomTypeUpDataStructsPropertyInfo: PhantomTypeUpDataStructsPropertyInfo;
864 PhantomTypeUpDataStructsResourceInfo: PhantomTypeUpDataStructsResourceInfo;
865 PhantomTypeUpDataStructsRpcCollection: PhantomTypeUpDataStructsRpcCollection;
866 PhantomTypeUpDataStructsTheme: PhantomTypeUpDataStructsTheme;
867 PhantomTypeUpDataStructsTokenData: PhantomTypeUpDataStructsTokenData;
868 Phase: Phase;732 Phase: Phase;
869 PhragmenScore: PhragmenScore;733 PhragmenScore: PhragmenScore;
870 Points: Points;734 Points: Points;
871 PolkadotCorePrimitivesInboundDownwardMessage: PolkadotCorePrimitivesInboundDownwardMessage;
872 PolkadotCorePrimitivesInboundHrmpMessage: PolkadotCorePrimitivesInboundHrmpMessage;
873 PolkadotCorePrimitivesOutboundHrmpMessage: PolkadotCorePrimitivesOutboundHrmpMessage;
874 PolkadotParachainPrimitivesXcmpMessageFormat: PolkadotParachainPrimitivesXcmpMessageFormat;
875 PolkadotPrimitivesV2AbridgedHostConfiguration: PolkadotPrimitivesV2AbridgedHostConfiguration;
876 PolkadotPrimitivesV2AbridgedHrmpChannel: PolkadotPrimitivesV2AbridgedHrmpChannel;
877 PolkadotPrimitivesV2PersistedValidationData: PolkadotPrimitivesV2PersistedValidationData;
878 PolkadotPrimitivesV2UpgradeRestriction: PolkadotPrimitivesV2UpgradeRestriction;
879 PortableType: PortableType;735 PortableType: PortableType;
880 PortableTypeV14: PortableTypeV14;736 PortableTypeV14: PortableTypeV14;
881 Precommits: Precommits;737 Precommits: Precommits;
1071 SolutionSupports: SolutionSupports;927 SolutionSupports: SolutionSupports;
1072 SpanIndex: SpanIndex;928 SpanIndex: SpanIndex;
1073 SpanRecord: SpanRecord;929 SpanRecord: SpanRecord;
1074 SpCoreEcdsaSignature: SpCoreEcdsaSignature;
1075 SpCoreEd25519Signature: SpCoreEd25519Signature;
1076 SpCoreSr25519Signature: SpCoreSr25519Signature;
1077 SpecVersion: SpecVersion;930 SpecVersion: SpecVersion;
1078 SpRuntimeArithmeticError: SpRuntimeArithmeticError;
1079 SpRuntimeDigest: SpRuntimeDigest;
1080 SpRuntimeDigestDigestItem: SpRuntimeDigestDigestItem;
1081 SpRuntimeDispatchError: SpRuntimeDispatchError;
1082 SpRuntimeModuleError: SpRuntimeModuleError;
1083 SpRuntimeMultiSignature: SpRuntimeMultiSignature;
1084 SpRuntimeTokenError: SpRuntimeTokenError;
1085 SpRuntimeTransactionalError: SpRuntimeTransactionalError;
1086 SpTrieStorageProof: SpTrieStorageProof;
1087 SpVersionRuntimeVersion: SpVersionRuntimeVersion;
1088 Sr25519Signature: Sr25519Signature;931 Sr25519Signature: Sr25519Signature;
1089 StakingLedger: StakingLedger;932 StakingLedger: StakingLedger;
1090 StakingLedgerTo223: StakingLedgerTo223;933 StakingLedgerTo223: StakingLedgerTo223;
1181 UnlockChunk: UnlockChunk;1024 UnlockChunk: UnlockChunk;
1182 UnrewardedRelayer: UnrewardedRelayer;1025 UnrewardedRelayer: UnrewardedRelayer;
1183 UnrewardedRelayersState: UnrewardedRelayersState;1026 UnrewardedRelayersState: UnrewardedRelayersState;
1184 UpDataStructsAccessMode: UpDataStructsAccessMode;
1185 UpDataStructsCollection: UpDataStructsCollection;
1186 UpDataStructsCollectionField: UpDataStructsCollectionField;
1187 UpDataStructsCollectionLimits: UpDataStructsCollectionLimits;
1188 UpDataStructsCollectionMode: UpDataStructsCollectionMode;
1189 UpDataStructsCollectionStats: UpDataStructsCollectionStats;
1190 UpDataStructsCreateCollectionData: UpDataStructsCreateCollectionData;
1191 UpDataStructsCreateFungibleData: UpDataStructsCreateFungibleData;
1192 UpDataStructsCreateItemData: UpDataStructsCreateItemData;
1193 UpDataStructsCreateItemExData: UpDataStructsCreateItemExData;
1194 UpDataStructsCreateNftData: UpDataStructsCreateNftData;
1195 UpDataStructsCreateNftExData: UpDataStructsCreateNftExData;
1196 UpDataStructsCreateReFungibleData: UpDataStructsCreateReFungibleData;
1197 UpDataStructsCreateRefungibleExData: UpDataStructsCreateRefungibleExData;
1198 UpDataStructsNestingRule: UpDataStructsNestingRule;
1199 UpDataStructsProperties: UpDataStructsProperties;
1200 UpDataStructsPropertiesMapBoundedVec: UpDataStructsPropertiesMapBoundedVec;
1201 UpDataStructsPropertiesMapPropertyPermission: UpDataStructsPropertiesMapPropertyPermission;
1202 UpDataStructsProperty: UpDataStructsProperty;
1203 UpDataStructsPropertyKeyPermission: UpDataStructsPropertyKeyPermission;
1204 UpDataStructsPropertyPermission: UpDataStructsPropertyPermission;
1205 UpDataStructsRmrkAccountIdOrCollectionNftTuple: UpDataStructsRmrkAccountIdOrCollectionNftTuple;
1206 UpDataStructsRmrkBaseInfo: UpDataStructsRmrkBaseInfo;
1207 UpDataStructsRmrkBasicResource: UpDataStructsRmrkBasicResource;
1208 UpDataStructsRmrkCollectionInfo: UpDataStructsRmrkCollectionInfo;
1209 UpDataStructsRmrkComposableResource: UpDataStructsRmrkComposableResource;
1210 UpDataStructsRmrkEquippableList: UpDataStructsRmrkEquippableList;
1211 UpDataStructsRmrkFixedPart: UpDataStructsRmrkFixedPart;
1212 UpDataStructsRmrkNftChild: UpDataStructsRmrkNftChild;
1213 UpDataStructsRmrkNftInfo: UpDataStructsRmrkNftInfo;
1214 UpDataStructsRmrkPartType: UpDataStructsRmrkPartType;
1215 UpDataStructsRmrkPropertyInfo: UpDataStructsRmrkPropertyInfo;
1216 UpDataStructsRmrkResourceInfo: UpDataStructsRmrkResourceInfo;
1217 UpDataStructsRmrkResourceTypes: UpDataStructsRmrkResourceTypes;
1218 UpDataStructsRmrkRoyaltyInfo: UpDataStructsRmrkRoyaltyInfo;
1219 UpDataStructsRmrkSlotPart: UpDataStructsRmrkSlotPart;
1220 UpDataStructsRmrkSlotResource: UpDataStructsRmrkSlotResource;
1221 UpDataStructsRmrkTheme: UpDataStructsRmrkTheme;
1222 UpDataStructsRmrkThemeProperty: UpDataStructsRmrkThemeProperty;
1223 UpDataStructsRpcCollection: UpDataStructsRpcCollection;
1224 UpDataStructsSchemaVersion: UpDataStructsSchemaVersion;
1225 UpDataStructsSponsoringRateLimit: UpDataStructsSponsoringRateLimit;
1226 UpDataStructsSponsorshipState: UpDataStructsSponsorshipState;
1227 UpDataStructsTokenData: UpDataStructsTokenData;
1228 UpgradeGoAhead: UpgradeGoAhead;1027 UpgradeGoAhead: UpgradeGoAhead;
1229 UpgradeRestriction: UpgradeRestriction;1028 UpgradeRestriction: UpgradeRestriction;
1230 UpwardMessage: UpwardMessage;1029 UpwardMessage: UpwardMessage;
1296 WithdrawReasons: WithdrawReasons;1095 WithdrawReasons: WithdrawReasons;
1297 Xcm: Xcm;1096 Xcm: Xcm;
1298 XcmAssetId: XcmAssetId;1097 XcmAssetId: XcmAssetId;
1299 XcmDoubleEncoded: XcmDoubleEncoded;
1300 XcmError: XcmError;1098 XcmError: XcmError;
1301 XcmErrorV0: XcmErrorV0;1099 XcmErrorV0: XcmErrorV0;
1302 XcmErrorV1: XcmErrorV1;1100 XcmErrorV1: XcmErrorV1;
1309 XcmOriginKind: XcmOriginKind;1107 XcmOriginKind: XcmOriginKind;
1310 XcmpMessageFormat: XcmpMessageFormat;1108 XcmpMessageFormat: XcmpMessageFormat;
1311 XcmV0: XcmV0;1109 XcmV0: XcmV0;
1312 XcmV0Junction: XcmV0Junction;
1313 XcmV0JunctionBodyId: XcmV0JunctionBodyId;
1314 XcmV0JunctionBodyPart: XcmV0JunctionBodyPart;
1315 XcmV0JunctionNetworkId: XcmV0JunctionNetworkId;
1316 XcmV0MultiAsset: XcmV0MultiAsset;
1317 XcmV0MultiLocation: XcmV0MultiLocation;
1318 XcmV0Order: XcmV0Order;
1319 XcmV0OriginKind: XcmV0OriginKind;
1320 XcmV0Response: XcmV0Response;
1321 XcmV0Xcm: XcmV0Xcm;
1322 XcmV1: XcmV1;1110 XcmV1: XcmV1;
1323 XcmV1Junction: XcmV1Junction;
1324 XcmV1MultiAsset: XcmV1MultiAsset;
1325 XcmV1MultiassetAssetId: XcmV1MultiassetAssetId;
1326 XcmV1MultiassetAssetInstance: XcmV1MultiassetAssetInstance;
1327 XcmV1MultiassetFungibility: XcmV1MultiassetFungibility;
1328 XcmV1MultiassetMultiAssetFilter: XcmV1MultiassetMultiAssetFilter;
1329 XcmV1MultiassetMultiAssets: XcmV1MultiassetMultiAssets;
1330 XcmV1MultiassetWildFungibility: XcmV1MultiassetWildFungibility;
1331 XcmV1MultiassetWildMultiAsset: XcmV1MultiassetWildMultiAsset;
1332 XcmV1MultiLocation: XcmV1MultiLocation;
1333 XcmV1MultilocationJunctions: XcmV1MultilocationJunctions;
1334 XcmV1Order: XcmV1Order;
1335 XcmV1Response: XcmV1Response;
1336 XcmV1Xcm: XcmV1Xcm;
1337 XcmV2: XcmV2;1111 XcmV2: XcmV2;
1338 XcmV2Instruction: XcmV2Instruction;
1339 XcmV2Response: XcmV2Response;
1340 XcmV2TraitsError: XcmV2TraitsError;
1341 XcmV2TraitsOutcome: XcmV2TraitsOutcome;
1342 XcmV2WeightLimit: XcmV2WeightLimit;
1343 XcmV2Xcm: XcmV2Xcm;
1344 XcmVersion: XcmVersion;1112 XcmVersion: XcmVersion;
1345 XcmVersionedMultiAssets: XcmVersionedMultiAssets;
1346 XcmVersionedMultiLocation: XcmVersionedMultiLocation;
1347 XcmVersionedXcm: XcmVersionedXcm;
1348 } // InterfaceTypes1113 } // InterfaceTypes
1349} // declare module1114} // declare module
13501115
modifiedtests/src/interfaces/types.tsdiffbeforeafterboth
1// Auto-generated via `yarn polkadot-types-from-defs`, do not edit1// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
2/* eslint-disable */2/* eslint-disable */
3
4export * from './unique/types';
5export * from './rmrk/types';
63
4
modifiedtests/yarn.lockdiffbeforeafterboth
8615 resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"8615 resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
8616 integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==8616 integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==
86178617
8618solc@^0.8.13:8618solc@0.8.13:
8619 version "0.8.13"8619 version "0.8.13"
8620 resolved "https://registry.yarnpkg.com/solc/-/solc-0.8.13.tgz#bafc7fcc11a627e2281e489076b80497123bb704"8620 resolved "https://registry.yarnpkg.com/solc/-/solc-0.8.13.tgz#bafc7fcc11a627e2281e489076b80497123bb704"
8621 integrity sha512-C0yTN+rjEOGO6uVOXI8+EKa75SFMuZpQ2tryex4QxWIg0HRWZvCHKfVPuLZ5wx06Sb6GBp6uQA5yqQyXZnXOJw==8621 integrity sha512-C0yTN+rjEOGO6uVOXI8+EKa75SFMuZpQ2tryex4QxWIg0HRWZvCHKfVPuLZ5wx06Sb6GBp6uQA5yqQyXZnXOJw==