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

difftreelog

ci fix clippy warnings

Yaroslav Bolyukin2021-06-28parent: #93b1982.patch.diff
in: master

13 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5996,34 +5996,34 @@
 [[package]]
 name = "pallet-scheduler"
 version = "3.0.0"
-source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.3#c94e0cdfe5556680dca1996004751eeb114755d7"
 dependencies = [
  "frame-benchmarking",
  "frame-support",
  "frame-system",
  "log",
  "parity-scale-codec 2.1.3",
+ "serde",
+ "sp-core",
  "sp-io",
  "sp-runtime",
  "sp-std",
+ "substrate-test-utils",
+ "up-sponsorship",
 ]
 
 [[package]]
 name = "pallet-scheduler"
 version = "3.0.0"
+source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.3#c94e0cdfe5556680dca1996004751eeb114755d7"
 dependencies = [
  "frame-benchmarking",
  "frame-support",
  "frame-system",
  "log",
  "parity-scale-codec 2.1.3",
- "serde",
- "sp-core",
  "sp-io",
  "sp-runtime",
  "sp-std",
- "substrate-test-utils",
- "up-sponsorship",
 ]
 
 [[package]]
modifiedcrates/evm-coder-macros/src/solidity_interface.rsdiffbeforeafterboth
--- a/crates/evm-coder-macros/src/solidity_interface.rs
+++ b/crates/evm-coder-macros/src/solidity_interface.rs
@@ -264,7 +264,7 @@
 			ReturnType::Type(_, ty) => ty,
 			_ => return Err(syn::Error::new(value.sig.output.span(), "interface method should return Result<value>\nif there is no value to return - specify void (which is alias to unit)")),
 		};
-		let result = parse_result_ok(&result)?;
+		let result = parse_result_ok(result)?;
 
 		let camel_name = info
 			.rename_selector
@@ -285,8 +285,8 @@
 		Ok(Self {
 			name: ident.clone(),
 			camel_name,
-			pascal_name: snake_ident_to_pascal(&ident),
-			screaming_name: snake_ident_to_screaming(&ident),
+			pascal_name: snake_ident_to_pascal(ident),
+			screaming_name: snake_ident_to_screaming(ident),
 			selector_str,
 			selector,
 			args,
@@ -433,7 +433,7 @@
 						found_error = true;
 					}
 				}
-				TraitItem::Method(method) => methods.push(Method::try_from(&method)?),
+				TraitItem::Method(method) => methods.push(Method::try_from(method)?),
 				_ => {}
 			}
 		}
modifiedcrates/evm-coder-macros/src/to_log.rsdiffbeforeafterboth
--- a/crates/evm-coder-macros/src/to_log.rs
+++ b/crates/evm-coder-macros/src/to_log.rs
@@ -41,7 +41,7 @@
 impl Event {
 	fn try_from(variant: &Variant) -> syn::Result<Self> {
 		let name = &variant.ident;
-		let name_screaming = snake_ident_to_screaming(&name);
+		let name_screaming = snake_ident_to_screaming(name);
 
 		let named = match &variant.fields {
 			Fields::Named(named) => named,
@@ -54,7 +54,7 @@
 		};
 		let mut fields = Vec::new();
 		for field in &named.named {
-			fields.push(EventField::try_from(&field)?);
+			fields.push(EventField::try_from(field)?);
 		}
 		let mut selector_str = format!("{}(", name);
 		for (i, arg) in fields.iter().enumerate() {
modifiedcrates/evm-coder/src/abi.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/abi.rs
+++ b/crates/evm-coder/src/abi.rs
@@ -104,7 +104,7 @@
 	fn subresult(&mut self) -> Result<AbiReader<'i>> {
 		let offset = self.read_usize()?;
 		Ok(AbiReader {
-			buf: &self.buf,
+			buf: self.buf,
 			offset: offset + self.offset,
 		})
 	}
@@ -252,7 +252,7 @@
 impl_abi_writeable!(&str, string);
 impl AbiWrite for &string {
 	fn abi_write(&self, writer: &mut AbiWriter) {
-		writer.string(&self)
+		writer.string(self)
 	}
 }
 
modifiednode/cli/src/cli.rsdiffbeforeafterboth
--- a/node/cli/src/cli.rs
+++ b/node/cli/src/cli.rs
@@ -1,6 +1,4 @@
 use crate::chain_spec;
-use cumulus_client_cli;
-use sc_cli;
 use std::path::PathBuf;
 use structopt::StructOpt;
 
modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -120,8 +120,7 @@
 	}
 
 	fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
-		polkadot_cli::Cli::from_iter([RelayChainCli::executable_name().to_string()].iter())
-			.load_spec(id)
+		polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id)
 	}
 
 	fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
@@ -129,6 +128,7 @@
 	}
 }
 
+#[allow(clippy::borrowed_box)]
 fn extract_genesis_wasm(chain_spec: &Box<dyn sc_service::ChainSpec>) -> Result<Vec<u8>> {
 	let mut storage = chain_spec.build_storage()?;
 
@@ -189,7 +189,7 @@
 			runner.sync_run(|config| {
 				let polkadot_cli = RelayChainCli::new(
 					&config,
-					[RelayChainCli::executable_name().to_string()]
+					[RelayChainCli::executable_name()]
 						.iter()
 						.chain(cli.relaychain_args.iter()),
 				);
@@ -275,7 +275,7 @@
 
 				let polkadot_cli = RelayChainCli::new(
 					&config,
-					[RelayChainCli::executable_name().to_string()]
+					[RelayChainCli::executable_name()]
 						.iter()
 						.chain(cli.relaychain_args.iter()),
 				);
modifiednode/cli/src/service.rsdiffbeforeafterboth
--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -141,7 +141,7 @@
 
 	let (client, backend, keystore_container, task_manager) =
 		sc_service::new_full_parts::<Block, RuntimeApi, Executor>(
-			&config,
+			config,
 			telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
 		)?;
 	let client = Arc::new(client);
modifiedpallets/contract-helpers/src/lib.rsdiffbeforeafterboth
--- a/pallets/contract-helpers/src/lib.rs
+++ b/pallets/contract-helpers/src/lib.rs
@@ -213,7 +213,7 @@
 					Ok(Some((who.clone(), *code_hash, salt.clone())))
 				}
 				Some(pallet_contracts::Call::instantiate_with_code(_, _, code, _, salt)) => {
-					let code_hash = &T::Hashing::hash(&code);
+					let code_hash = &T::Hashing::hash(code);
 					Ok(Some((who.clone(), *code_hash, salt.clone())))
 				}
 				_ => Ok(None),
modifiedpallets/nft/src/eth/erc_impl.rsdiffbeforeafterboth
--- a/pallets/nft/src/eth/erc_impl.rs
+++ b/pallets/nft/src/eth/erc_impl.rs
@@ -114,7 +114,7 @@
 		let to = T::CrossAccountId::from_eth(to);
 		let token_id = token_id.try_into().map_err(|_| "token_id overflow")?;
 
-		<Module<T>>::transfer_from_internal(&caller, &from, &to, &self, token_id, 1)
+		<Module<T>>::transfer_from_internal(&caller, &from, &to, self, token_id, 1)
 			.map_err(|_| "transferFrom error")?;
 		Ok(())
 	}
@@ -130,7 +130,7 @@
 		let approved = T::CrossAccountId::from_eth(approved);
 		let token_id = token_id.try_into().map_err(|_| "token_id overflow")?;
 
-		<Module<T>>::approve_internal(&caller, &approved, &self, token_id, 1)
+		<Module<T>>::approve_internal(&caller, &approved, self, token_id, 1)
 			.map_err(|_| "approve internal")?;
 		Ok(())
 	}
@@ -176,7 +176,7 @@
 		let to = T::CrossAccountId::from_eth(to);
 		let token_id = token_id.try_into().map_err(|_| "amount overflow")?;
 
-		<Module<T>>::transfer_internal(&caller, &to, &self, token_id, 1)
+		<Module<T>>::transfer_internal(&caller, &to, self, token_id, 1)
 			.map_err(|_| "transfer error")?;
 		Ok(())
 	}
@@ -226,7 +226,7 @@
 		let to = T::CrossAccountId::from_eth(to);
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
 
-		<Module<T>>::transfer_internal(&caller, &to, &self, 1, amount)
+		<Module<T>>::transfer_internal(&caller, &to, self, 1, amount)
 			.map_err(|_| "transfer error")?;
 		Ok(true)
 	}
@@ -242,7 +242,7 @@
 		let to = T::CrossAccountId::from_eth(to);
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
 
-		<Module<T>>::transfer_from_internal(&caller, &from, &to, &self, 1, amount)
+		<Module<T>>::transfer_from_internal(&caller, &from, &to, self, 1, amount)
 			.map_err(|_| "transferFrom error")?;
 		Ok(true)
 	}
@@ -251,7 +251,7 @@
 		let spender = T::CrossAccountId::from_eth(spender);
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
 
-		<Module<T>>::approve_internal(&caller, &spender, &self, 1, amount)
+		<Module<T>>::approve_internal(&caller, &spender, self, 1, amount)
 			.map_err(|_| "approve internal")?;
 		Ok(true)
 	}
modifiedpallets/nft/src/eth/mod.rsdiffbeforeafterboth
before · pallets/nft/src/eth/mod.rs
1pub mod account;2pub mod erc;3mod erc_impl;4pub mod log;5pub mod sponsoring;67use evm_coder::abi::AbiWriter;8use evm_coder::abi::StringError;9use sp_std::prelude::*;10use sp_std::borrow::ToOwned;11use sp_std::vec::Vec;1213use pallet_evm::{PrecompileOutput, ExitReason, ExitRevert, ExitSucceed};14use sp_core::{H160, U256};15use frame_support::storage::StorageMap;1617use crate::{Config, CollectionById, CollectionHandle, CollectionId, CollectionMode};1819use erc::{UniqueFungible, UniqueFungibleCall, UniqueNFT, UniqueNFTCall};20use evm_coder::{types::*, abi::AbiReader};2122pub struct NftErcSupport<T: Config>(core::marker::PhantomData<T>);2324// 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection25// TODO: Unhardcode prefix26const ETH_ACCOUNT_PREFIX: [u8; 16] = [27	0x17, 0xc4, 0xe6, 0x45, 0x3c, 0xc4, 0x9a, 0xaa, 0xae, 0xac, 0xa8, 0x94, 0xe6, 0xd9, 0x68, 0x3e,28];2930fn map_eth_to_id(eth: &H160) -> Option<CollectionId> {31	if eth[0..16] != ETH_ACCOUNT_PREFIX {32		return None;33	}34	let mut id_bytes = [0; 4];35	id_bytes.copy_from_slice(&eth[16..20]);36	Some(u32::from_be_bytes(id_bytes))37}38pub fn collection_id_to_address(id: u32) -> H160 {39	let mut out = [0; 20];40	out[0..16].copy_from_slice(&ETH_ACCOUNT_PREFIX);41	out[16..20].copy_from_slice(&u32::to_be_bytes(id));42	H160(out)43}4445fn call_internal<T: Config>(46	collection: &mut CollectionHandle<T>,47	caller: caller,48	method_id: u32,49	mut input: AbiReader,50	value: U256,51) -> Result<Option<AbiWriter>, evm_coder::abi::StringError> {52	match collection.mode.clone() {53		CollectionMode::Fungible(_) => {54			#[cfg(feature = "std")]55			{56				println!("Parse fungible call {:x}", method_id);57			}58			let call = match UniqueFungibleCall::parse(method_id, &mut input)? {59				Some(v) => v,60				None => {61					#[cfg(feature = "std")]62					{63						println!("Method not found");64					}65					return Ok(None);66				}67			};68			#[cfg(feature = "std")]69			{70				dbg!(&call);71			}72			Ok(Some(<CollectionHandle<T> as UniqueFungible>::call(73				collection,74				Msg {75					call,76					caller,77					value,78				},79			)?))80		}81		CollectionMode::NFT => {82			let call = match UniqueNFTCall::parse(method_id, &mut input)? {83				Some(v) => v,84				None => return Ok(None),85			};86			Ok(Some(<CollectionHandle<T> as UniqueNFT>::call(87				collection,88				Msg {89					call,90					caller,91					value,92				},93			)?))94		}95		_ => Err(StringError::from(96			"erc calls only supported to fungible and nft collections for now",97		)),98	}99}100101impl<T: Config> pallet_evm::OnMethodCall<T> for NftErcSupport<T> {102	fn is_reserved(target: &H160) -> bool {103		map_eth_to_id(target).is_some()104	}105	fn is_used(target: &H160) -> bool {106		map_eth_to_id(target)107			.map(<CollectionById<T>>::contains_key)108			.unwrap_or(false)109	}110	fn get_code(target: &H160) -> Option<Vec<u8>> {111		map_eth_to_id(&target)112			.and_then(<CollectionById<T>>::get)113			.map(|collection| {114				match collection.mode {115					CollectionMode::NFT => include_bytes!("stubs/ERC721.bin") as &[u8],116					CollectionMode::Fungible(_) => include_bytes!("stubs/ERC20.bin") as &[u8],117					CollectionMode::ReFungible => include_bytes!("stubs/ERC1633.bin") as &[u8],118					CollectionMode::Invalid => include_bytes!("stubs/Invalid.bin") as &[u8],119				}120				.to_owned()121			})122	}123	fn call(124		source: &H160,125		target: &H160,126		gas_limit: u64,127		input: &[u8],128		value: U256,129	) -> Option<PrecompileOutput> {130		let mut collection = map_eth_to_id(&target)131			.and_then(|id| <CollectionHandle<T>>::get_with_gas_limit(id, gas_limit))?;132		let (method_id, input) = AbiReader::new_call(input).unwrap();133		let result = call_internal(&mut collection, *source, method_id, input, value);134		let cost = gas_limit - collection.gas_left();135		let logs = collection.logs.retrieve_logs();136		match result {137			Ok(Some(v)) => Some(PrecompileOutput {138				exit_status: ExitReason::Succeed(ExitSucceed::Returned),139				cost,140				logs,141				output: v.finish(),142			}),143			Ok(None) => None,144			Err(e) => Some(PrecompileOutput {145				exit_status: ExitReason::Revert(ExitRevert::Reverted),146				cost: 0,147				logs: Default::default(),148				output: AbiWriter::from(e).finish(),149			}),150		}151	}152}153154// TODO: This function is slow, and output can be memoized155pub fn generate_transaction(collection_id: u32, chain_id: u64) -> ethereum::Transaction {156	// FIXME: Can be done on wasm runtime with https://github.com/paritytech/substrate/pull/8728157	#[cfg(feature = "std")]158	{159		let contract = collection_id_to_address(collection_id);160		let signed = ethereum_tx_sign::RawTransaction {161			nonce: 0.into(),162			to: Some(contract.0.into()),163			value: 0.into(),164			gas_price: 0.into(),165			gas: 0.into(),166			// zero selector, this transaction always have same sender, so all data should be acquired from logs167			data: Vec::from([0, 0, 0, 0]),168		}169		.sign(170			// TODO: move to pallet config171			// 0xF70631E55faff9f3FD3681545aa6c724226a3853172			// 9dbaef9b3ebc00e53f67c6a77bcfbf2c4f2aebe4d70d94af4f2df01744b7a91a173			&hex_literal::hex!("9dbaef9b3ebc00e53f67c6a77bcfbf2c4f2aebe4d70d94af4f2df01744b7a91a")174				.into(),175			&chain_id,176		);177		rlp::decode::<ethereum::Transaction>(&signed)178			.expect("transaction is just created, it can't be broken")179	}180	#[cfg(not(feature = "std"))]181	{182		panic!("transaction generation not yet supported by wasm runtime while generating transaction for collection_id {}, chain_id {}", collection_id, chain_id)183	}184}
after · pallets/nft/src/eth/mod.rs
1pub mod account;2pub mod erc;3mod erc_impl;4pub mod log;5pub mod sponsoring;67use evm_coder::abi::AbiWriter;8use evm_coder::abi::StringError;9use sp_std::prelude::*;10use sp_std::borrow::ToOwned;11use sp_std::vec::Vec;1213use pallet_evm::{PrecompileOutput, ExitReason, ExitRevert, ExitSucceed};14use sp_core::{H160, U256};15use frame_support::storage::StorageMap;1617use crate::{Config, CollectionById, CollectionHandle, CollectionId, CollectionMode};1819use erc::{UniqueFungible, UniqueFungibleCall, UniqueNFT, UniqueNFTCall};20use evm_coder::{types::*, abi::AbiReader};2122pub struct NftErcSupport<T: Config>(core::marker::PhantomData<T>);2324// 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection25// TODO: Unhardcode prefix26const ETH_ACCOUNT_PREFIX: [u8; 16] = [27	0x17, 0xc4, 0xe6, 0x45, 0x3c, 0xc4, 0x9a, 0xaa, 0xae, 0xac, 0xa8, 0x94, 0xe6, 0xd9, 0x68, 0x3e,28];2930fn map_eth_to_id(eth: &H160) -> Option<CollectionId> {31	if eth[0..16] != ETH_ACCOUNT_PREFIX {32		return None;33	}34	let mut id_bytes = [0; 4];35	id_bytes.copy_from_slice(&eth[16..20]);36	Some(u32::from_be_bytes(id_bytes))37}38pub fn collection_id_to_address(id: u32) -> H160 {39	let mut out = [0; 20];40	out[0..16].copy_from_slice(&ETH_ACCOUNT_PREFIX);41	out[16..20].copy_from_slice(&u32::to_be_bytes(id));42	H160(out)43}4445fn call_internal<T: Config>(46	collection: &mut CollectionHandle<T>,47	caller: caller,48	method_id: u32,49	mut input: AbiReader,50	value: U256,51) -> Result<Option<AbiWriter>, evm_coder::abi::StringError> {52	match collection.mode.clone() {53		CollectionMode::Fungible(_) => {54			#[cfg(feature = "std")]55			{56				println!("Parse fungible call {:x}", method_id);57			}58			let call = match UniqueFungibleCall::parse(method_id, &mut input)? {59				Some(v) => v,60				None => {61					#[cfg(feature = "std")]62					{63						println!("Method not found");64					}65					return Ok(None);66				}67			};68			#[cfg(feature = "std")]69			{70				dbg!(&call);71			}72			Ok(Some(<CollectionHandle<T> as UniqueFungible>::call(73				collection,74				Msg {75					call,76					caller,77					value,78				},79			)?))80		}81		CollectionMode::NFT => {82			let call = match UniqueNFTCall::parse(method_id, &mut input)? {83				Some(v) => v,84				None => return Ok(None),85			};86			Ok(Some(<CollectionHandle<T> as UniqueNFT>::call(87				collection,88				Msg {89					call,90					caller,91					value,92				},93			)?))94		}95		_ => Err(StringError::from(96			"erc calls only supported to fungible and nft collections for now",97		)),98	}99}100101impl<T: Config> pallet_evm::OnMethodCall<T> for NftErcSupport<T> {102	fn is_reserved(target: &H160) -> bool {103		map_eth_to_id(target).is_some()104	}105	fn is_used(target: &H160) -> bool {106		map_eth_to_id(target)107			.map(<CollectionById<T>>::contains_key)108			.unwrap_or(false)109	}110	fn get_code(target: &H160) -> Option<Vec<u8>> {111		map_eth_to_id(target)112			.and_then(<CollectionById<T>>::get)113			.map(|collection| {114				match collection.mode {115					CollectionMode::NFT => include_bytes!("stubs/ERC721.bin") as &[u8],116					CollectionMode::Fungible(_) => include_bytes!("stubs/ERC20.bin") as &[u8],117					CollectionMode::ReFungible => include_bytes!("stubs/ERC1633.bin") as &[u8],118					CollectionMode::Invalid => include_bytes!("stubs/Invalid.bin") as &[u8],119				}120				.to_owned()121			})122	}123	fn call(124		source: &H160,125		target: &H160,126		gas_limit: u64,127		input: &[u8],128		value: U256,129	) -> Option<PrecompileOutput> {130		let mut collection = map_eth_to_id(target)131			.and_then(|id| <CollectionHandle<T>>::get_with_gas_limit(id, gas_limit))?;132		let (method_id, input) = AbiReader::new_call(input).unwrap();133		let result = call_internal(&mut collection, *source, method_id, input, value);134		let cost = gas_limit - collection.gas_left();135		let logs = collection.logs.retrieve_logs();136		match result {137			Ok(Some(v)) => Some(PrecompileOutput {138				exit_status: ExitReason::Succeed(ExitSucceed::Returned),139				cost,140				logs,141				output: v.finish(),142			}),143			Ok(None) => None,144			Err(e) => Some(PrecompileOutput {145				exit_status: ExitReason::Revert(ExitRevert::Reverted),146				cost: 0,147				logs: Default::default(),148				output: AbiWriter::from(e).finish(),149			}),150		}151	}152}153154// TODO: This function is slow, and output can be memoized155pub fn generate_transaction(collection_id: u32, chain_id: u64) -> ethereum::Transaction {156	// FIXME: Can be done on wasm runtime with https://github.com/paritytech/substrate/pull/8728157	#[cfg(feature = "std")]158	{159		let contract = collection_id_to_address(collection_id);160		let signed = ethereum_tx_sign::RawTransaction {161			nonce: 0.into(),162			to: Some(contract.0.into()),163			value: 0.into(),164			gas_price: 0.into(),165			gas: 0.into(),166			// zero selector, this transaction always have same sender, so all data should be acquired from logs167			data: Vec::from([0, 0, 0, 0]),168		}169		.sign(170			// TODO: move to pallet config171			// 0xF70631E55faff9f3FD3681545aa6c724226a3853172			// 9dbaef9b3ebc00e53f67c6a77bcfbf2c4f2aebe4d70d94af4f2df01744b7a91a173			&hex_literal::hex!("9dbaef9b3ebc00e53f67c6a77bcfbf2c4f2aebe4d70d94af4f2df01744b7a91a")174				.into(),175			&chain_id,176		);177		rlp::decode::<ethereum::Transaction>(&signed)178			.expect("transaction is just created, it can't be broken")179	}180	#[cfg(not(feature = "std"))]181	{182		panic!("transaction generation not yet supported by wasm runtime while generating transaction for collection_id {}, chain_id {}", collection_id, chain_id)183	}184}
modifiedpallets/nft/src/eth/sponsoring.rsdiffbeforeafterboth
--- a/pallets/nft/src/eth/sponsoring.rs
+++ b/pallets/nft/src/eth/sponsoring.rs
@@ -132,10 +132,10 @@
 	) -> Result<Self::LiquidityInfo, pallet_evm::Error<T>> {
 		let mut who_pays_fee = *who;
 		if let WithdrawReason::Call { target, input } = &reason {
-			if let Some(collection_id) = crate::eth::map_eth_to_id(&target) {
+			if let Some(collection_id) = crate::eth::map_eth_to_id(target) {
 				if let Some(collection) = <CollectionById<T>>::get(collection_id) {
 					if let Some(sponsor) = collection.sponsorship.sponsor() {
-						if try_sponsor(who, collection_id, &collection, &input).is_ok() {
+						if try_sponsor(who, collection_id, &collection, input).is_ok() {
 							who_pays_fee =
 								T::EvmBackwardsAddressMapping::from_account_id(sponsor.clone());
 						}
modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -1232,7 +1232,7 @@
 		) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			let mut target_collection = Self::get_collection(collection_id)?;
-			Self::check_owner_permissions(&target_collection, &sender.as_sub())?;
+			Self::check_owner_permissions(&target_collection, sender.as_sub())?;
 			let old_limits = &target_collection.limits;
 			let chain_limits = ChainLimit::get();
 
@@ -1267,9 +1267,9 @@
 		owner: &T::CrossAccountId,
 		data: CreateItemData,
 	) -> DispatchResult {
-		Self::can_create_items_in_collection(&collection, &sender, &owner, 1)?;
-		Self::validate_create_item_args(&collection, &data)?;
-		Self::create_item_no_validation(&collection, owner, data)?;
+		Self::can_create_items_in_collection(collection, sender, owner, 1)?;
+		Self::validate_create_item_args(collection, &data)?;
+		Self::create_item_no_validation(collection, owner, data)?;
 
 		Ok(())
 	}
@@ -1283,18 +1283,18 @@
 	) -> DispatchResult {
 		target_collection.consume_gas(2000000)?;
 		// Limits check
-		Self::is_correct_transfer(target_collection, &recipient)?;
+		Self::is_correct_transfer(target_collection, recipient)?;
 
 		// Transfer permissions check
 		ensure!(
-			Self::is_item_owner(&sender, target_collection, item_id)
-				|| Self::is_owner_or_admin_permissions(target_collection, &sender),
+			Self::is_item_owner(sender, target_collection, item_id)
+				|| Self::is_owner_or_admin_permissions(target_collection, sender),
 			Error::<T>::NoPermission
 		);
 
 		if target_collection.access == AccessMode::WhiteList {
-			Self::check_white_list(target_collection, &sender)?;
-			Self::check_white_list(target_collection, &recipient)?;
+			Self::check_white_list(target_collection, sender)?;
+			Self::check_white_list(target_collection, recipient)?;
 		}
 
 		match target_collection.mode {
@@ -1305,7 +1305,7 @@
 				recipient.clone(),
 			)?,
 			CollectionMode::Fungible(_) => {
-				Self::transfer_fungible(target_collection, value, &sender, &recipient)?
+				Self::transfer_fungible(target_collection, value, sender, recipient)?
 			}
 			CollectionMode::ReFungible => Self::transfer_refungible(
 				target_collection,
@@ -1336,23 +1336,23 @@
 		amount: u128,
 	) -> DispatchResult {
 		collection.consume_gas(2000000)?;
-		Self::token_exists(&collection, item_id)?;
+		Self::token_exists(collection, item_id)?;
 
 		// Transfer permissions check
 		let bypasses_limits = collection.limits.owner_can_transfer
-			&& Self::is_owner_or_admin_permissions(&collection, &sender);
+			&& Self::is_owner_or_admin_permissions(collection, sender);
 
 		let allowance_limit = if bypasses_limits {
 			None
-		} else if let Some(amount) = Self::owned_amount(&sender, &collection, item_id) {
+		} else if let Some(amount) = Self::owned_amount(sender, collection, item_id) {
 			Some(amount)
 		} else {
 			fail!(Error::<T>::NoPermission);
 		};
 
 		if collection.access == AccessMode::WhiteList {
-			Self::check_white_list(&collection, &sender)?;
-			Self::check_white_list(&collection, &spender)?;
+			Self::check_white_list(collection, sender)?;
+			Self::check_white_list(collection, spender)?;
 		}
 
 		let allowance: u128 = amount
@@ -1412,19 +1412,19 @@
 			<Allowances<T>>::get(collection.id, (item_id, from.as_sub(), sender.as_sub()));
 
 		// Limits check
-		Self::is_correct_transfer(&collection, &recipient)?;
+		Self::is_correct_transfer(collection, recipient)?;
 
 		// Transfer permissions check
 		ensure!(
 			approval >= amount
 				|| (collection.limits.owner_can_transfer
-					&& Self::is_owner_or_admin_permissions(&collection, &sender)),
+					&& Self::is_owner_or_admin_permissions(collection, sender)),
 			Error::<T>::NoPermission
 		);
 
 		if collection.access == AccessMode::WhiteList {
-			Self::check_white_list(&collection, &sender)?;
-			Self::check_white_list(&collection, &recipient)?;
+			Self::check_white_list(collection, sender)?;
+			Self::check_white_list(collection, recipient)?;
 		}
 
 		// Reduce approval by transferred amount or remove if remaining approval drops to 0
@@ -1441,13 +1441,13 @@
 
 		match collection.mode {
 			CollectionMode::NFT => {
-				Self::transfer_nft(&collection, item_id, from.clone(), recipient.clone())?
+				Self::transfer_nft(collection, item_id, from.clone(), recipient.clone())?
 			}
 			CollectionMode::Fungible(_) => {
-				Self::transfer_fungible(&collection, amount, &from, &recipient)?
+				Self::transfer_fungible(collection, amount, from, recipient)?
 			}
 			CollectionMode::ReFungible => Self::transfer_refungible(
-				&collection,
+				collection,
 				item_id,
 				amount,
 				from.clone(),
@@ -1473,7 +1473,7 @@
 		item_id: TokenId,
 		data: Vec<u8>,
 	) -> DispatchResult {
-		Self::token_exists(&collection, item_id)?;
+		Self::token_exists(collection, item_id)?;
 
 		ensure!(
 			ChainLimit::get().custom_data_limit >= data.len() as u32,
@@ -1482,15 +1482,15 @@
 
 		// Modify permissions check
 		ensure!(
-			Self::is_item_owner(&sender, &collection, item_id)
-				|| Self::is_owner_or_admin_permissions(&collection, &sender),
+			Self::is_item_owner(sender, collection, item_id)
+				|| Self::is_owner_or_admin_permissions(collection, sender),
 			Error::<T>::NoPermission
 		);
 
 		match collection.mode {
-			CollectionMode::NFT => Self::set_nft_variable_data(&collection, item_id, data)?,
+			CollectionMode::NFT => Self::set_nft_variable_data(collection, item_id, data)?,
 			CollectionMode::ReFungible => {
-				Self::set_re_fungible_variable_data(&collection, item_id, data)?
+				Self::set_re_fungible_variable_data(collection, item_id, data)?
 			}
 			CollectionMode::Fungible(_) => fail!(Error::<T>::CantStoreMetadataInFungibleTokens),
 			_ => fail!(Error::<T>::UnexpectedCollectionType),
@@ -1505,18 +1505,13 @@
 		owner: &T::CrossAccountId,
 		items_data: Vec<CreateItemData>,
 	) -> DispatchResult {
-		Self::can_create_items_in_collection(
-			&collection,
-			&sender,
-			&owner,
-			items_data.len() as u32,
-		)?;
+		Self::can_create_items_in_collection(collection, sender, owner, items_data.len() as u32)?;
 
 		for data in &items_data {
-			Self::validate_create_item_args(&collection, data)?;
+			Self::validate_create_item_args(collection, data)?;
 		}
 		for data in &items_data {
-			Self::create_item_no_validation(&collection, owner, data.clone())?;
+			Self::create_item_no_validation(collection, owner, data.clone())?;
 		}
 
 		Ok(())
@@ -1529,22 +1524,20 @@
 		value: u128,
 	) -> DispatchResult {
 		ensure!(
-			Self::is_item_owner(&sender, &collection, item_id)
+			Self::is_item_owner(sender, collection, item_id)
 				|| (collection.limits.owner_can_transfer
-					&& Self::is_owner_or_admin_permissions(&collection, &sender)),
+					&& Self::is_owner_or_admin_permissions(collection, sender)),
 			Error::<T>::NoPermission
 		);
 
 		if collection.access == AccessMode::WhiteList {
-			Self::check_white_list(&collection, &sender)?;
+			Self::check_white_list(collection, sender)?;
 		}
 
 		match collection.mode {
-			CollectionMode::NFT => Self::burn_nft_item(&collection, item_id)?,
-			CollectionMode::Fungible(_) => Self::burn_fungible_item(&sender, &collection, value)?,
-			CollectionMode::ReFungible => {
-				Self::burn_refungible_item(&collection, item_id, &sender)?
-			}
+			CollectionMode::NFT => Self::burn_nft_item(collection, item_id)?,
+			CollectionMode::Fungible(_) => Self::burn_fungible_item(sender, collection, value)?,
+			CollectionMode::ReFungible => Self::burn_refungible_item(collection, item_id, sender)?,
 			_ => (),
 		};
 
@@ -1557,7 +1550,7 @@
 		address: &T::CrossAccountId,
 		whitelisted: bool,
 	) -> DispatchResult {
-		Self::check_owner_or_admin_permissions(&collection, &sender)?;
+		Self::check_owner_or_admin_permissions(collection, sender)?;
 
 		if whitelisted {
 			<WhiteList<T>>::insert(collection.id, address.as_sub(), true);
@@ -1610,7 +1603,7 @@
 			Error::<T>::AccountTokenLimitExceeded
 		);
 
-		if !Self::is_owner_or_admin_permissions(collection, &sender) {
+		if !Self::is_owner_or_admin_permissions(collection, sender) {
 			ensure!(collection.mint_mode, Error::<T>::PublicMintingNotAllowed);
 			Self::check_white_list(collection, owner)?;
 			Self::check_white_list(collection, sender)?;
@@ -1691,7 +1684,7 @@
 				Self::add_nft_item(collection, item)?;
 			}
 			CreateItemData::Fungible(data) => {
-				Self::add_fungible_item(collection, &owner, data.value)?;
+				Self::add_fungible_item(collection, owner, data.value)?;
 			}
 			CreateItemData::ReFungible(data) => {
 				let owner_list = vec![Ownership {
@@ -1934,7 +1927,7 @@
 		subject: &T::CrossAccountId,
 	) -> bool {
 		*subject.as_sub() == collection.owner
-			|| <AdminList<T>>::get(collection.id).contains(&subject)
+			|| <AdminList<T>>::get(collection.id).contains(subject)
 	}
 
 	fn check_owner_or_admin_permissions(
@@ -1979,7 +1972,7 @@
 	) -> bool {
 		match target_collection.mode {
 			CollectionMode::Fungible(_) => true,
-			_ => Self::owned_amount(&subject, target_collection, item_id).is_some(),
+			_ => Self::owned_amount(subject, target_collection, item_id).is_some(),
 		}
 	}
 
modifiedpallets/nft/src/sponsorship.rsdiffbeforeafterboth
--- a/pallets/nft/src/sponsorship.rs
+++ b/pallets/nft/src/sponsorship.rs
@@ -179,14 +179,14 @@
 {
 	fn get_sponsor(who: &T::AccountId, call: &C) -> Option<T::AccountId> {
 		match IsSubType::<Call<T>>::is_sub_type(call)? {
-			Call::create_item(collection_id, _owner, _properties) => {
-				Self::withdraw_create_item(who, collection_id, &_properties)
+			Call::create_item(collection_id, _owner, properties) => {
+				Self::withdraw_create_item(who, collection_id, properties)
 			}
 			Call::transfer(_new_owner, collection_id, item_id, _value) => {
 				Self::withdraw_transfer(who, collection_id, item_id)
 			}
 			Call::set_variable_meta_data(collection_id, item_id, data) => {
-				Self::withdraw_set_variable_meta_data(collection_id, item_id, &data)
+				Self::withdraw_set_variable_meta_data(collection_id, item_id, data)
 			}
 			_ => None,
 		}