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

difftreelog

CORE-300 Adapt to CrossAccountId

Trubnikov Sergey2022-03-15parent: #22251a0.patch.diff
in: master

20 files changed

modifiedCargo.lockdiffbeforeafterboth
2554 "fc-db",2554 "fc-db",
2555 "fc-rpc-core",2555 "fc-rpc-core",
2556 "fp-consensus",2556 "fp-consensus",
2557 "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",2557 "fp-evm",
2558 "fp-rpc",2558 "fp-rpc",
2559 "fp-storage",2559 "fp-storage",
2560 "futures 0.3.21",2560 "futures 0.3.21",
2565 "log",2565 "log",
2566 "lru 0.6.6",2566 "lru 0.6.6",
2567 "pallet-ethereum",2567 "pallet-ethereum",
2568 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",2568 "pallet-evm",
2569 "parity-scale-codec",2569 "parity-scale-codec",
2570 "parking_lot 0.11.2",2570 "parking_lot 0.11.2",
2571 "rand 0.7.3",2571 "rand 0.7.3",
2757dependencies = [2757dependencies = [
2758 "ethereum",2758 "ethereum",
2759 "ethereum-types",2759 "ethereum-types",
2760 "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",2760 "fp-evm",
2761 "parity-scale-codec",2761 "parity-scale-codec",
2762 "scale-info",2762 "scale-info",
2763 "sp-api",2763 "sp-api",
2852 "sp-trie",2852 "sp-trie",
2853]2853]
2854
2855[[package]]
2856name = "frame-common"
2857version = "0.1.0"
2858source = "git+https://github.com/uniquenetwork/frontier.git?branch=feature/300#0a1dc4086cbe971ddf57edf82a61cfce52c8c20b"
2859dependencies = [
2860 "frame-system",
2861 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=feature/300)",
2862 "parity-scale-codec",
2863 "scale-info",
2864 "serde",
2865 "sp-core",
2866 "sp-std",
2867 "up-evm-mapping",
2868]
28692854
2870[[package]]2855[[package]]
2871name = "frame-election-provider-support"2856name = "frame-election-provider-support"
5850dependencies = [5835dependencies = [
5851 "frame-support",5836 "frame-support",
5852 "frame-system",5837 "frame-system",
5853 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",5838 "pallet-evm",
5854 "parity-scale-codec",5839 "parity-scale-codec",
5855 "scale-info",5840 "scale-info",
5856 "serde",5841 "serde",
5999version = "0.1.0"5984version = "0.1.0"
6000dependencies = [5985dependencies = [
6001 "evm-coder",5986 "evm-coder",
6002 "frame-common",
6003 "frame-support",5987 "frame-support",
6004 "frame-system",5988 "frame-system",
6005 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",5989 "pallet-evm",
6006 "pallet-evm-coder-substrate",5990 "pallet-evm-coder-substrate",
6007 "parity-scale-codec",5991 "parity-scale-codec",
6008 "scale-info",5992 "scale-info",
6080 "ethereum-types",6064 "ethereum-types",
6081 "evm",6065 "evm",
6082 "fp-consensus",6066 "fp-consensus",
6083 "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",6067 "fp-evm",
6084 "fp-rpc",6068 "fp-rpc",
6085 "fp-self-contained",6069 "fp-self-contained",
6086 "fp-storage",6070 "fp-storage",
6087 "frame-support",6071 "frame-support",
6088 "frame-system",6072 "frame-system",
6089 "log",6073 "log",
6090 "pallet-balances",6074 "pallet-balances",
6091 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",6075 "pallet-evm",
6092 "pallet-timestamp",6076 "pallet-timestamp",
6093 "parity-scale-codec",6077 "parity-scale-codec",
6094 "rlp",6078 "rlp",
6109 "evm",6093 "evm",
6110 "evm-gasometer",6094 "evm-gasometer",
6111 "evm-runtime",6095 "evm-runtime",
6112 "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",6096 "fp-evm",
6113 "frame-benchmarking",6097 "frame-benchmarking",
6114 "frame-support",6098 "frame-support",
6115 "frame-system",6099 "frame-system",
6140 "frame-support",6124 "frame-support",
6141 "frame-system",6125 "frame-system",
6142 "pallet-ethereum",6126 "pallet-ethereum",
6143 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",6127 "pallet-evm",
6144 "parity-scale-codec",6128 "parity-scale-codec",
6145 "scale-info",6129 "scale-info",
6146 "sp-core",6130 "sp-core",
6155 "frame-support",6139 "frame-support",
6156 "frame-system",6140 "frame-system",
6157 "log",6141 "log",
6158 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",6142 "pallet-evm",
6159 "pallet-evm-coder-substrate",6143 "pallet-evm-coder-substrate",
6160 "parity-scale-codec",6144 "parity-scale-codec",
6161 "scale-info",6145 "scale-info",
6170name = "pallet-evm-migration"6154name = "pallet-evm-migration"
6171version = "0.1.0"6155version = "0.1.0"
6172dependencies = [6156dependencies = [
6173 "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",6157 "fp-evm",
6174 "frame-benchmarking",6158 "frame-benchmarking",
6175 "frame-support",6159 "frame-support",
6176 "frame-system",6160 "frame-system",
6177 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",6161 "pallet-evm",
6178 "parity-scale-codec",6162 "parity-scale-codec",
6179 "scale-info",6163 "scale-info",
6180 "sp-core",6164 "sp-core",
6187name = "pallet-evm-transaction-payment"6171name = "pallet-evm-transaction-payment"
6188version = "0.1.0"6172version = "0.1.0"
6189dependencies = [6173dependencies = [
6190 "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",6174 "fp-evm",
6191 "frame-support",6175 "frame-support",
6192 "frame-system",6176 "frame-system",
6193 "pallet-ethereum",6177 "pallet-ethereum",
6194 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",6178 "pallet-evm",
6195 "parity-scale-codec",6179 "parity-scale-codec",
6196 "scale-info",6180 "scale-info",
6197 "sp-core",6181 "sp-core",
6209 "ethereum",6193 "ethereum",
6210 "evm-coder",6194 "evm-coder",
6211 "frame-benchmarking",6195 "frame-benchmarking",
6212 "frame-common",
6213 "frame-support",6196 "frame-support",
6214 "frame-system",6197 "frame-system",
6215 "pallet-common",6198 "pallet-common",
6199 "pallet-evm",
6216 "pallet-evm-coder-substrate",6200 "pallet-evm-coder-substrate",
6217 "parity-scale-codec",6201 "parity-scale-codec",
6218 "scale-info",6202 "scale-info",
6436 "ethereum",6420 "ethereum",
6437 "evm-coder",6421 "evm-coder",
6438 "frame-benchmarking",6422 "frame-benchmarking",
6439 "frame-common",
6440 "frame-support",6423 "frame-support",
6441 "frame-system",6424 "frame-system",
6442 "pallet-common",6425 "pallet-common",
6426 "pallet-evm",
6443 "pallet-evm-coder-substrate",6427 "pallet-evm-coder-substrate",
6444 "parity-scale-codec",6428 "parity-scale-codec",
6445 "scale-info",6429 "scale-info",
6553version = "0.1.0"6537version = "0.1.0"
6554dependencies = [6538dependencies = [
6555 "frame-benchmarking",6539 "frame-benchmarking",
6556 "frame-common",
6557 "frame-support",6540 "frame-support",
6558 "frame-system",6541 "frame-system",
6559 "pallet-common",6542 "pallet-common",
6543 "pallet-evm",
6560 "parity-scale-codec",6544 "parity-scale-codec",
6561 "scale-info",6545 "scale-info",
6562 "sp-core",6546 "sp-core",
6814dependencies = [6798dependencies = [
6815 "ethereum",6799 "ethereum",
6816 "evm-coder",6800 "evm-coder",
6817 "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",6801 "fp-evm",
6818 "frame-benchmarking",6802 "frame-benchmarking",
6819 "frame-common",
6820 "frame-support",6803 "frame-support",
6821 "frame-system",6804 "frame-system",
6822 "hex-literal",6805 "hex-literal",
6823 "pallet-balances",6806 "pallet-balances",
6824 "pallet-common",6807 "pallet-common",
6825 "pallet-ethereum",6808 "pallet-ethereum",
6826 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",6809 "pallet-evm",
6827 "pallet-evm-coder-substrate",6810 "pallet-evm-coder-substrate",
6828 "pallet-fungible",6811 "pallet-fungible",
6829 "pallet-nonfungible",6812 "pallet-nonfungible",
12353name = "uc-rpc"12336name = "uc-rpc"
12354version = "0.1.0"12337version = "0.1.0"
12355dependencies = [12338dependencies = [
12356 "frame-common",
12357 "jsonrpc-core",12339 "jsonrpc-core",
12358 "jsonrpc-core-client",12340 "jsonrpc-core-client",
12359 "jsonrpc-derive",12341 "jsonrpc-derive",
12360 "pallet-common",12342 "pallet-common",
12343 "pallet-evm",
12361 "parity-scale-codec",12344 "parity-scale-codec",
12362 "sp-api",12345 "sp-api",
12363 "sp-blockchain",12346 "sp-blockchain",
12570 "fp-rpc",12553 "fp-rpc",
12571 "fp-self-contained",12554 "fp-self-contained",
12572 "frame-benchmarking",12555 "frame-benchmarking",
12573 "frame-common",
12574 "frame-executive",12556 "frame-executive",
12575 "frame-support",12557 "frame-support",
12576 "frame-system",12558 "frame-system",
12583 "pallet-base-fee",12565 "pallet-base-fee",
12584 "pallet-common",12566 "pallet-common",
12585 "pallet-ethereum",12567 "pallet-ethereum",
12586 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.17)",12568 "pallet-evm",
12587 "pallet-evm-coder-substrate",12569 "pallet-evm-coder-substrate",
12588 "pallet-evm-contract-helpers",12570 "pallet-evm-contract-helpers",
12589 "pallet-evm-migration",12571 "pallet-evm-migration",
12720name = "up-rpc"12702name = "up-rpc"
12721version = "0.1.0"12703version = "0.1.0"
12722dependencies = [12704dependencies = [
12723 "frame-common",
12724 "pallet-common",12705 "pallet-common",
12706 "pallet-evm",
12725 "parity-scale-codec",12707 "parity-scale-codec",
12726 "sp-api",12708 "sp-api",
12727 "sp-core",12709 "sp-core",
modifiedclient/rpc/Cargo.tomldiffbeforeafterboth
18sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }18sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
19sp-rpc = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }19sp-rpc = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
20sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }20sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
21pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.18" }
21frame-common = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "feature/300" }22frame-common = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "feature/300" }
2223
modifiedclient/rpc/src/lib.rsdiffbeforeafterboth
201 AccountId: Decode,201 AccountId: Decode,
202 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,202 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,
203 C::Api: UniqueRuntimeApi<Block, CrossAccountId, AccountId>,203 C::Api: UniqueRuntimeApi<Block, CrossAccountId, AccountId>,
204 CrossAccountId: frame_common::account::CrossAccountId<AccountId>,204 CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,
205{205{
206 pass_method!(account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId>);206 pass_method!(account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId>);
207 pass_method!(token_exists(collection: CollectionId, token: TokenId) -> bool);207 pass_method!(token_exists(collection: CollectionId, token: TokenId) -> bool);
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
19use core::ops::{Deref, DerefMut};19use core::ops::{Deref, DerefMut};
20use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};20use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
21use sp_std::vec::Vec;21use sp_std::vec::Vec;
22use frame_common::account::CrossAccountId;22use pallet_evm::account::CrossAccountId;
23use frame_support::{23use frame_support::{
24 dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo},24 dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo},
25 ensure, fail,25 ensure, fail,
162pub mod pallet {162pub mod pallet {
163 use super::*;163 use super::*;
164 use frame_support::{Blake2_128Concat, pallet_prelude::*, storage::Key};164 use frame_support::{Blake2_128Concat, pallet_prelude::*, storage::Key};
165 use frame_common::account::CrossAccountId;165 use pallet_evm::account;
166 use frame_support::traits::Currency;166 use frame_support::traits::Currency;
167 use up_data_structs::TokenId;167 use up_data_structs::TokenId;
168 use scale_info::TypeInfo;168 use scale_info::TypeInfo;
169169
170 #[pallet::config]170 #[pallet::config]
171 pub trait Config: frame_system::Config + pallet_evm_coder_substrate::Config + TypeInfo {171 pub trait Config: frame_system::Config + pallet_evm_coder_substrate::Config + TypeInfo + account::Config {
172 type Event: IsType<<Self as frame_system::Config>::Event> + From<Event<Self>>;172 type Event: IsType<<Self as frame_system::Config>::Event> + From<Event<Self>>;
173
174 type CrossAccountId: CrossAccountId<Self::AccountId>;
175
176 type EvmAddressMapping: pallet_evm::AddressMapping<Self::AccountId>;
177 type EvmBackwardsAddressMapping: up_evm_mapping::EvmBackwardsAddressMapping<Self::AccountId>;
178173
179 type Currency: Currency<Self::AccountId>;174 type Currency: Currency<Self::AccountId>;
180175
modifiedpallets/evm-transaction-payment/src/lib.rsdiffbeforeafterboth
20use fp_evm::WithdrawReason;20use fp_evm::WithdrawReason;
21use frame_support::traits::{Currency, IsSubType};21use frame_support::traits::{Currency, IsSubType};
22pub use pallet::*;22pub use pallet::*;
23use pallet_evm::{EVMCurrencyAdapter, EnsureAddressOrigin};23use pallet_evm::{EVMCurrencyAdapter, EnsureAddressOrigin, account::CrossAccountId};
24use sp_core::{H160, U256};24use sp_core::{H160, U256};
25use sp_runtime::TransactionOutcome;25use sp_runtime::TransactionOutcome;
26use up_sponsorship::SponsorshipHandler;26use up_sponsorship::SponsorshipHandler;
35 use sp_std::vec::Vec;35 use sp_std::vec::Vec;
3636
37 #[pallet::config]37 #[pallet::config]
38 pub trait Config: frame_system::Config {38 pub trait Config: frame_system::Config + pallet_evm::account::Config {
39 type EvmSponsorshipHandler: SponsorshipHandler<Self::AccountId, (H160, Vec<u8>)>;39 type EvmSponsorshipHandler: SponsorshipHandler<Self::AccountId, (H160, Vec<u8>)>;
40 type Currency: Currency<Self::AccountId>;40 type Currency: Currency<Self::AccountId>;
41 type EvmBackwardsAddressMapping: EvmBackwardsAddressMapping<Self::AccountId>;
42 type EvmAddressMapping: AddressMapping<Self::AccountId>;
43 }41 }
4442
45 #[pallet::pallet]43 #[pallet::pallet]
86 type LiquidityInfo = Option<ChargeEvmLiquidityInfo<T>>;84 type LiquidityInfo = Option<ChargeEvmLiquidityInfo<T>>;
8785
88 fn withdraw_fee(86 fn withdraw_fee(
89 who: &T::AccountId,87 who: &T::CrossAccountId,
90 reason: WithdrawReason,88 reason: WithdrawReason,
91 fee: U256,89 fee: U256,
92 ) -> core::result::Result<Self::LiquidityInfo, pallet_evm::Error<T>> {90 ) -> core::result::Result<Self::LiquidityInfo, pallet_evm::Error<T>> {
93 let mut who_pays_fee = who.clone();91 let who_pays_fee;
94 if let WithdrawReason::Call { target, input } = &reason {92 if let WithdrawReason::Call { target, input } = &reason {
95 who_pays_fee = T::EvmSponsorshipHandler::get_sponsor(who, &(*target, input.clone()))93 who_pays_fee = <T as pallet_evm::account::Config>::CrossAccountId::from_sub(T::EvmSponsorshipHandler::get_sponsor(&who.as_sub(), &(*target, input.clone()))
96 .unwrap_or(who_pays_fee);94 .unwrap_or(who.as_sub().clone()));
97 }95 } else {
96 who_pays_fee = who.clone();
97 }
9898
99 let negative_imbalance = EVMCurrencyAdapter::<<T as Config>::Currency, ()>::withdraw_fee(99 let negative_imbalance = EVMCurrencyAdapter::<<T as Config>::Currency, ()>::withdraw_fee(
100 &who_pays_fee,100 &who_pays_fee,
101 reason,101 reason,
102 fee,102 fee,
103 )?;103 )?;
104104
105 let who_pays_fee_eth = T::EvmBackwardsAddressMapping::from_account_id(who_pays_fee);
106 Ok(negative_imbalance.map(|i| ChargeEvmLiquidityInfo {105 Ok(negative_imbalance.map(|i| ChargeEvmLiquidityInfo {
107 who: who_pays_fee_eth,106 who: who_pays_fee.as_eth().clone(),
108 negative_imbalance: i,107 negative_imbalance: i,
109 }))108 }))
110 }109 }
111110
112 fn correct_and_deposit_fee(111 fn correct_and_deposit_fee(
113 who: &T::AccountId,112 who: &T::CrossAccountId,
114 corrected_fee: U256,113 corrected_fee: U256,
115 already_withdrawn: Self::LiquidityInfo,114 already_withdrawn: Self::LiquidityInfo,
116 ) {115 ) {
117 <EVMCurrencyAdapter<<T as Config>::Currency, ()> as pallet_evm::OnChargeEVMTransaction<T>>::correct_and_deposit_fee(116 <EVMCurrencyAdapter<<T as Config>::Currency, ()> as pallet_evm::OnChargeEVMTransaction<T>>::correct_and_deposit_fee(
118 &already_withdrawn.as_ref().map(|e| T::EvmAddressMapping::into_account_id(e.who)).unwrap_or(who.clone()),117 &already_withdrawn.as_ref().map(|e| T::CrossAccountId::from_eth(e.who)).unwrap_or(who.clone()),
119 corrected_fee,118 corrected_fee,
120 already_withdrawn.map(|e| e.negative_imbalance),119 already_withdrawn.map(|e| e.negative_imbalance),
121 )120 )
modifiedpallets/fungible/Cargo.tomldiffbeforeafterboth
22pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }22pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }
23ethereum = { version = "0.12.0", default-features = false }23ethereum = { version = "0.12.0", default-features = false }
24frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }24frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
25pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.18" }
25scale-info = { version = "2.0.1", default-features = false, features = [26scale-info = { version = "2.0.1", default-features = false, features = [
26 "derive",27 "derive",
27] }28] }
28frame-common = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "feature/300" }
2929
30[features]30[features]
31default = ["std"]31default = ["std"]
40 "ethereum/std",40 "ethereum/std",
41 "pallet-evm-coder-substrate/std",41 "pallet-evm-coder-substrate/std",
42 'frame-benchmarking/std',42 'frame-benchmarking/std',
43 "pallet-evm/std"
43]44]
44runtime-benchmarks = ['frame-benchmarking', 'pallet-common/runtime-benchmarks']45runtime-benchmarks = ['frame-benchmarking', 'pallet-common/runtime-benchmarks']
4546
modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
21use pallet_common::erc::{CommonEvmHandler, PrecompileResult};21use pallet_common::erc::{CommonEvmHandler, PrecompileResult};
22use sp_core::{H160, U256};22use sp_core::{H160, U256};
23use sp_std::vec::Vec;23use sp_std::vec::Vec;
24use frame_common::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};
2626
27use crate::{27use crate::{
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
22use pallet_common::{22use pallet_common::{
23 Error as CommonError, Event as CommonEvent, Pallet as PalletCommon,23 Error as CommonError, Event as CommonEvent, Pallet as PalletCommon,
24};24};
25use frame_common::account::CrossAccountId;25use pallet_evm::account::CrossAccountId;
26use pallet_evm_coder_substrate::WithRecorder;26use pallet_evm_coder_substrate::WithRecorder;
27use sp_core::H160;27use sp_core::H160;
28use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};28use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};
37pub mod erc;37pub mod erc;
38pub mod weights;38pub mod weights;
3939
40pub type CreateItemData<T> = (<T as pallet_common::Config>::CrossAccountId, u128);40pub type CreateItemData<T> = (<T as pallet_evm::account::Config>::CrossAccountId, u128);
41pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;41pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;
4242
43#[frame_support::pallet]43#[frame_support::pallet]
modifiedpallets/nonfungible/Cargo.tomldiffbeforeafterboth
16sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }16sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
17sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }17sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
18sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }18sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
19pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.18" }
19pallet-common = { default-features = false, path = '../common' }20pallet-common = { default-features = false, path = '../common' }
20up-data-structs = { default-features = false, path = '../../primitives/data-structs' }21up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
21evm-coder = { default-features = false, path = '../../crates/evm-coder' }22evm-coder = { default-features = false, path = '../../crates/evm-coder' }
25scale-info = { version = "2.0.1", default-features = false, features = [26scale-info = { version = "2.0.1", default-features = false, features = [
26 "derive",27 "derive",
27] }28] }
28frame-common = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "feature/300" }
2929
30[features]30[features]
31default = ["std"]31default = ["std"]
40 "ethereum/std",40 "ethereum/std",
41 "pallet-evm-coder-substrate/std",41 "pallet-evm-coder-substrate/std",
42 'frame-benchmarking/std',42 'frame-benchmarking/std',
43 "pallet-evm/std"
43]44]
44runtime-benchmarks = [45runtime-benchmarks = [
45 'frame-benchmarking',46 'frame-benchmarking',
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
27use pallet_common::{27use pallet_common::{
28 erc::{CommonEvmHandler, PrecompileResult},28 erc::{CommonEvmHandler, PrecompileResult},
29};29};
30use frame_common::account::CrossAccountId;30use pallet_evm::account::CrossAccountId;
31use pallet_evm_coder_substrate::call;31use pallet_evm_coder_substrate::call;
3232
33use crate::{33use crate::{
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
24use pallet_common::{24use pallet_common::{
25 Error as CommonError, Pallet as PalletCommon, Event as CommonEvent,25 Error as CommonError, Pallet as PalletCommon, Event as CommonEvent,
26};26};
27use frame_common::account::CrossAccountId;27use pallet_evm::account::CrossAccountId;
28use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};28use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
29use sp_core::H160;29use sp_core::H160;
30use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};30use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};
41pub mod erc;41pub mod erc;
42pub mod weights;42pub mod weights;
4343
44pub type CreateItemData<T> = CreateNftExData<<T as pallet_common::Config>::CrossAccountId>;44pub type CreateItemData<T> = CreateNftExData<<T as pallet_evm::account::Config>::CrossAccountId>;
45pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;45pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;
4646
47#[derive(Encode, Decode, TypeInfo, MaxEncodedLen)]47#[derive(Encode, Decode, TypeInfo, MaxEncodedLen)]
modifiedpallets/refungible/Cargo.tomldiffbeforeafterboth
16sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }16sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
17sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }17sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
18sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }18sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
19pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.18" }
19pallet-common = { default-features = false, path = '../common' }20pallet-common = { default-features = false, path = '../common' }
20up-data-structs = { default-features = false, path = '../../primitives/data-structs' }21up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
21frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }22frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
22scale-info = { version = "2.0.1", default-features = false, features = [23scale-info = { version = "2.0.1", default-features = false, features = [
23 "derive",24 "derive",
24] }25] }
25frame-common = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "feature/300" }
2626
27[features]27[features]
28default = ["std"]28default = ["std"]
34 "up-data-structs/std",34 "up-data-structs/std",
35 "pallet-common/std",35 "pallet-common/std",
36 'frame-benchmarking/std',36 'frame-benchmarking/std',
37 "pallet-evm/std",
37]38]
38runtime-benchmarks = [39runtime-benchmarks = [
39 'frame-benchmarking',40 'frame-benchmarking',
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
24use pallet_common::{24use pallet_common::{
25 Error as CommonError, Event as CommonEvent, Pallet as PalletCommon,25 Error as CommonError, Event as CommonEvent, Pallet as PalletCommon,
26};26};
27use frame_common::account::CrossAccountId;27use pallet_evm::account::CrossAccountId;
28use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};28use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};
29use sp_std::{vec::Vec, vec, collections::btree_map::BTreeMap};29use sp_std::{vec::Vec, vec, collections::btree_map::BTreeMap};
30use core::ops::Deref;30use core::ops::Deref;
modifiedpallets/unique/Cargo.tomldiffbeforeafterboth
133133
134up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.18' }134up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.18' }
135up-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "feature/300" }135up-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "feature/300" }
136frame-common = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "feature/300" }
137evm-coder = { default-features = false, path = "../../crates/evm-coder" }136evm-coder = { default-features = false, path = "../../crates/evm-coder" }
138pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }137pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
139primitive-types = { version = "0.11.1", default-features = false, features = [138primitive-types = { version = "0.11.1", default-features = false, features = [
modifiedpallets/unique/src/eth/sponsoring.rsdiffbeforeafterboth
25use core::marker::PhantomData;25use core::marker::PhantomData;
26use core::convert::TryInto;26use core::convert::TryInto;
27use up_data_structs::TokenId;27use up_data_structs::TokenId;
28use frame_common::account::CrossAccountId;28use pallet_evm::account::CrossAccountId;
2929
30use pallet_nonfungible::erc::{UniqueNFTCall, ERC721UniqueExtensionsCall, ERC721Call};30use pallet_nonfungible::erc::{UniqueNFTCall, ERC721UniqueExtensionsCall, ERC721Call};
31use pallet_fungible::erc::{UniqueFungibleCall, ERC20Call};31use pallet_fungible::erc::{UniqueFungibleCall, ERC20Call};
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
57 CollectionHandle, Pallet as PalletCommon, Error as CommonError,57 CollectionHandle, Pallet as PalletCommon, Error as CommonError,
58 CommonWeightInfo,58 CommonWeightInfo,
59};59};
60use frame_common::account::CrossAccountId;60use pallet_evm::account::CrossAccountId;
61use pallet_refungible::{Pallet as PalletRefungible, RefungibleHandle};61use pallet_refungible::{Pallet as PalletRefungible, RefungibleHandle};
62use pallet_fungible::{Pallet as PalletFungible, FungibleHandle};62use pallet_fungible::{Pallet as PalletFungible, FungibleHandle};
63use pallet_nonfungible::{Pallet as PalletNonfungible, NonfungibleHandle};63use pallet_nonfungible::{Pallet as PalletNonfungible, NonfungibleHandle};
117 pub enum Event<T>117 pub enum Event<T>
118 where118 where
119 <T as frame_system::Config>::AccountId,119 <T as frame_system::Config>::AccountId,
120 <T as pallet_common::Config>::CrossAccountId,120 <T as pallet_evm::account::Config>::CrossAccountId,
121 {121 {
122 /// Collection sponsor was removed122 /// Collection sponsor was removed
123 ///123 ///
modifiedpallets/unique/src/mock.rsdiffbeforeafterboth
27use frame_system as system;27use frame_system as system;
28use pallet_evm::{AddressMapping, runner::stack::MaybeMirroredLog};28use pallet_evm::{AddressMapping, runner::stack::MaybeMirroredLog};
29use up_evm_mapping::EvmBackwardsAddressMapping;29use up_evm_mapping::EvmBackwardsAddressMapping;
30use frame_common::account::CrossAccountId;30use pallet_evm::account::CrossAccountId;
31use codec::{Encode, Decode, MaxEncodedLen};31use codec::{Encode, Decode, MaxEncodedLen};
32use scale_info::TypeInfo;32use scale_info::TypeInfo;
33use up_data_structs::ConstU32;33use up_data_structs::ConstU32;
192192
193impl pallet_common::Config for Test {193impl pallet_common::Config for Test {
194 type Event = ();194 type Event = ();
195 type EvmBackwardsAddressMapping = TestEvmBackwardsAddressMapping;
196 type EvmAddressMapping = TestEvmAddressMapping;
197 type CrossAccountId = TestCrossAccountId;
198
199 type Currency = Balances;195 type Currency = Balances;
200 type CollectionCreationPrice = CollectionCreationPrice;196 type CollectionCreationPrice = CollectionCreationPrice;
201 type TreasuryAccountId = TreasuryAccountId;197 type TreasuryAccountId = TreasuryAccountId;
202}198}
199
200impl pallet_evm::account::Config for Test {
201 type CrossAccountId = TestCrossAccountId;
202 type EvmAddressMapping = TestEvmAddressMapping;
203 type EvmBackwardsAddressMapping = TestEvmBackwardsAddressMapping;
204}
203205
204impl pallet_fungible::Config for Test {206impl pallet_fungible::Config for Test {
205 type WeightInfo = ();207 type WeightInfo = ();
modifiedpallets/unique/src/sponsorship.rsdiffbeforeafterboth
30 NFT_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, TokenId,30 NFT_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, TokenId,
31};31};
32use pallet_common::{CollectionHandle};32use pallet_common::{CollectionHandle};
33use frame_common::account::CrossAccountId;33use pallet_evm::account::CrossAccountId;
3434
35pub fn withdraw_transfer<T: Config>(35pub fn withdraw_transfer<T: Config>(
36 collection: &CollectionHandle<T>,36 collection: &CollectionHandle<T>,
modifiedprimitives/rpc/src/lib.rsdiffbeforeafterboth
28 #[api_version(2)]28 #[api_version(2)]
29 pub trait UniqueApi<CrossAccountId, AccountId> where29 pub trait UniqueApi<CrossAccountId, AccountId> where
30 AccountId: Decode,30 AccountId: Decode,
31 CrossAccountId: frame_common::account::CrossAccountId<AccountId>,31 CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,
32 {32 {
33 #[changed_in(2)]33 #[changed_in(2)]
34 fn token_owner(collection: CollectionId, token: TokenId) -> Result<CrossAccountId>;34 fn token_owner(collection: CollectionId, token: TokenId) -> Result<CrossAccountId>;
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
127 }127 }
128}128}
129
130/// The type for looking up accounts. We don't expect more than 4 billion of them, but you
131/// never know...
132pub type AccountIndex = u32;
133
134/// Balance of an account.
135pub type Balance = u128;
136
137/// Index of a transaction in the chain.
138pub type Index = u32;
139
140/// A hash of some data used by the chain.
141pub type Hash = sp_core::H256;
142
143/// Digest item type.
144pub type DigestItem = generic::DigestItem;
129145
130/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know146/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
131/// the specifics of the runtime. They can then be made to be agnostic over specific formats147/// the specifics of the runtime. They can then be made to be agnostic over specific formats
256 }272 }
257}273}
274
275impl pallet_evm::account::Config for Runtime {
276 type CrossAccountId = pallet_evm::account::BasicCrossAccountId<Self>;
277 type EvmAddressMapping = pallet_evm::HashedAddressMapping<Self::Hashing>;
278 type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;
279}
258280
259impl pallet_evm::Config for Runtime {281impl pallet_evm::Config for Runtime {
260 type BlockGasLimit = BlockGasLimit;282 type BlockGasLimit = BlockGasLimit;
285 type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;307 type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;
286}308}
287
288impl frame_common::account::Config for Runtime {
289 type EvmAddressMapping = pallet_evm::HashedAddressMapping<Self::Hashing>;
290 type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;
291}
292309
293pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);310pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);
294impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {311impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {
848865
849impl pallet_common::Config for Runtime {866impl pallet_common::Config for Runtime {
850 type Event = Event;867 type Event = Event;
851 type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;
852 type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;
853 type CrossAccountId = frame_common::account::BasicCrossAccountId<Self>;
854
855 type Currency = Balances;868 type Currency = Balances;
856 type CollectionCreationPrice = CollectionCreationPrice;869 type CollectionCreationPrice = CollectionCreationPrice;
915impl pallet_evm_transaction_payment::Config for Runtime {928impl pallet_evm_transaction_payment::Config for Runtime {
916 type EvmSponsorshipHandler = EvmSponsorshipHandler;929 type EvmSponsorshipHandler = EvmSponsorshipHandler;
917 type Currency = Balances;930 type Currency = Balances;
918 type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;
919 type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;
920}931}
921932
922impl pallet_charge_transaction::Config for Runtime {933impl pallet_charge_transaction::Config for Runtime {