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

difftreelog

style remove unused

Yaroslav Bolyukin2022-06-03parent: #3f6fffb.patch.diff
in: master

6 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -21,7 +21,6 @@
 };
 pub use pallet_evm::{PrecompileOutput, PrecompileResult, PrecompileHandle, account::CrossAccountId};
 use pallet_evm_coder_substrate::dispatch_to_evm;
-use sp_core::{H160, U256};
 use sp_std::vec::Vec;
 use up_data_structs::{Property, SponsoringRateLimit};
 use alloc::format;
modifiedpallets/evm-migration/src/lib.rsdiffbeforeafterboth
before · pallets/evm-migration/src/lib.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617#![cfg_attr(not(feature = "std"), no_std)]1819pub use pallet::*;20#[cfg(feature = "runtime-benchmarks")]21pub mod benchmarking;22pub mod weights;2324#[frame_support::pallet]25pub mod pallet {26	use frame_support::{pallet_prelude::*, transactional};27	use frame_system::pallet_prelude::*;28	use sp_core::{H160, H256};29	use sp_std::vec::Vec;30	use super::weights::WeightInfo;31	use pallet_evm::{PrecompileHandle, Pallet as PalletEvm};3233	#[pallet::config]34	pub trait Config: frame_system::Config + pallet_evm::Config {35		type WeightInfo: WeightInfo;36	}3738	type SelfWeightOf<T> = <T as Config>::WeightInfo;3940	#[pallet::pallet]41	#[pallet::generate_store(pub(super) trait Store)]42	pub struct Pallet<T>(_);4344	#[pallet::error]45	pub enum Error<T> {46		AccountNotEmpty,47		AccountIsNotMigrating,48	}4950	#[pallet::storage]51	pub(super) type MigrationPending<T: Config> =52		StorageMap<Hasher = Twox64Concat, Key = H160, Value = bool, QueryKind = ValueQuery>;5354	#[pallet::call]55	impl<T: Config> Pallet<T> {56		#[pallet::weight(<SelfWeightOf<T>>::begin())]57		pub fn begin(origin: OriginFor<T>, address: H160) -> DispatchResult {58			ensure_root(origin)?;59			ensure!(60				<PalletEvm<T>>::is_account_empty(&address) && !<MigrationPending<T>>::get(&address),61				<Error<T>>::AccountNotEmpty,62			);6364			<MigrationPending<T>>::insert(address, true);65			Ok(())66		}6768		#[pallet::weight(<SelfWeightOf<T>>::set_data(data.len() as u32))]69		pub fn set_data(70			origin: OriginFor<T>,71			address: H160,72			data: Vec<(H256, H256)>,73		) -> DispatchResult {74			ensure_root(origin)?;75			ensure!(76				<MigrationPending<T>>::get(&address),77				<Error<T>>::AccountIsNotMigrating,78			);7980			for (k, v) in data {81				<pallet_evm::AccountStorages<T>>::insert(&address, k, v);82			}83			Ok(())84		}8586		#[pallet::weight(<SelfWeightOf<T>>::finish(code.len() as u32))]87		#[transactional]88		pub fn finish(origin: OriginFor<T>, address: H160, code: Vec<u8>) -> DispatchResult {89			ensure_root(origin)?;90			ensure!(91				<MigrationPending<T>>::get(&address),92				<Error<T>>::AccountIsNotMigrating,93			);9495			<pallet_evm::AccountCodes<T>>::insert(&address, code);96			<MigrationPending<T>>::remove(address);97			Ok(())98		}99	}100101	pub struct OnMethodCall<T>(PhantomData<T>);102	impl<T: Config> pallet_evm::OnMethodCall<T> for OnMethodCall<T> {103		fn is_reserved(contract: &H160) -> bool {104			<MigrationPending<T>>::get(&contract)105		}106107		fn is_used(_contract: &H160) -> bool {108			false109		}110111		fn call(handle: &mut impl PrecompileHandle) -> Option<pallet_evm::PrecompileResult> {112			None113		}114115		fn get_code(_contract: &H160) -> Option<Vec<u8>> {116			None117		}118	}119}
after · pallets/evm-migration/src/lib.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617#![cfg_attr(not(feature = "std"), no_std)]1819pub use pallet::*;20#[cfg(feature = "runtime-benchmarks")]21pub mod benchmarking;22pub mod weights;2324#[frame_support::pallet]25pub mod pallet {26	use frame_support::{pallet_prelude::*, transactional};27	use frame_system::pallet_prelude::*;28	use sp_core::{H160, H256};29	use sp_std::vec::Vec;30	use super::weights::WeightInfo;31	use pallet_evm::{PrecompileHandle, Pallet as PalletEvm};3233	#[pallet::config]34	pub trait Config: frame_system::Config + pallet_evm::Config {35		type WeightInfo: WeightInfo;36	}3738	type SelfWeightOf<T> = <T as Config>::WeightInfo;3940	#[pallet::pallet]41	#[pallet::generate_store(pub(super) trait Store)]42	pub struct Pallet<T>(_);4344	#[pallet::error]45	pub enum Error<T> {46		AccountNotEmpty,47		AccountIsNotMigrating,48	}4950	#[pallet::storage]51	pub(super) type MigrationPending<T: Config> =52		StorageMap<Hasher = Twox64Concat, Key = H160, Value = bool, QueryKind = ValueQuery>;5354	#[pallet::call]55	impl<T: Config> Pallet<T> {56		#[pallet::weight(<SelfWeightOf<T>>::begin())]57		pub fn begin(origin: OriginFor<T>, address: H160) -> DispatchResult {58			ensure_root(origin)?;59			ensure!(60				<PalletEvm<T>>::is_account_empty(&address) && !<MigrationPending<T>>::get(&address),61				<Error<T>>::AccountNotEmpty,62			);6364			<MigrationPending<T>>::insert(address, true);65			Ok(())66		}6768		#[pallet::weight(<SelfWeightOf<T>>::set_data(data.len() as u32))]69		pub fn set_data(70			origin: OriginFor<T>,71			address: H160,72			data: Vec<(H256, H256)>,73		) -> DispatchResult {74			ensure_root(origin)?;75			ensure!(76				<MigrationPending<T>>::get(&address),77				<Error<T>>::AccountIsNotMigrating,78			);7980			for (k, v) in data {81				<pallet_evm::AccountStorages<T>>::insert(&address, k, v);82			}83			Ok(())84		}8586		#[pallet::weight(<SelfWeightOf<T>>::finish(code.len() as u32))]87		#[transactional]88		pub fn finish(origin: OriginFor<T>, address: H160, code: Vec<u8>) -> DispatchResult {89			ensure_root(origin)?;90			ensure!(91				<MigrationPending<T>>::get(&address),92				<Error<T>>::AccountIsNotMigrating,93			);9495			<pallet_evm::AccountCodes<T>>::insert(&address, code);96			<MigrationPending<T>>::remove(address);97			Ok(())98		}99	}100101	pub struct OnMethodCall<T>(PhantomData<T>);102	impl<T: Config> pallet_evm::OnMethodCall<T> for OnMethodCall<T> {103		fn is_reserved(contract: &H160) -> bool {104			<MigrationPending<T>>::get(&contract)105		}106107		fn is_used(_contract: &H160) -> bool {108			false109		}110111		fn call(_handle: &mut impl PrecompileHandle) -> Option<pallet_evm::PrecompileResult> {112			None113		}114115		fn get_code(_contract: &H160) -> Option<Vec<u8>> {116			None117		}118	}119}
modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -19,7 +19,6 @@
 use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight};
 use up_data_structs::CollectionMode;
 use pallet_common::erc::{CommonEvmHandler, PrecompileResult};
-use sp_core::{H160, U256};
 use sp_std::vec::Vec;
 use pallet_evm::{account::CrossAccountId, PrecompileHandle};
 use pallet_evm_coder_substrate::{call, dispatch_to_evm};
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -26,7 +26,6 @@
 	CollectionPropertiesVec,
 };
 use pallet_evm_coder_substrate::dispatch_to_evm;
-use sp_core::{H160, U256};
 use sp_std::vec::Vec;
 use pallet_common::{
 	erc::{CommonEvmHandler, PrecompileResult, CollectionCall, token_uri_key},
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -25,7 +25,7 @@
 
 	fn call(
 		self,
-		handle: &mut impl PrecompileHandle,
+		_handle: &mut impl PrecompileHandle,
 	) -> Option<pallet_common::erc::PrecompileResult> {
 		// TODO: Implement RFT variant of ERC721
 		None
@@ -39,7 +39,7 @@
 
 	fn call(
 		self,
-		handle: &mut impl PrecompileHandle,
+		_handle: &mut impl PrecompileHandle,
 	) -> Option<pallet_common::erc::PrecompileResult> {
 		// TODO: Implement RFT variant of ERC20
 		None
modifiedruntime/common/src/dispatch.rsdiffbeforeafterboth
--- a/runtime/common/src/dispatch.rs
+++ b/runtime/common/src/dispatch.rs
@@ -1,6 +1,6 @@
 use frame_support::{dispatch::DispatchResult, ensure};
 use pallet_evm::{PrecompileHandle, PrecompileResult};
-use sp_core::{H160, U256};
+use sp_core::H160;
 use sp_std::{borrow::ToOwned, vec::Vec};
 use pallet_common::{
 	CollectionById, CollectionHandle, CommonCollectionOperations, erc::CommonEvmHandler,