difftreelog
CORE-302 Refactor collection for eth
in: master
20 files changed
Cargo.lockdiffbeforeafterboth546754675468[[package]]5468[[package]]5469name = "once_cell"5469name = "once_cell"5470version = "1.11.0"5470version = "1.12.0"5471source = "registry+https://github.com/rust-lang/crates.io-index"5471source = "registry+https://github.com/rust-lang/crates.io-index"5472checksum = "7b10983b38c53aebdf33f542c6275b0f58a238129d00c4ae0e6fb59738d783ca"5472checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"547354735474[[package]]5474[[package]]5475name = "opal-runtime"5475name = "opal-runtime"6830 "parity-scale-codec 3.1.2",6830 "parity-scale-codec 3.1.2",6831 "scale-info",6831 "scale-info",6832 "serde",6832 "serde",6833 "serde-json-core",6834 "sp-core",6833 "sp-core",6835 "sp-io",6834 "sp-io",6836 "sp-runtime",6835 "sp-runtime",10734 "serde_derive",10733 "serde_derive",10735]10734]1073610737[[package]]10738name = "serde-json-core"10739version = "0.4.0"10740source = "registry+https://github.com/rust-lang/crates.io-index"10741checksum = "8014aeea272bca0f0779778d43253f2f3375b414185b30e6ecc4d3e4a9994781"10742dependencies = [10743 "ryu",10744 "serde",10745]107461073510747[[package]]10736[[package]]10748name = "serde_derive"10737name = "serde_derive"120251201412026[[package]]12015[[package]]12027name = "target-lexicon"12016name = "target-lexicon"12028version = "0.12.3"12017version = "0.12.4"12029source = "registry+https://github.com/rust-lang/crates.io-index"12018source = "registry+https://github.com/rust-lang/crates.io-index"12030checksum = "d7fa7e55043acb85fca6b3c01485a2eeb6b69c5d21002e273c79e465f43b7ac1"12019checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1"120311202012032[[package]]12021[[package]]12033name = "tempfile"12022name = "tempfile"Makefilediffbeforeafterboth15CONTRACT_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.json16CONTRACT_HELPERS_ABI=./tests/src/eth/util/contractHelpersAbi.json1718COLLECTION_STUBS=./pallets/unique/src/eth/stubs/19COLLECTION_ABI=./tests/src/eth/collectionAbi.json201721COLLECTION_HELPER_STUBS=$(COLLECTION_STUBS)18COLLECTION_HELPER_STUBS=$(COLLECTION_STUBS)22COLLECTION_HELPER_ABI=./tests/src/eth/collectionHelperAbi.json19COLLECTION_HELPER_ABI=./tests/src/eth/collectionHelperAbi.json232024TESTS_API=./tests/src/eth/api/21TESTS_API=./tests/src/eth/api/252226.PHONY: regenerate_solidity23.PHONY: regenerate_solidity27regenerate_solidity: UniqueFungible.sol UniqueNFT.sol ContractHelpers.sol Collection.sol CollectionHelper.sol24regenerate_solidity: UniqueFungible.sol UniqueNFT.sol ContractHelpers.sol CollectionHelper.sol282529UniqueFungible.sol:26UniqueFungible.sol:30 PACKAGE=pallet-fungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh27 PACKAGE=pallet-fungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh38 PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh35 PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh39 PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_impl OUTPUT=$(CONTRACT_HELPERS_STUBS)/$@ ./.maintain/scripts/generate_sol.sh36 PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_impl OUTPUT=$(CONTRACT_HELPERS_STUBS)/$@ ./.maintain/scripts/generate_sol.sh4041Collection.sol:42 PACKAGE=pallet-unique NAME=eth::evm_collection::collection_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh43 PACKAGE=pallet-unique NAME=eth::evm_collection::collection_impl OUTPUT=$(COLLECTION_STUBS)/$@ ./.maintain/scripts/generate_sol.sh443745CollectionHelper.sol:38CollectionHelper.sol:46 PACKAGE=pallet-unique NAME=eth::evm_collection::collection_helper_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh39 PACKAGE=pallet-unique NAME=eth::evm_collection::collection_helper_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh58 INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw ./.maintain/scripts/compile_stub.sh51 INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw ./.maintain/scripts/compile_stub.sh59 INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_ABI) ./.maintain/scripts/generate_abi.sh52 INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_ABI) ./.maintain/scripts/generate_abi.sh6061Collection: Collection.sol62 INPUT=$(COLLECTION_STUBS)/$< OUTPUT=$(COLLECTION_STUBS)/Collection.raw ./.maintain/scripts/compile_stub.sh63 INPUT=$(COLLECTION_STUBS)/$< OUTPUT=$(COLLECTION_ABI) ./.maintain/scripts/generate_abi.sh645365CollectionHelper: CollectionHelper.sol54CollectionHelper: CollectionHelper.sol66 INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_STUBS)/CollectionHelper.raw ./.maintain/scripts/compile_stub.sh55 INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_STUBS)/CollectionHelper.raw ./.maintain/scripts/compile_stub.sh67 INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_ABI) ./.maintain/scripts/generate_abi.sh56 INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_ABI) ./.maintain/scripts/generate_abi.sh685769evm_stubs: UniqueFungible UniqueNFT ContractHelpers Collection CollectionHelper58evm_stubs: UniqueFungible UniqueNFT ContractHelpers CollectionHelper705971.PHONY: _bench60.PHONY: _bench72_bench:61_bench:pallets/common/src/erc.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use evm_coder::{solidity_interface, types::*, execution::Result};17use evm_coder::{solidity_interface, types::*, execution::{Result, Error}};18pub use pallet_evm::{PrecompileOutput, PrecompileResult, account::CrossAccountId};18pub use pallet_evm::{PrecompileOutput, PrecompileResult, account::CrossAccountId};19use pallet_evm_coder_substrate::dispatch_to_evm;19use pallet_evm_coder_substrate::{dispatch_to_evm, SubstrateRecorder};20use sp_core::{H160, U256};20use sp_core::{H160, U256};21use sp_std::vec::Vec;21use sp_std::vec::Vec;22use up_data_structs::Property;22use up_data_structs::Property;31 fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileResult>;31 fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileResult>;32}32}333334#[solidity_interface(name = "CollectionProperties")]34#[solidity_interface(name = "Collection")]35impl<T: Config> CollectionHandle<T> {35impl<T: Config> CollectionHandle<T> {36 fn set_collection_property(&mut self, caller: caller, key: string, value: bytes) -> Result<()> {36 fn set_collection_property(&mut self, caller: caller, key: string, value: bytes) -> Result<()> {37 let caller = T::CrossAccountId::from_eth(caller);37 let caller = T::CrossAccountId::from_eth(caller);65 Ok(prop.to_vec())65 Ok(prop.to_vec())66 }66 }6768 fn eth_set_sponsor(69 &mut self,70 caller: caller,71 sponsor: address,72 ) -> Result<void> {73 check_is_owner(caller, self)?;7475 let sponsor = T::CrossAccountId::from_eth(sponsor);76 self.set_sponsor(sponsor.as_sub().clone());77 save(self);78 Ok(())79 }8081 fn eth_confirm_sponsorship(&mut self, caller: caller) -> Result<void> {82 let caller = T::CrossAccountId::from_eth(caller);83 if !self.confirm_sponsorship(caller.as_sub()) {84 return Err(Error::Revert("Caller is not set as sponsor".into()));85 }86 save(self);87 Ok(())88 }8990 fn set_limits(91 &self,92 caller: caller,93 limits_json: string,94 ) -> Result<void> {95 // let mut collection = collection_from_address::<T>(self.contract_address(caller).unwrap(), self.1.gas_left())?;96 // check_is_owner(caller, &collection)?;9798 // let limits = serde_json_core::from_str(limits_json.as_ref())99 // .map_err(|e| Error::Revert(format!("Parse JSON error: {}", e)))?;100 // collection.limits = limits.0;101 // collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;102 Ok(())103 }104105 fn contract_address(&self, _caller: caller) -> Result<address> {106 Ok(crate::eth::collection_id_to_address(self.id))107 }67}108}68109110fn collection_from_address<T: Config>(111 collection_address: address,112 gas_limit: u64113) -> Result<CollectionHandle<T>> {114 let collection_id = crate::eth::map_eth_to_id(&collection_address)115 .ok_or(Error::Revert("Contract is not an unique collection".into()))?;116 let recorder = <SubstrateRecorder<T>>::new(gas_limit);117 let collection =118 CollectionHandle::new_with_recorder(collection_id, recorder)119 .ok_or(Error::Revert("Create collection handle error".into()))?;120 Ok(collection)121}122123fn check_is_owner<T: Config>(caller: caller, collection: &CollectionHandle<T>) -> Result<()> {124 let caller = T::CrossAccountId::from_eth(caller);125 collection126 .check_is_owner(&caller)127 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;128 Ok(())129}130131fn save<T: Config>(collection: &CollectionHandle<T>) {132 <crate::CollectionById<T>>::insert(collection.id, collection.collection.clone());133}pallets/common/src/lib.rsdiffbeforeafterboth202021use core::ops::{Deref, DerefMut};21use core::ops::{Deref, DerefMut};22use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};22use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};23use sp_std::{vec::Vec, rc::Rc};23use sp_std::vec::Vec;24use pallet_evm::account::CrossAccountId;24use pallet_evm::account::CrossAccountId;25use frame_support::{25use frame_support::{26 dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, Weight, PostDispatchInfo},26 dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, Weight, PostDispatchInfo},pallets/fungible/src/erc.rsdiffbeforeafterboth24use 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};282829use 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> {}pallets/nonfungible/src/erc.rsdiffbeforeafterboth26use sp_core::{H160, U256};26use sp_core::{H160, U256};27use sp_std::vec::Vec;27use sp_std::vec::Vec;28use pallet_common::{28use pallet_common::{29 erc::{CommonEvmHandler, PrecompileResult, CollectionPropertiesCall},29 erc::{CommonEvmHandler, PrecompileResult, CollectionCall},30 CollectionHandle,30 CollectionHandle,31};31};32use pallet_evm::account::CrossAccountId;32use pallet_evm::account::CrossAccountId;513 ERC721UniqueExtensions,513 ERC721UniqueExtensions,514 ERC721Mintable,514 ERC721Mintable,515 ERC721Burnable,515 ERC721Burnable,516 via("CollectionHandle<T>", common_mut, CollectionProperties),516 via("CollectionHandle<T>", common_mut, Collection),517 TokenProperties,517 TokenProperties,518 )518 )519)]519)]pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth51 event MintingFinished();51 event MintingFinished();52}52}5354// Selector: 38e33c6055contract Collection is Dummy, ERC165 {56 // Selector: setCollectionProperty(string,bytes) 2f073f6657 function setCollectionProperty(string memory key, bytes memory value)58 public59 {60 require(false, stub_error);61 key;62 value;63 dummy = 0;64 }6566 // Selector: deleteCollectionProperty(string) 7b7debce67 function deleteCollectionProperty(string memory key) public {68 require(false, stub_error);69 key;70 dummy = 0;71 }7273 // Throws error if key not found74 //75 // Selector: collectionProperty(string) cf24fd6d76 function collectionProperty(string memory key)77 public78 view79 returns (bytes memory)80 {81 require(false, stub_error);82 key;83 dummy;84 return hex"";85 }8687 // Selector: ethSetSponsor(address) 8f9af35688 function ethSetSponsor(address sponsor) public {89 require(false, stub_error);90 sponsor;91 dummy = 0;92 }9394 // Selector: ethConfirmSponsorship() a8580d1a95 function ethConfirmSponsorship() public {96 require(false, stub_error);97 dummy = 0;98 }99100 // Selector: setLimits(string) 72cb345d101 function setLimits(string memory limitsJson) public view {102 require(false, stub_error);103 limitsJson;104 dummy;105 }106107 // Selector: contractAddress() f6b4dfb4108 function contractAddress() public view returns (address) {109 require(false, stub_error);110 dummy;111 return 0x0000000000000000000000000000000000000000;112 }113}5311454// Selector: 41369377115// Selector: 4136937755contract TokenProperties is Dummy, ERC165 {116contract TokenProperties is Dummy, ERC165 {330 }391 }331}392}332333// Selector: 9b5e29c5334contract CollectionProperties is Dummy, ERC165 {335 // Selector: setCollectionProperty(string,bytes) 2f073f66336 function setCollectionProperty(string memory key, bytes memory value)337 public338 {339 require(false, stub_error);340 key;341 value;342 dummy = 0;343 }344345 // Selector: deleteCollectionProperty(string) 7b7debce346 function deleteCollectionProperty(string memory key) public {347 require(false, stub_error);348 key;349 dummy = 0;350 }351352 // Throws error if key not found353 //354 // Selector: collectionProperty(string) cf24fd6d355 function collectionProperty(string memory key)356 public357 view358 returns (bytes memory)359 {360 require(false, stub_error);361 key;362 dummy;363 return hex"";364 }365}366393367// Selector: d74d154f394// Selector: d74d154f368contract ERC721UniqueExtensions is Dummy, ERC165 {395contract ERC721UniqueExtensions is Dummy, ERC165 {423 ERC721UniqueExtensions,450 ERC721UniqueExtensions,424 ERC721Mintable,451 ERC721Mintable,425 ERC721Burnable,452 ERC721Burnable,426 CollectionProperties,453 Collection,427 TokenProperties454 TokenProperties428{}455{}429456pallets/unique/Cargo.tomldiffbeforeafterboth20std = [20std = [21 'codec/std',21 'codec/std',22 'serde/std',22 'serde/std',23 'serde-json-core/std',24 'frame-support/std',23 'frame-support/std',25 'frame-system/std',24 'frame-system/std',26 'pallet-evm/std',25 'pallet-evm/std',43features = ['derive']42features = ['derive']44version = '1.0.130'43version = '1.0.130'4546[dependencies.serde-json-core]47default-features = false48version = "0.4"494450[dependencies.ethereum]45[dependencies.ethereum]51version = "0.12.0"46version = "0.12.0"pallets/unique/src/eth/mod.rsdiffbeforeafterboth110 }110 }111 }111 }112 112 113 struct EvmCollection<T: Config>(H160, SubstrateRecorder<T>);114 impl<T: Config> WithRecorder<T> for EvmCollection<T> {115 fn recorder(&self) -> &SubstrateRecorder<T> {116 &self.1117 }118 119 fn into_recorder(self) -> SubstrateRecorder<T> {120 self.1121 }122 }123 124 #[derive(ToLog)]113 #[derive(ToLog)]125 pub enum EthCollectionEvent {114 pub enum EthCollectionEvent {131 },120 },132 }121 }133 134 #[solidity_interface(name = "Collection")]135 impl<T: Config> EvmCollection<T> {136 fn set_sponsor(137 &self,138 caller: caller,139 sponsor: address,140 ) -> Result<void> {141 let mut collection = collection_from_address::<T>(self.contract_address(caller).unwrap(), self.1.gas_left())?;142 check_is_owner(caller, &collection)?;143 144 let sponsor = T::CrossAccountId::from_eth(sponsor);145 collection.set_sponsor(sponsor.as_sub().clone());146 collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;147 Ok(())148 }149 150 fn confirm_sponsorship(&self, caller: caller) -> Result<void> {151 let mut collection = collection_from_address::<T>(self.contract_address(caller).unwrap(), self.1.gas_left())?;152 let caller = T::CrossAccountId::from_eth(caller);153 if !collection.confirm_sponsorship(caller.as_sub()) {154 return Err(Error::Revert("Caller is not set as sponsor".into()));155 }156 collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;157 Ok(())158 }159 160 fn set_limits(161 &self,162 caller: caller,163 limits_json: string,164 ) -> Result<void> {165 let mut collection = collection_from_address::<T>(self.contract_address(caller).unwrap(), self.1.gas_left())?;166 check_is_owner(caller, &collection)?;167 168 let limits = serde_json_core::from_str(limits_json.as_ref())169 .map_err(|e| Error::Revert(format!("Parse JSON error: {}", e)))?;170 collection.limits = limits.0;171 collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;172 Ok(())173 }174175 fn contract_address(&self, _caller: caller) -> Result<address> {176 Ok(self.0)177 }178 }179 180 fn error_feild_too_long(feild: &str, bound: u32) -> Error {181 Error::Revert(format!("{} is too long. Max length is {}.", feild, bound))182 }183 184 fn collection_from_address<T: Config>(185 collection_address: address,186 gas_limit: u64187 ) -> Result<CollectionHandle<T>> {188 let collection_id = pallet_common::eth::map_eth_to_id(&collection_address)189 .ok_or(Error::Revert("Contract is not an unique collection".into()))?;190 let recorder = <SubstrateRecorder<T>>::new(gas_limit);191 let collection =192 pallet_common::CollectionHandle::new_with_recorder(collection_id, recorder)193 .ok_or(Error::Revert("Create collection handle error".into()))?;194 Ok(collection)195 }196 197 fn check_is_owner<T: Config>(caller: caller, collection: &CollectionHandle<T>) -> Result<()> {198 let caller = T::CrossAccountId::from_eth(caller);199 collection200 .check_is_owner(&caller)201 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;202 Ok(())203 }204122205 pub struct CollectionHelperOnMethodCall<T: Config>(PhantomData<*const T>);123 pub struct CollectionHelperOnMethodCall<T: Config>(PhantomData<*const T>);206 impl<T: Config> OnMethodCall<T> for CollectionHelperOnMethodCall<T> {124 impl<T: Config> OnMethodCall<T> for CollectionHelperOnMethodCall<T> {236 generate_stubgen!(collection_helper_impl, CollectionHelperCall<()>, true);154 generate_stubgen!(collection_helper_impl, CollectionHelperCall<()>, true);237 generate_stubgen!(collection_helper_iface, CollectionHelperCall<()>, false);155 generate_stubgen!(collection_helper_iface, CollectionHelperCall<()>, false);238 156239 pub struct CollectionOnMethodCall<T: Config>(PhantomData<*const T>);240 impl<T: Config> OnMethodCall<T> for CollectionOnMethodCall<T> {241 fn is_reserved(contract: &sp_core::H160) -> bool {157 fn error_feild_too_long(feild: &str, bound: u32) -> Error {242 contract == &T::ContractAddress::get()243 }244 245 fn is_used(contract: &sp_core::H160) -> bool {246 contract == &T::ContractAddress::get()247 }248 249 fn call(250 source: &sp_core::H160,251 target: &sp_core::H160,252 gas_left: u64,253 input: &[u8],254 value: sp_core::U256,255 ) -> Option<PrecompileResult> {256 if !pallet_common::eth::is_collection(target) {257 return None;258 }259260 let helpers = EvmCollection::<T>(*target, SubstrateRecorder::<T>::new(gas_left));261 pallet_evm_coder_substrate::call(*source, helpers, value, input)262 }263 264 fn get_code(contract: &sp_core::H160) -> Option<Vec<u8>> {265 (contract == &T::ContractAddress::get())158 Error::Revert(format!("{} is too long. Max length is {}.", feild, bound))266 .then(|| include_bytes!("./stubs/Collection.raw").to_vec())267 }159 }268 }269 270 generate_stubgen!(collection_impl, CollectionCall<()>, true);271 generate_stubgen!(collection_iface, CollectionCall<()>, false);272}160}273161pallets/unique/src/eth/stubs/Collection.rawdiffbeforeafterbothbinary blob — no preview
pallets/unique/src/eth/stubs/Collection.soldiffbeforeafterbothno changes
runtime/opal/src/lib.rsdiffbeforeafterboth307 pallet_evm_migration::OnMethodCall<Self>,307 pallet_evm_migration::OnMethodCall<Self>,308 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,308 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,309 CollectionDispatchT<Self>,309 CollectionDispatchT<Self>,310 evm_collection::CollectionOnMethodCall<Self>,311 evm_collection::CollectionHelperOnMethodCall<Self>,310 evm_collection::CollectionHelperOnMethodCall<Self>,312 );311 );313 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;312 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;runtime/quartz/src/lib.rsdiffbeforeafterboth286 pallet_evm_migration::OnMethodCall<Self>,286 pallet_evm_migration::OnMethodCall<Self>,287 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,287 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,288 CollectionDispatchT<Self>,288 CollectionDispatchT<Self>,289 evm_collection::CollectionOnMethodCall<Self>,290 evm_collection::CollectionHelperOnMethodCall<Self>,289 evm_collection::CollectionHelperOnMethodCall<Self>,291 );290 );292 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;291 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;runtime/unique/src/lib.rsdiffbeforeafterboth291 pallet_evm_migration::OnMethodCall<Self>,291 pallet_evm_migration::OnMethodCall<Self>,292 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,292 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,293 CollectionDispatchT<Self>,293 CollectionDispatchT<Self>,294 evm_collection::CollectionOnMethodCall<Self>,295 evm_collection::CollectionHelperOnMethodCall<Self>,294 evm_collection::CollectionHelperOnMethodCall<Self>,296 );295 );297 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;296 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth42 event MintingFinished();42 event MintingFinished();43}43}4445// Selector: 38e33c6046interface Collection is Dummy, ERC165 {47 // Selector: setCollectionProperty(string,bytes) 2f073f6648 function setCollectionProperty(string memory key, bytes memory value)49 external;5051 // Selector: deleteCollectionProperty(string) 7b7debce52 function deleteCollectionProperty(string memory key) external;5354 // Throws error if key not found55 //56 // Selector: collectionProperty(string) cf24fd6d57 function collectionProperty(string memory key)58 external59 view60 returns (bytes memory);6162 // Selector: ethSetSponsor(address) 8f9af35663 function ethSetSponsor(address sponsor) external;6465 // Selector: ethConfirmSponsorship() a8580d1a66 function ethConfirmSponsorship() external;6768 // Selector: setLimits(string) 72cb345d69 function setLimits(string memory limitsJson) external view;7071 // Selector: contractAddress() f6b4dfb472 function contractAddress() external view returns (address);73}447445// Selector: 4136937775// Selector: 4136937746interface TokenProperties is Dummy, ERC165 {76interface TokenProperties is Dummy, ERC165 {191 function totalSupply() external view returns (uint256);221 function totalSupply() external view returns (uint256);192}222}193194// Selector: 9b5e29c5195interface CollectionProperties is Dummy, ERC165 {196 // Selector: setCollectionProperty(string,bytes) 2f073f66197 function setCollectionProperty(string memory key, bytes memory value)198 external;199200 // Selector: deleteCollectionProperty(string) 7b7debce201 function deleteCollectionProperty(string memory key) external;202203 // Throws error if key not found204 //205 // Selector: collectionProperty(string) cf24fd6d206 function collectionProperty(string memory key)207 external208 view209 returns (bytes memory);210}211223212// Selector: d74d154f224// Selector: d74d154f213interface ERC721UniqueExtensions is Dummy, ERC165 {225interface ERC721UniqueExtensions is Dummy, ERC165 {240 ERC721UniqueExtensions,252 ERC721UniqueExtensions,241 ERC721Mintable,253 ERC721Mintable,242 ERC721Burnable,254 ERC721Burnable,243 CollectionProperties,255 Collection,244 TokenProperties256 TokenProperties245{}257{}246258tests/src/eth/collectionAbi.jsondiffbeforeafterbothno changes
tests/src/eth/createCollection.test.tsdiffbeforeafterboth88 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);88 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);89 const sponsor = await createEthAccountWithBalance(api, web3);89 const sponsor = await createEthAccountWithBalance(api, web3);90 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);90 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);91 result = await collectionEvm.methods.setSponsor(sponsor).send();91 result = await collectionEvm.methods.ethSetSponsor(sponsor).send();92 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;92 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;93 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;93 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;94 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));94 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));95 await expect(collectionEvm.methods.confirmSponsorship().call()).to.be.rejectedWith('Caller is not set as sponsor');95 await expect(collectionEvm.methods.ethConfirmSponsorship().call()).to.be.rejectedWith('Caller is not set as sponsor');96 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);96 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);97 await sponsorCollection.methods.confirmSponsorship().send();97 await sponsorCollection.methods.ethConfirmSponsorship().send();98 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;98 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;99 expect(collectionSub.sponsorship.isConfirmed).to.be.true;99 expect(collectionSub.sponsorship.isConfirmed).to.be.true;100 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));100 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));tests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth125 "stateMutability": "view",125 "stateMutability": "view",126 "type": "function"126 "type": "function"127 },127 },128 {129 "inputs": [],130 "name": "contractAddress",131 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],132 "stateMutability": "view",133 "type": "function"134 },128 {135 {129 "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],136 "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],130 "name": "deleteCollectionProperty",137 "name": "deleteCollectionProperty",142 "stateMutability": "nonpayable",149 "stateMutability": "nonpayable",143 "type": "function"150 "type": "function"144 },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 },145 {168 {146 "inputs": [],169 "inputs": [],147 "name": "finishMinting",170 "name": "finishMinting",300 "stateMutability": "nonpayable",323 "stateMutability": "nonpayable",301 "type": "function"324 "type": "function"302 },325 },326 {327 "inputs": [328 { "internalType": "string", "name": "limitsJson", "type": "string" }329 ],330 "name": "setLimits",331 "outputs": [],332 "stateMutability": "view",333 "type": "function"334 },303 {335 {304 "inputs": [336 "inputs": [305 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },337 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },tests/src/eth/util/helpers.tsdiffbeforeafterboth28import 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 collectionAbi from '../collectionAbi.json';31import collectionAbi from '../nonFungibleAbi.json';32import collectionHelperAbi from '../collectionHelperAbi.json';32import collectionHelperAbi from '../collectionHelperAbi.json';33import getBalance from '../../substrate/get-balance';33import getBalance from '../../substrate/get-balance';34import waitNewBlocks from '../../substrate/wait-new-blocks';34import waitNewBlocks from '../../substrate/wait-new-blocks';