difftreelog
CORE-302 Add EvmCollection Pallet
in: master
24 files changed
Cargo.lockdiffbeforeafterboth5504 "pallet-ethereum",5504 "pallet-ethereum",5505 "pallet-evm",5505 "pallet-evm",5506 "pallet-evm-coder-substrate",5506 "pallet-evm-coder-substrate",5507 "pallet-evm-collection",5507 "pallet-evm-contract-helpers",5508 "pallet-evm-contract-helpers",5508 "pallet-evm-migration",5509 "pallet-evm-migration",5509 "pallet-evm-transaction-payment",5510 "pallet-evm-transaction-payment",6074 "up-data-structs",6075 "up-data-structs",6075]6076]60776078[[package]]6079name = "pallet-evm-collection"6080version = "0.1.0"6081dependencies = [6082 "ethereum",6083 "evm-coder",6084 "fp-evm-mapping",6085 "frame-support",6086 "frame-system",6087 "log",6088 "pallet-common",6089 "pallet-evm",6090 "pallet-evm-coder-substrate",6091 "pallet-nonfungible",6092 "parity-scale-codec",6093 "scale-info",6094 "sp-core",6095 "sp-runtime",6096 "sp-std",6097 "up-data-structs",6098]607660996077[[package]]6100[[package]]6078name = "pallet-evm-contract-helpers"6101name = "pallet-evm-contract-helpers"8784 "pallet-ethereum",8807 "pallet-ethereum",8785 "pallet-evm",8808 "pallet-evm",8786 "pallet-evm-coder-substrate",8809 "pallet-evm-coder-substrate",8810 "pallet-evm-collection",8787 "pallet-evm-contract-helpers",8811 "pallet-evm-contract-helpers",8788 "pallet-evm-migration",8812 "pallet-evm-migration",8789 "pallet-evm-transaction-payment",8813 "pallet-evm-transaction-payment",12845 "pallet-ethereum",12869 "pallet-ethereum",12846 "pallet-evm",12870 "pallet-evm",12847 "pallet-evm-coder-substrate",12871 "pallet-evm-coder-substrate",12872 "pallet-evm-collection",12848 "pallet-evm-contract-helpers",12873 "pallet-evm-contract-helpers",12849 "pallet-evm-migration",12874 "pallet-evm-migration",12850 "pallet-evm-transaction-payment",12875 "pallet-evm-transaction-payment",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/evm-collection/src/stubs/19COLLECTION_ABI=./tests/src/eth/collectionAbi.json172018TESTS_API=./tests/src/eth/api/21TESTS_API=./tests/src/eth/api/192232 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.sh33 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.sh3738Collection.sol:39 PACKAGE=pallet-evm-collection NAME=eth::contract_helpers_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh40 PACKAGE=pallet-evm-collection NAME=eth::contract_helpers_impl OUTPUT=$(COLLECTION_STUBS)/$@ ./.maintain/scripts/generate_sol.sh344135UniqueFungible: UniqueFungible.sol42UniqueFungible: UniqueFungible.sol36 INPUT=$(FUNGIBLE_EVM_STUBS)/$< OUTPUT=$(FUNGIBLE_EVM_STUBS)/UniqueFungible.raw ./.maintain/scripts/compile_stub.sh43 INPUT=$(FUNGIBLE_EVM_STUBS)/$< OUTPUT=$(FUNGIBLE_EVM_STUBS)/UniqueFungible.raw ./.maintain/scripts/compile_stub.sh44 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.sh45 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.sh5354Collection: Collection.sol55 INPUT=$(COLLECTION_STUBS)/$< OUTPUT=$(COLLECTION_STUBS)/Collection.raw ./.maintain/scripts/compile_stub.sh56 INPUT=$(COLLECTION_STUBS)/$< OUTPUT=$(COLLECTION_ABI) ./.maintain/scripts/generate_abi.sh465747evm_stubs: UniqueFungible UniqueNFT ContractHelpers58evm_stubs: UniqueFungible UniqueNFT ContractHelpers Collection485949.PHONY: _bench60.PHONY: _bench50_bench:61_bench:pallets/evm-collection/Cargo.tomldiffbeforeafterbothno changes
pallets/evm-collection/src/eth.rsdiffbeforeafterbothno changes
pallets/evm-collection/src/lib.rsdiffbeforeafterbothno changes
pallets/evm-collection/src/stubs/Collection.rawdiffbeforeafterbothbinary blob — no preview
pallets/evm-collection/src/stubs/Collection.soldiffbeforeafterbothno changes
pallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth20use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};20use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};21use pallet_evm::{21use pallet_evm::{22 ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure,22 ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure,23 account::CrossAccountId, Pallet as PalletEvm23 account::CrossAccountId24};24};25use sp_core::H160;25use sp_core::H160;26use up_data_structs::{27 CreateCollectionData, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,28 MAX_COLLECTION_NAME_LENGTH,29};30use crate::{26use crate::{31 AllowlistEnabled, Config, Owner, Pallet, SponsorBasket, SponsoringRateLimit, SponsoringModeT,27 AllowlistEnabled, Config, Owner, Pallet, SponsorBasket, SponsoringRateLimit, SponsoringModeT,32};28};33use frame_support::traits::Get;29use frame_support::traits::Get;34use up_sponsorship::SponsorshipHandler;30use up_sponsorship::SponsorshipHandler;35use sp_std::vec::Vec;31use sp_std::vec::Vec;36use alloc::format;373238struct ContractHelpers<T: Config>(SubstrateRecorder<T>);33struct ContractHelpers<T: Config>(SubstrateRecorder<T>);39impl<T: Config> WithRecorder<T> for ContractHelpers<T> {34impl<T: Config> WithRecorder<T> for ContractHelpers<T> {143 Ok(())138 Ok(())144 }139 }145146 fn create_721_collection(147 &self,148 caller: caller,149 name: string,150 description: string,151 token_prefix: string,152 ) -> Result<address> {153 let caller = T::CrossAccountId::from_eth(caller);154 let name = name155 .encode_utf16()156 .collect::<Vec<u16>>()157 .try_into()158 .map_err(|_| error_feild_too_long("name", MAX_COLLECTION_NAME_LENGTH))?;159 let description = description160 .encode_utf16()161 .collect::<Vec<u16>>()162 .try_into()163 .map_err(|_| error_feild_too_long("description", MAX_COLLECTION_DESCRIPTION_LENGTH))?;164 let token_prefix = token_prefix165 .into_bytes()166 .try_into()167 .map_err(|_| error_feild_too_long("token_prefix", MAX_TOKEN_PREFIX_LENGTH))?;168169 let data = CreateCollectionData {170 name,171 description,172 token_prefix,173 ..Default::default()174 };175176 let collection_id =177 <pallet_nonfungible::Pallet<T>>::init_collection(caller.as_sub().clone(), data)178 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;179180 let address = pallet_common::eth::collection_id_to_address(collection_id);181182 <PalletEvm<T>>::deposit_log(183 ContractHelperEvent::CollectionCreated {184 owner: *caller.as_eth(),185 collection_id: address,186 }187 .to_log(address),188 );189 Ok(address)190 }191}140}192193fn error_feild_too_long(feild: &str, bound: u32) -> Error {194 Error::Revert(format!("{} is too long. Max length is {}.", feild, bound))195}196141197pub struct HelpersOnMethodCall<T: Config>(PhantomData<*const T>);142pub struct HelpersOnMethodCall<T: Config>(PhantomData<*const T>);198impl<T: Config> OnMethodCall<T> for HelpersOnMethodCall<T> {143impl<T: Config> OnMethodCall<T> for HelpersOnMethodCall<T> {pallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth161617#![cfg_attr(not(feature = "std"), no_std)]17#![cfg_attr(not(feature = "std"), no_std)]1819#[macro_use(format)]20extern crate alloc;211822use codec::{Decode, Encode, MaxEncodedLen};19use codec::{Decode, Encode, MaxEncodedLen};23pub use pallet::*;20pub use pallet::*;pallets/evm-contract-helpers/src/stubs/Collection.soldiffbeforeafterbothno changes
pallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterbothbinary blob — no preview
pallets/evm-contract-helpers/src/stubs/ContractHelpers.soldiffbeforeafterboth21 }21 }22}22}232324// Selector: ee5467a824// Selector: 7b4866f925contract ContractHelpers is Dummy, ERC165 {25contract ContractHelpers is Dummy, ERC165 {26 // Selector: contractOwner(address) 5152b14c26 // Selector: contractOwner(address) 5152b14c27 function contractOwner(address contractAddress)27 function contractOwner(address contractAddress)145 dummy = 0;145 dummy = 0;146 }146 }147148 // Selector: create721Collection(string,string,string) 951c0151149 function create721Collection(150 string memory name,151 string memory description,152 string memory tokenPrefix153 ) public view returns (address) {154 require(false, stub_error);155 name;156 description;157 tokenPrefix;158 dummy;159 return 0x0000000000000000000000000000000000000000;160 }161}147}162148runtime/opal/Cargo.tomldiffbeforeafterboth74 'pallet-evm/std',74 'pallet-evm/std',75 'pallet-evm-migration/std',75 'pallet-evm-migration/std',76 'pallet-evm-contract-helpers/std',76 'pallet-evm-contract-helpers/std',77 'pallet-evm-collection/std',77 'pallet-evm-transaction-payment/std',78 'pallet-evm-transaction-payment/std',78 'pallet-evm-coder-substrate/std',79 'pallet-evm-coder-substrate/std',79 'pallet-ethereum/std',80 'pallet-ethereum/std',417pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.21", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }418pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.21", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }418pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }419pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }419pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }420pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }421pallet-evm-collection = { path = '../../pallets/evm-collection', default-features = false }420pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }422pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }421pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }423pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }422pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }424pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }runtime/opal/src/lib.rsdiffbeforeafterboth49// 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};53};54pub use frame_support::{54pub use frame_support::{55 construct_runtime, match_types,55 construct_runtime, match_types,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_evm_collection::CollectionOnMethodCall<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 // 0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f980 pub const EvmCollectionAddress: 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}978984979impl 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}989990impl pallet_evm_collection::Config for Runtime {991 type ContractAddress = EvmCollectionAddress;992}983993984construct_runtime!(994construct_runtime!(985 pub enum Runtime where995 pub enum Runtime where1033 EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,1043 EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,1034 EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,1044 EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,1035 EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,1045 EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,1046 EvmCollection: pallet_evm_collection::{Pallet} = 154,1036 }1047 }1037);1048);10381049runtime/quartz/Cargo.tomldiffbeforeafterboth74 'pallet-evm/std',74 'pallet-evm/std',75 'pallet-evm-migration/std',75 'pallet-evm-migration/std',76 'pallet-evm-contract-helpers/std',76 'pallet-evm-contract-helpers/std',77 'pallet-evm-collection/std',77 'pallet-evm-transaction-payment/std',78 'pallet-evm-transaction-payment/std',78 'pallet-evm-coder-substrate/std',79 'pallet-evm-coder-substrate/std',79 'pallet-ethereum/std',80 'pallet-ethereum/std',422pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.21", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }423pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.21", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }423pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }424pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }424pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }425pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }426pallet-evm-collection = { path = '../../pallets/evm-collection', default-features = false }425pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }427pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }426pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }428pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }427pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }429pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }runtime/quartz/src/lib.rsdiffbeforeafterboth79};79};80use smallvec::smallvec;80use smallvec::smallvec;81use codec::{Encode, Decode};81use codec::{Encode, Decode};82use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping};82use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};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},278 pallet_evm_migration::OnMethodCall<Self>,278 pallet_evm_migration::OnMethodCall<Self>,279 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,279 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,280 CollectionDispatchT<Self>,280 CollectionDispatchT<Self>,281 pallet_evm_collection::CollectionOnMethodCall<Self>,281 );282 );282 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;283 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;283 type ChainId = ChainId;284 type ChainId = ChainId;952 0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,953 0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,953 ]);954 ]);955 956 // 0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f957 pub const EvmCollectionAddress: H160 = H160([958 0x6c, 0x4e, 0x9f, 0xe1, 0xae, 0x37, 0xa4, 0x1e, 0x93, 0xce, 0xe4, 0x29, 0xe8, 0xe1, 0x88, 0x1a, 0xbd, 0xcb, 0xb5, 0x4f,959 ]);954}960}955961956impl pallet_evm_contract_helpers::Config for Runtime {962impl pallet_evm_contract_helpers::Config for Runtime {957 type ContractAddress = HelpersContractAddress;963 type ContractAddress = HelpersContractAddress;958 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;964 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;959}965}966967impl pallet_evm_collection::Config for Runtime {968 type ContractAddress = EvmCollectionAddress;969}960970961construct_runtime!(971construct_runtime!(962 pub enum Runtime where972 pub enum Runtime where1010 EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,1020 EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,1011 EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,1021 EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,1012 EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,1022 EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,1023 EvmCollection: pallet_evm_collection::{Pallet} = 154,1013 }1024 }1014);1025);10151026runtime/unique/Cargo.tomldiffbeforeafterboth75 'pallet-evm/std',75 'pallet-evm/std',76 'pallet-evm-migration/std',76 'pallet-evm-migration/std',77 'pallet-evm-contract-helpers/std',77 'pallet-evm-contract-helpers/std',78 'pallet-evm-collection/std',78 'pallet-evm-transaction-payment/std',79 'pallet-evm-transaction-payment/std',79 'pallet-evm-coder-substrate/std',80 'pallet-evm-coder-substrate/std',80 'pallet-ethereum/std',81 'pallet-ethereum/std',414pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.21", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }415pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.21", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }415pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }416pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }416pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }417pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }418pallet-evm-collection = { path = '../../pallets/evm-collection', default-features = false }417pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }419pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }418pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }420pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }419pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }421pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }runtime/unique/src/lib.rsdiffbeforeafterboth49// 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};53};54pub use frame_support::{54pub use frame_support::{55 construct_runtime, match_types,55 construct_runtime, match_types,282 pallet_evm_migration::OnMethodCall<Self>,282 pallet_evm_migration::OnMethodCall<Self>,283 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,283 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,284 CollectionDispatchT<Self>,284 CollectionDispatchT<Self>,285 pallet_evm_collection::CollectionOnMethodCall<Self>,285 );286 );286 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;287 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;287 type ChainId = ChainId;288 type ChainId = ChainId;957 0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,958 0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,958 ]);959 ]);960 961 // 0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f962 pub const EvmCollectionAddress: H160 = H160([963 0x6c, 0x4e, 0x9f, 0xe1, 0xae, 0x37, 0xa4, 0x1e, 0x93, 0xce, 0xe4, 0x29, 0xe8, 0xe1, 0x88, 0x1a, 0xbd, 0xcb, 0xb5, 0x4f,964 ]);959}965}960966961impl pallet_evm_contract_helpers::Config for Runtime {967impl pallet_evm_contract_helpers::Config for Runtime {962 type ContractAddress = HelpersContractAddress;968 type ContractAddress = HelpersContractAddress;963 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;969 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;964}970}971972impl pallet_evm_collection::Config for Runtime {973 type ContractAddress = EvmCollectionAddress;974}965975966construct_runtime!(976construct_runtime!(967 pub enum Runtime where977 pub enum Runtime where1015 EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,1025 EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,1016 EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,1026 EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,1017 EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,1027 EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,1028 EvmCollection: pallet_evm_collection::{Pallet} = 154,1018 }1029 }1019);1030);10201031tests/src/eth/api/Collection.soldiffbeforeafterbothno changes
tests/src/eth/api/ContractHelpers.soldiffbeforeafterboth12 function supportsInterface(bytes4 interfaceID) external view returns (bool);12 function supportsInterface(bytes4 interfaceID) external view returns (bool);13}13}141415// Selector: ee5467a815// Selector: 7b4866f916interface ContractHelpers is Dummy, ERC165 {16interface ContractHelpers is Dummy, ERC165 {17 // Selector: contractOwner(address) 5152b14c17 // Selector: contractOwner(address) 5152b14c18 function contractOwner(address contractAddress)18 function contractOwner(address contractAddress)72 bool allowed72 bool allowed73 ) external;73 ) external;7475 // Selector: create721Collection(string,string,string) 951c015176 function create721Collection(77 string memory name,78 string memory description,79 string memory tokenPrefix80 ) external view returns (address);81}74}8275tests/src/eth/collectionAbi.jsondiffbeforeafterbothno changes
tests/src/eth/createCollection.test.tsdiffbeforeafterboth161617import {expect} from 'chai';17import {expect} from 'chai';18import {getCreatedCollectionCount, getDetailedCollectionInfo} from '../util/helpers';18import {getCreatedCollectionCount, getDetailedCollectionInfo} from '../util/helpers';19import {collectionIdFromAddress, contractHelpers, createEthAccountWithBalance, itWeb3} from './util/helpers';19import {collectionHelper, collectionIdFromAddress, contractHelpers, createEthAccountWithBalance, itWeb3} from './util/helpers';202021describe('Create collection from EVM', () => {21describe('Create collection from EVM', () => {22 itWeb3('Create collection', async ({api, web3}) => {22 itWeb3('Create collection', async ({api, web3}) => {23 const owner = await createEthAccountWithBalance(api, web3);23 const owner = await createEthAccountWithBalance(api, web3);24 const helpers = contractHelpers(web3, owner);24 const helpers = collectionHelper(web3, owner);25 const collectionName = 'CollectionEVM';25 const collectionName = 'CollectionEVM';26 const description = 'Some description';26 const description = 'Some description';27 const tokenPrefix = 'token prefix';27 const tokenPrefix = 'token prefix';tests/src/eth/util/contractHelpersAbi.jsondiffbeforeafterboth39 "stateMutability": "view",39 "stateMutability": "view",40 "type": "function"40 "type": "function"41 },41 },42 {43 "inputs": [44 { "internalType": "string", "name": "name", "type": "string" },45 { "internalType": "string", "name": "description", "type": "string" },46 { "internalType": "string", "name": "tokenPrefix", "type": "string" }47 ],48 "name": "create721Collection",49 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],50 "stateMutability": "view",51 "type": "function"52 },53 {42 {54 "inputs": [43 "inputs": [55 {44 {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 getBalance from '../../substrate/get-balance';32import getBalance from '../../substrate/get-balance';32import waitNewBlocks from '../../substrate/wait-new-blocks';33import waitNewBlocks from '../../substrate/wait-new-blocks';3334273 return new web3.eth.Contract(contractHelpersAbi as any, '0x842899ECF380553E8a4de75bF534cdf6fBF64049', {from: caller, ...GAS_ARGS});274 return new web3.eth.Contract(contractHelpersAbi as any, '0x842899ECF380553E8a4de75bF534cdf6fBF64049', {from: caller, ...GAS_ARGS});274}275}276277/** 278 * pallet evm_collection279 * @param web3 280 * @param caller - eth address281 * @returns 282 */283export function collectionHelper(web3: Web3, caller: string) {284 return new web3.eth.Contract(collectionAbi as any, '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f', {from: caller, ...GAS_ARGS});285}275286276/**287/**277 * Execute ethereum method call using substrate account288 * Execute ethereum method call using substrate account