git.delta.rocks / unique-network / refs/commits / 90b12dae5069

difftreelog

misk: Remove some warnings. Add over_max_size test

Trubnikov Sergey2022-10-28parent: #0257bf0.patch.diff
in: master

12 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2347,6 +2347,7 @@
  "sha3-const",
  "similar-asserts",
  "sp-std",
+ "trybuild",
 ]
 
 [[package]]
@@ -12671,6 +12672,21 @@
 ]
 
 [[package]]
+name = "trybuild"
+version = "1.0.71"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ea496675d71016e9bc76aa42d87f16aefd95447cc5818e671e12b2d7e269075d"
+dependencies = [
+ "glob",
+ "once_cell",
+ "serde",
+ "serde_derive",
+ "serde_json",
+ "termcolor",
+ "toml",
+]
+
+[[package]]
 name = "tt-call"
 version = "1.0.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
modifiedcrates/evm-coder/Cargo.tomldiffbeforeafterboth
--- a/crates/evm-coder/Cargo.toml
+++ b/crates/evm-coder/Cargo.toml
@@ -29,6 +29,7 @@
 hex-literal = "0.3.4"
 similar-asserts = "1.4.2"
 concat-idents = "1.1.3"
+trybuild = "1.0"
 
 [features]
 default = ["std"]
modifiedcrates/evm-coder/src/custom_signature.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/custom_signature.rs
+++ b/crates/evm-coder/src/custom_signature.rs
@@ -423,15 +423,6 @@
 		assert_eq!(<MaxSize>::name(), "!".repeat(SIGNATURE_SIZE_LIMIT));
 	}
 
-	// This test must NOT compile with "index out of bounds"!
-	// #[test]
-	// fn over_max_size() {
-	// 	assert_eq!(
-	// 		<Vec<MaxSize>>::name(),
-	// 		"!".repeat(SIGNATURE_SIZE_LIMIT) + "[]"
-	// 	);
-	// }
-
 	#[test]
 	fn make_func_without_args() {
 		const SIG: FunctionSignature = make_signature!(
@@ -498,4 +489,10 @@
 	fn shift() {
 		assert_eq!(<(u32,)>::name(), "(uint32)");
 	}
+
+	#[test]
+	fn over_max_size() {
+		let t = trybuild::TestCases::new();
+		t.compile_fail("tests/build_failed/custom_signature_over_max_size.rs");
+	}
 }
addedcrates/evm-coder/tests/build_failed/custom_signature_over_max_size.rsdiffbeforeafterboth
--- /dev/null
+++ b/crates/evm-coder/tests/build_failed/custom_signature_over_max_size.rs
@@ -0,0 +1,33 @@
+#![allow(dead_code)]
+use std::str::from_utf8;
+
+use evm_coder::{
+	make_signature,
+	custom_signature::{SignatureUnit, SIGNATURE_SIZE_LIMIT},
+};
+
+trait Name {
+	const SIGNATURE: SignatureUnit;
+
+	fn name() -> &'static str {
+		from_utf8(&Self::SIGNATURE.data[..Self::SIGNATURE.len]).expect("bad utf-8")
+	}
+}
+
+impl<T: Name> Name for Vec<T> {
+	evm_coder::make_signature!(new nameof(T) fixed("[]"));
+}
+
+struct MaxSize();
+impl Name for MaxSize {
+	const SIGNATURE: SignatureUnit = SignatureUnit {
+		data: [b'!'; SIGNATURE_SIZE_LIMIT],
+		len: SIGNATURE_SIZE_LIMIT,
+	};
+}
+
+const NAME: SignatureUnit = <Vec<MaxSize>>::SIGNATURE;
+
+fn main() {
+	assert!(false);
+}
addedcrates/evm-coder/tests/build_failed/custom_signature_over_max_size.stderrdiffbeforeafterboth
--- /dev/null
+++ b/crates/evm-coder/tests/build_failed/custom_signature_over_max_size.stderr
@@ -0,0 +1,19 @@
+error: any use of this value will cause an error
+  --> tests/build_failed/custom_signature_over_max_size.rs:18:2
+   |
+18 |     evm_coder::make_signature!(new nameof(T) fixed("[]"));
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 256 but the index is 256
+   |
+   = note: `#[deny(const_err)]` on by default
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
+   = note: this error originates in the macro `make_signature` which comes from the expansion of the macro `evm_coder::make_signature` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: any use of this value will cause an error
+  --> tests/build_failed/custom_signature_over_max_size.rs:29:29
+   |
+29 | const NAME: SignatureUnit = <Vec<MaxSize>>::SIGNATURE;
+   | -------------------------   ^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -35,10 +35,7 @@
 
 use crate::{
 	Pallet, CollectionHandle, Config, CollectionProperties, SelfWeightOf,
-	eth::{
-		convert_cross_account_to_uint256, convert_cross_account_to_tuple,
-		convert_tuple_to_cross_account,
-	},
+	eth::{convert_cross_account_to_uint256, convert_tuple_to_cross_account},
 	weights::WeightInfo,
 };
 
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -17,7 +17,6 @@
 //! Implementation of magic contract
 
 extern crate alloc;
-use alloc::string::ToString;
 use core::marker::PhantomData;
 use evm_coder::{
 	abi::AbiWriter,
modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
before · pallets/fungible/src/erc.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//! ERC-20 standart support implementation.1819extern crate alloc;20use core::char::{REPLACEMENT_CHARACTER, decode_utf16};21use core::convert::TryInto;22use evm_coder::{23	ToLog,24	execution::*,25	generate_stubgen, solidity_interface,26	types::*,27	weight,28	custom_signature::{SignatureUnit, FunctionSignature, SignaturePreferences},29	make_signature,30};31use pallet_common::eth::convert_tuple_to_cross_account;32use up_data_structs::CollectionMode;33use pallet_common::erc::{CommonEvmHandler, PrecompileResult};34use sp_std::vec::Vec;35use pallet_evm::{account::CrossAccountId, PrecompileHandle};36use pallet_evm_coder_substrate::{call, dispatch_to_evm};37use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};38use pallet_common::{CollectionHandle, erc::CollectionCall};3940use crate::{41	Allowance, Balance, Config, FungibleHandle, Pallet, SelfWeightOf, TotalSupply,42	weights::WeightInfo,43};4445#[derive(ToLog)]46pub enum ERC20Events {47	Transfer {48		#[indexed]49		from: address,50		#[indexed]51		to: address,52		value: uint256,53	},54	Approval {55		#[indexed]56		owner: address,57		#[indexed]58		spender: address,59		value: uint256,60	},61}6263#[solidity_interface(name = ERC20, events(ERC20Events))]64impl<T: Config> FungibleHandle<T> {65	fn name(&self) -> Result<string> {66		Ok(decode_utf16(self.name.iter().copied())67			.map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))68			.collect::<string>())69	}70	fn symbol(&self) -> Result<string> {71		Ok(string::from_utf8_lossy(&self.token_prefix).into())72	}73	fn total_supply(&self) -> Result<uint256> {74		self.consume_store_reads(1)?;75		Ok(<TotalSupply<T>>::get(self.id).into())76	}7778	fn decimals(&self) -> Result<uint8> {79		Ok(if let CollectionMode::Fungible(decimals) = &self.mode {80			*decimals81		} else {82			unreachable!()83		})84	}85	fn balance_of(&self, owner: address) -> Result<uint256> {86		self.consume_store_reads(1)?;87		let owner = T::CrossAccountId::from_eth(owner);88		let balance = <Balance<T>>::get((self.id, owner));89		Ok(balance.into())90	}91	#[weight(<SelfWeightOf<T>>::transfer())]92	fn transfer(&mut self, caller: caller, to: address, amount: uint256) -> Result<bool> {93		let caller = T::CrossAccountId::from_eth(caller);94		let to = T::CrossAccountId::from_eth(to);95		let amount = amount.try_into().map_err(|_| "amount overflow")?;96		let budget = self97			.recorder98			.weight_calls_budget(<StructureWeight<T>>::find_parent());99100		<Pallet<T>>::transfer(self, &caller, &to, amount, &budget).map_err(|_| "transfer error")?;101		Ok(true)102	}103	#[weight(<SelfWeightOf<T>>::transfer_from())]104	fn transfer_from(105		&mut self,106		caller: caller,107		from: address,108		to: address,109		amount: uint256,110	) -> Result<bool> {111		let caller = T::CrossAccountId::from_eth(caller);112		let from = T::CrossAccountId::from_eth(from);113		let to = T::CrossAccountId::from_eth(to);114		let amount = amount.try_into().map_err(|_| "amount overflow")?;115		let budget = self116			.recorder117			.weight_calls_budget(<StructureWeight<T>>::find_parent());118119		<Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)120			.map_err(dispatch_to_evm::<T>)?;121		Ok(true)122	}123	#[weight(<SelfWeightOf<T>>::approve())]124	fn approve(&mut self, caller: caller, spender: address, amount: uint256) -> Result<bool> {125		let caller = T::CrossAccountId::from_eth(caller);126		let spender = T::CrossAccountId::from_eth(spender);127		let amount = amount.try_into().map_err(|_| "amount overflow")?;128129		<Pallet<T>>::set_allowance(self, &caller, &spender, amount)130			.map_err(dispatch_to_evm::<T>)?;131		Ok(true)132	}133	fn allowance(&self, owner: address, spender: address) -> Result<uint256> {134		self.consume_store_reads(1)?;135		let owner = T::CrossAccountId::from_eth(owner);136		let spender = T::CrossAccountId::from_eth(spender);137138		Ok(<Allowance<T>>::get((self.id, owner, spender)).into())139	}140}141142#[solidity_interface(name = ERC20Mintable)]143impl<T: Config> FungibleHandle<T> {144	/// Mint tokens for `to` account.145	/// @param to account that will receive minted tokens146	/// @param amount amount of tokens to mint147	#[weight(<SelfWeightOf<T>>::create_item())]148	fn mint(&mut self, caller: caller, to: address, amount: uint256) -> Result<bool> {149		let caller = T::CrossAccountId::from_eth(caller);150		let to = T::CrossAccountId::from_eth(to);151		let amount = amount.try_into().map_err(|_| "amount overflow")?;152		let budget = self153			.recorder154			.weight_calls_budget(<StructureWeight<T>>::find_parent());155		<Pallet<T>>::create_item(&self, &caller, (to, amount), &budget)156			.map_err(dispatch_to_evm::<T>)?;157		Ok(true)158	}159}160161#[solidity_interface(name = ERC20UniqueExtensions)]162impl<T: Config> FungibleHandle<T>163where164	T::AccountId: From<[u8; 32]>,165{166	#[weight(<SelfWeightOf<T>>::approve())]167	fn approve_cross(168		&mut self,169		caller: caller,170		spender: EthCrossAccount,171		amount: uint256,172	) -> Result<bool> {173		let caller = T::CrossAccountId::from_eth(caller);174		let spender = spender.into_sub_cross_account::<T>()?;175		let amount = amount.try_into().map_err(|_| "amount overflow")?;176177		<Pallet<T>>::set_allowance(self, &caller, &spender, amount)178			.map_err(dispatch_to_evm::<T>)?;179		Ok(true)180	}181182	/// Burn tokens from account183	/// @dev Function that burns an `amount` of the tokens of a given account,184	/// deducting from the sender's allowance for said account.185	/// @param from The account whose tokens will be burnt.186	/// @param amount The amount that will be burnt.187	#[weight(<SelfWeightOf<T>>::burn_from())]188	fn burn_from(&mut self, caller: caller, from: address, amount: uint256) -> Result<bool> {189		let caller = T::CrossAccountId::from_eth(caller);190		let from = T::CrossAccountId::from_eth(from);191		let amount = amount.try_into().map_err(|_| "amount overflow")?;192		let budget = self193			.recorder194			.weight_calls_budget(<StructureWeight<T>>::find_parent());195196		<Pallet<T>>::burn_from(self, &caller, &from, amount, &budget)197			.map_err(dispatch_to_evm::<T>)?;198		Ok(true)199	}200201	/// Burn tokens from account202	/// @dev Function that burns an `amount` of the tokens of a given account,203	/// deducting from the sender's allowance for said account.204	/// @param from The account whose tokens will be burnt.205	/// @param amount The amount that will be burnt.206	#[weight(<SelfWeightOf<T>>::burn_from())]207	fn burn_from_cross(208		&mut self,209		caller: caller,210		from: EthCrossAccount,211		amount: uint256,212	) -> Result<bool> {213		let caller = T::CrossAccountId::from_eth(caller);214		let from = from.into_sub_cross_account::<T>()?;215		let amount = amount.try_into().map_err(|_| "amount overflow")?;216		let budget = self217			.recorder218			.weight_calls_budget(<StructureWeight<T>>::find_parent());219220		<Pallet<T>>::burn_from(self, &caller, &from, amount, &budget)221			.map_err(dispatch_to_evm::<T>)?;222		Ok(true)223	}224225	/// Mint tokens for multiple accounts.226	/// @param amounts array of pairs of account address and amount227	#[weight(<SelfWeightOf<T>>::create_multiple_items_ex(amounts.len() as u32))]228	fn mint_bulk(&mut self, caller: caller, amounts: Vec<(address, uint256)>) -> Result<bool> {229		let caller = T::CrossAccountId::from_eth(caller);230		let budget = self231			.recorder232			.weight_calls_budget(<StructureWeight<T>>::find_parent());233		let amounts = amounts234			.into_iter()235			.map(|(to, amount)| {236				Ok((237					T::CrossAccountId::from_eth(to),238					amount.try_into().map_err(|_| "amount overflow")?,239				))240			})241			.collect::<Result<_>>()?;242243		<Pallet<T>>::create_multiple_items(&self, &caller, amounts, &budget)244			.map_err(dispatch_to_evm::<T>)?;245		Ok(true)246	}247248	#[weight(<SelfWeightOf<T>>::transfer_from())]249	fn transfer_from_cross(250		&mut self,251		caller: caller,252		from: EthCrossAccount,253		to: EthCrossAccount,254		amount: uint256,255	) -> Result<bool> {256		let caller = T::CrossAccountId::from_eth(caller);257		let from = from.into_sub_cross_account::<T>()?;258		let to = to.into_sub_cross_account::<T>()?;259		let amount = amount.try_into().map_err(|_| "amount overflow")?;260		let budget = self261			.recorder262			.weight_calls_budget(<StructureWeight<T>>::find_parent());263264		<Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)265			.map_err(dispatch_to_evm::<T>)?;266		Ok(true)267	}268}269270#[solidity_interface(271	name = UniqueFungible,272	is(273		ERC20,274		ERC20Mintable,275		ERC20UniqueExtensions,276		Collection(via(common_mut returns CollectionHandle<T>)),277	)278)]279impl<T: Config> FungibleHandle<T> where T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]> {}280281generate_stubgen!(gen_impl, UniqueFungibleCall<()>, true);282generate_stubgen!(gen_iface, UniqueFungibleCall<()>, false);283284impl<T: Config> CommonEvmHandler for FungibleHandle<T>285where286	T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]>,287{288	const CODE: &'static [u8] = include_bytes!("./stubs/UniqueFungible.raw");289290	fn call(self, handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {291		call::<T, UniqueFungibleCall<T>, _, _>(handle, self)292	}293}
after · pallets/fungible/src/erc.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//! ERC-20 standart support implementation.1819extern crate alloc;20use core::char::{REPLACEMENT_CHARACTER, decode_utf16};21use core::convert::TryInto;22use evm_coder::{23	ToLog,24	execution::*,25	generate_stubgen, solidity_interface,26	types::*,27	weight,28	custom_signature::{SignatureUnit, FunctionSignature, SignaturePreferences},29	make_signature,30};31use up_data_structs::CollectionMode;32use pallet_common::erc::{CommonEvmHandler, PrecompileResult};33use sp_std::vec::Vec;34use pallet_evm::{account::CrossAccountId, PrecompileHandle};35use pallet_evm_coder_substrate::{call, dispatch_to_evm};36use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};37use pallet_common::{CollectionHandle, erc::CollectionCall};3839use crate::{40	Allowance, Balance, Config, FungibleHandle, Pallet, SelfWeightOf, TotalSupply,41	weights::WeightInfo,42};4344#[derive(ToLog)]45pub enum ERC20Events {46	Transfer {47		#[indexed]48		from: address,49		#[indexed]50		to: address,51		value: uint256,52	},53	Approval {54		#[indexed]55		owner: address,56		#[indexed]57		spender: address,58		value: uint256,59	},60}6162#[solidity_interface(name = ERC20, events(ERC20Events))]63impl<T: Config> FungibleHandle<T> {64	fn name(&self) -> Result<string> {65		Ok(decode_utf16(self.name.iter().copied())66			.map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))67			.collect::<string>())68	}69	fn symbol(&self) -> Result<string> {70		Ok(string::from_utf8_lossy(&self.token_prefix).into())71	}72	fn total_supply(&self) -> Result<uint256> {73		self.consume_store_reads(1)?;74		Ok(<TotalSupply<T>>::get(self.id).into())75	}7677	fn decimals(&self) -> Result<uint8> {78		Ok(if let CollectionMode::Fungible(decimals) = &self.mode {79			*decimals80		} else {81			unreachable!()82		})83	}84	fn balance_of(&self, owner: address) -> Result<uint256> {85		self.consume_store_reads(1)?;86		let owner = T::CrossAccountId::from_eth(owner);87		let balance = <Balance<T>>::get((self.id, owner));88		Ok(balance.into())89	}90	#[weight(<SelfWeightOf<T>>::transfer())]91	fn transfer(&mut self, caller: caller, to: address, amount: uint256) -> Result<bool> {92		let caller = T::CrossAccountId::from_eth(caller);93		let to = T::CrossAccountId::from_eth(to);94		let amount = amount.try_into().map_err(|_| "amount overflow")?;95		let budget = self96			.recorder97			.weight_calls_budget(<StructureWeight<T>>::find_parent());9899		<Pallet<T>>::transfer(self, &caller, &to, amount, &budget).map_err(|_| "transfer error")?;100		Ok(true)101	}102	#[weight(<SelfWeightOf<T>>::transfer_from())]103	fn transfer_from(104		&mut self,105		caller: caller,106		from: address,107		to: address,108		amount: uint256,109	) -> Result<bool> {110		let caller = T::CrossAccountId::from_eth(caller);111		let from = T::CrossAccountId::from_eth(from);112		let to = T::CrossAccountId::from_eth(to);113		let amount = amount.try_into().map_err(|_| "amount overflow")?;114		let budget = self115			.recorder116			.weight_calls_budget(<StructureWeight<T>>::find_parent());117118		<Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)119			.map_err(dispatch_to_evm::<T>)?;120		Ok(true)121	}122	#[weight(<SelfWeightOf<T>>::approve())]123	fn approve(&mut self, caller: caller, spender: address, amount: uint256) -> Result<bool> {124		let caller = T::CrossAccountId::from_eth(caller);125		let spender = T::CrossAccountId::from_eth(spender);126		let amount = amount.try_into().map_err(|_| "amount overflow")?;127128		<Pallet<T>>::set_allowance(self, &caller, &spender, amount)129			.map_err(dispatch_to_evm::<T>)?;130		Ok(true)131	}132	fn allowance(&self, owner: address, spender: address) -> Result<uint256> {133		self.consume_store_reads(1)?;134		let owner = T::CrossAccountId::from_eth(owner);135		let spender = T::CrossAccountId::from_eth(spender);136137		Ok(<Allowance<T>>::get((self.id, owner, spender)).into())138	}139}140141#[solidity_interface(name = ERC20Mintable)]142impl<T: Config> FungibleHandle<T> {143	/// Mint tokens for `to` account.144	/// @param to account that will receive minted tokens145	/// @param amount amount of tokens to mint146	#[weight(<SelfWeightOf<T>>::create_item())]147	fn mint(&mut self, caller: caller, to: address, amount: uint256) -> Result<bool> {148		let caller = T::CrossAccountId::from_eth(caller);149		let to = T::CrossAccountId::from_eth(to);150		let amount = amount.try_into().map_err(|_| "amount overflow")?;151		let budget = self152			.recorder153			.weight_calls_budget(<StructureWeight<T>>::find_parent());154		<Pallet<T>>::create_item(&self, &caller, (to, amount), &budget)155			.map_err(dispatch_to_evm::<T>)?;156		Ok(true)157	}158}159160#[solidity_interface(name = ERC20UniqueExtensions)]161impl<T: Config> FungibleHandle<T>162where163	T::AccountId: From<[u8; 32]>,164{165	#[weight(<SelfWeightOf<T>>::approve())]166	fn approve_cross(167		&mut self,168		caller: caller,169		spender: EthCrossAccount,170		amount: uint256,171	) -> Result<bool> {172		let caller = T::CrossAccountId::from_eth(caller);173		let spender = spender.into_sub_cross_account::<T>()?;174		let amount = amount.try_into().map_err(|_| "amount overflow")?;175176		<Pallet<T>>::set_allowance(self, &caller, &spender, amount)177			.map_err(dispatch_to_evm::<T>)?;178		Ok(true)179	}180181	/// Burn tokens from account182	/// @dev Function that burns an `amount` of the tokens of a given account,183	/// deducting from the sender's allowance for said account.184	/// @param from The account whose tokens will be burnt.185	/// @param amount The amount that will be burnt.186	#[weight(<SelfWeightOf<T>>::burn_from())]187	fn burn_from(&mut self, caller: caller, from: address, amount: uint256) -> Result<bool> {188		let caller = T::CrossAccountId::from_eth(caller);189		let from = T::CrossAccountId::from_eth(from);190		let amount = amount.try_into().map_err(|_| "amount overflow")?;191		let budget = self192			.recorder193			.weight_calls_budget(<StructureWeight<T>>::find_parent());194195		<Pallet<T>>::burn_from(self, &caller, &from, amount, &budget)196			.map_err(dispatch_to_evm::<T>)?;197		Ok(true)198	}199200	/// Burn tokens from account201	/// @dev Function that burns an `amount` of the tokens of a given account,202	/// deducting from the sender's allowance for said account.203	/// @param from The account whose tokens will be burnt.204	/// @param amount The amount that will be burnt.205	#[weight(<SelfWeightOf<T>>::burn_from())]206	fn burn_from_cross(207		&mut self,208		caller: caller,209		from: EthCrossAccount,210		amount: uint256,211	) -> Result<bool> {212		let caller = T::CrossAccountId::from_eth(caller);213		let from = from.into_sub_cross_account::<T>()?;214		let amount = amount.try_into().map_err(|_| "amount overflow")?;215		let budget = self216			.recorder217			.weight_calls_budget(<StructureWeight<T>>::find_parent());218219		<Pallet<T>>::burn_from(self, &caller, &from, amount, &budget)220			.map_err(dispatch_to_evm::<T>)?;221		Ok(true)222	}223224	/// Mint tokens for multiple accounts.225	/// @param amounts array of pairs of account address and amount226	#[weight(<SelfWeightOf<T>>::create_multiple_items_ex(amounts.len() as u32))]227	fn mint_bulk(&mut self, caller: caller, amounts: Vec<(address, uint256)>) -> Result<bool> {228		let caller = T::CrossAccountId::from_eth(caller);229		let budget = self230			.recorder231			.weight_calls_budget(<StructureWeight<T>>::find_parent());232		let amounts = amounts233			.into_iter()234			.map(|(to, amount)| {235				Ok((236					T::CrossAccountId::from_eth(to),237					amount.try_into().map_err(|_| "amount overflow")?,238				))239			})240			.collect::<Result<_>>()?;241242		<Pallet<T>>::create_multiple_items(&self, &caller, amounts, &budget)243			.map_err(dispatch_to_evm::<T>)?;244		Ok(true)245	}246247	#[weight(<SelfWeightOf<T>>::transfer_from())]248	fn transfer_from_cross(249		&mut self,250		caller: caller,251		from: EthCrossAccount,252		to: EthCrossAccount,253		amount: uint256,254	) -> Result<bool> {255		let caller = T::CrossAccountId::from_eth(caller);256		let from = from.into_sub_cross_account::<T>()?;257		let to = to.into_sub_cross_account::<T>()?;258		let amount = amount.try_into().map_err(|_| "amount overflow")?;259		let budget = self260			.recorder261			.weight_calls_budget(<StructureWeight<T>>::find_parent());262263		<Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)264			.map_err(dispatch_to_evm::<T>)?;265		Ok(true)266	}267}268269#[solidity_interface(270	name = UniqueFungible,271	is(272		ERC20,273		ERC20Mintable,274		ERC20UniqueExtensions,275		Collection(via(common_mut returns CollectionHandle<T>)),276	)277)]278impl<T: Config> FungibleHandle<T> where T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]> {}279280generate_stubgen!(gen_impl, UniqueFungibleCall<()>, true);281generate_stubgen!(gen_iface, UniqueFungibleCall<()>, false);282283impl<T: Config> CommonEvmHandler for FungibleHandle<T>284where285	T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]>,286{287	const CODE: &'static [u8] = include_bytes!("./stubs/UniqueFungible.raw");288289	fn call(self, handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {290		call::<T, UniqueFungibleCall<T>, _, _>(handle, self)291	}292}
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -21,7 +21,6 @@
 
 extern crate alloc;
 
-use alloc::string::ToString;
 use core::{
 	char::{REPLACEMENT_CHARACTER, decode_utf16},
 	convert::TryInto,
@@ -39,7 +38,6 @@
 use pallet_common::{
 	CollectionHandle, CollectionPropertyPermissions,
 	erc::{CommonEvmHandler, CollectionCall, static_property::key},
-	eth::convert_tuple_to_cross_account,
 };
 use pallet_evm::{account::CrossAccountId, PrecompileHandle};
 use pallet_evm_coder_substrate::{call, dispatch_to_evm};
modifiedpallets/unique/src/eth/mod.rsdiffbeforeafterboth
--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -42,10 +42,7 @@
 	CreateCollectionData,
 };
 
-use crate::{
-	weights::WeightInfo, Config, SelfWeightOf, NftTransferBasket, FungibleTransferBasket,
-	ReFungibleTransferBasket, NftApproveBasket, FungibleApproveBasket, RefungibleApproveBasket,
-};
+use crate::{weights::WeightInfo, Config, SelfWeightOf};
 
 use alloc::format;
 use sp_std::vec::Vec;
modifiedruntime/common/config/pallets/scheduler.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/scheduler.rs
+++ b/runtime/common/config/pallets/scheduler.rs
@@ -25,7 +25,7 @@
 use codec::Decode;
 use crate::{
 	runtime_common::{scheduler::SchedulerPaymentExecutor, config::substrate::RuntimeBlockWeights},
-	Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, OriginCaller, Balances,
+	Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, OriginCaller,
 };
 use pallet_unique_scheduler_v2::ScheduledEnsureOriginSuccess;
 use up_common::types::AccountId;
modifiedruntime/common/scheduler.rsdiffbeforeafterboth
--- a/runtime/common/scheduler.rs
+++ b/runtime/common/scheduler.rs
@@ -14,19 +14,16 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use frame_support::{
-	traits::NamedReservableCurrency,
-	dispatch::{GetDispatchInfo, PostDispatchInfo, DispatchInfo},
-};
+use frame_support::dispatch::{GetDispatchInfo, PostDispatchInfo, DispatchInfo};
 use sp_runtime::{
 	traits::{Dispatchable, Applyable, Member},
 	generic::Era,
 	transaction_validity::TransactionValidityError,
-	DispatchErrorWithPostInfo, DispatchError,
+	DispatchErrorWithPostInfo,
 };
 use codec::Encode;
-use crate::{Runtime, RuntimeCall, RuntimeOrigin, Balances};
-use up_common::types::{AccountId, Balance};
+use crate::{Runtime, RuntimeCall, RuntimeOrigin};
+use up_common::types::AccountId;
 use fp_self_contained::SelfContainedCall;
 use pallet_unique_scheduler_v2::DispatchCall;
 use pallet_transaction_payment::ChargeTransactionPayment;