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

difftreelog

feat add allowanceCross method

Trubnikov Sergey2023-02-01parent: #0ba1adb.patch.diff
in: master

22 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6360,7 +6360,7 @@
 
 [[package]]
 name = "pallet-fungible"
-version = "0.1.9"
+version = "0.1.10"
 dependencies = [
  "evm-coder",
  "frame-benchmarking",
@@ -6773,7 +6773,7 @@
 
 [[package]]
 name = "pallet-refungible"
-version = "0.2.12"
+version = "0.2.13"
 dependencies = [
  "evm-coder",
  "frame-benchmarking",
modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/fungible/CHANGELOG.md
+++ b/pallets/fungible/CHANGELOG.md
@@ -4,6 +4,12 @@
 
 <!-- bureaucrate goes here -->
 
+## [0.1.10] - 2023-02-01
+
+### Added
+
+- The functions `allowanceCross` to `ERC20UniqueExtensions` interface.
+
 ## [0.1.9] - 2022-12-01
 
 ### Added
modifiedpallets/fungible/Cargo.tomldiffbeforeafterboth
--- a/pallets/fungible/Cargo.toml
+++ b/pallets/fungible/Cargo.toml
@@ -2,7 +2,7 @@
 edition = "2021"
 license = "GPLv3"
 name = "pallet-fungible"
-version = "0.1.9"
+version = "0.1.10"
 
 [dependencies]
 # Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.
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	abi::AbiType, ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*,24	weight,25};26use up_data_structs::CollectionMode;27use pallet_common::{28	CollectionHandle,29	erc::{CommonEvmHandler, PrecompileResult, CollectionCall},30};31use sp_std::vec::Vec;32use pallet_evm::{account::CrossAccountId, PrecompileHandle};33use pallet_evm_coder_substrate::{call, dispatch_to_evm};34use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};35use sp_core::{U256, Get};3637use crate::{38	Allowance, Balance, Config, FungibleHandle, Pallet, SelfWeightOf, TotalSupply,39	weights::WeightInfo,40};4142#[derive(ToLog)]43pub enum ERC20Events {44	Transfer {45		#[indexed]46		from: Address,47		#[indexed]48		to: Address,49		value: U256,50	},51	Approval {52		#[indexed]53		owner: Address,54		#[indexed]55		spender: Address,56		value: U256,57	},58}5960#[solidity_interface(name = ERC20, events(ERC20Events), expect_selector = 0x942e8b22)]61impl<T: Config> FungibleHandle<T> {62	fn name(&self) -> Result<String> {63		Ok(decode_utf16(self.name.iter().copied())64			.map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))65			.collect::<String>())66	}67	fn symbol(&self) -> Result<String> {68		Ok(String::from_utf8_lossy(&self.token_prefix).into())69	}70	fn total_supply(&self) -> Result<U256> {71		self.consume_store_reads(1)?;72		Ok(<TotalSupply<T>>::get(self.id).into())73	}7475	fn decimals(&self) -> Result<u8> {76		Ok(if let CollectionMode::Fungible(decimals) = &self.mode {77			*decimals78		} else {79			unreachable!()80		})81	}82	fn balance_of(&self, owner: Address) -> Result<U256> {83		self.consume_store_reads(1)?;84		let owner = T::CrossAccountId::from_eth(owner);85		let balance = <Balance<T>>::get((self.id, owner));86		Ok(balance.into())87	}88	#[weight(<SelfWeightOf<T>>::transfer())]89	fn transfer(&mut self, caller: Caller, to: Address, amount: U256) -> Result<bool> {90		let caller = T::CrossAccountId::from_eth(caller);91		let to = T::CrossAccountId::from_eth(to);92		let amount = amount.try_into().map_err(|_| "amount overflow")?;93		let budget = self94			.recorder95			.weight_calls_budget(<StructureWeight<T>>::find_parent());9697		<Pallet<T>>::transfer(self, &caller, &to, amount, &budget).map_err(|_| "transfer error")?;98		Ok(true)99	}100101	#[weight(<SelfWeightOf<T>>::transfer_from())]102	fn transfer_from(103		&mut self,104		caller: Caller,105		from: Address,106		to: Address,107		amount: U256,108	) -> Result<bool> {109		let caller = T::CrossAccountId::from_eth(caller);110		let from = T::CrossAccountId::from_eth(from);111		let to = T::CrossAccountId::from_eth(to);112		let amount = amount.try_into().map_err(|_| "amount overflow")?;113		let budget = self114			.recorder115			.weight_calls_budget(<StructureWeight<T>>::find_parent());116117		<Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)118			.map_err(dispatch_to_evm::<T>)?;119		Ok(true)120	}121	#[weight(<SelfWeightOf<T>>::approve())]122	fn approve(&mut self, caller: Caller, spender: Address, amount: U256) -> Result<bool> {123		let caller = T::CrossAccountId::from_eth(caller);124		let spender = T::CrossAccountId::from_eth(spender);125		let amount = amount.try_into().map_err(|_| "amount overflow")?;126127		<Pallet<T>>::set_allowance(self, &caller, &spender, amount)128			.map_err(dispatch_to_evm::<T>)?;129		Ok(true)130	}131	fn allowance(&self, owner: Address, spender: Address) -> Result<U256> {132		self.consume_store_reads(1)?;133		let owner = T::CrossAccountId::from_eth(owner);134		let spender = T::CrossAccountId::from_eth(spender);135136		Ok(<Allowance<T>>::get((self.id, owner, spender)).into())137	}138}139140#[solidity_interface(name = ERC20Mintable)]141impl<T: Config> FungibleHandle<T> {142	/// Mint tokens for `to` account.143	/// @param to account that will receive minted tokens144	/// @param amount amount of tokens to mint145	#[weight(<SelfWeightOf<T>>::create_item())]146	fn mint(&mut self, caller: Caller, to: Address, amount: U256) -> Result<bool> {147		let caller = T::CrossAccountId::from_eth(caller);148		let to = T::CrossAccountId::from_eth(to);149		let amount = amount.try_into().map_err(|_| "amount overflow")?;150		let budget = self151			.recorder152			.weight_calls_budget(<StructureWeight<T>>::find_parent());153		<Pallet<T>>::create_item(&self, &caller, (to, amount), &budget)154			.map_err(dispatch_to_evm::<T>)?;155		Ok(true)156	}157}158159#[solidity_interface(name = ERC20UniqueExtensions)]160impl<T: Config> FungibleHandle<T>161where162	T::AccountId: From<[u8; 32]>,163{164	/// @notice A description for the collection.165	fn description(&self) -> Result<String> {166		Ok(decode_utf16(self.description.iter().copied())167			.map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))168			.collect::<String>())169	}170171	#[weight(<SelfWeightOf<T>>::create_item())]172	fn mint_cross(173		&mut self,174		caller: Caller,175		to: pallet_common::eth::CrossAddress,176		amount: U256,177	) -> Result<bool> {178		let caller = T::CrossAccountId::from_eth(caller);179		let to = to.into_sub_cross_account::<T>()?;180		let amount = amount.try_into().map_err(|_| "amount overflow")?;181		let budget = self182			.recorder183			.weight_calls_budget(<StructureWeight<T>>::find_parent());184		<Pallet<T>>::create_item(&self, &caller, (to, amount), &budget)185			.map_err(dispatch_to_evm::<T>)?;186		Ok(true)187	}188189	#[weight(<SelfWeightOf<T>>::approve())]190	fn approve_cross(191		&mut self,192		caller: Caller,193		spender: pallet_common::eth::CrossAddress,194		amount: U256,195	) -> Result<bool> {196		let caller = T::CrossAccountId::from_eth(caller);197		let spender = spender.into_sub_cross_account::<T>()?;198		let amount = amount.try_into().map_err(|_| "amount overflow")?;199200		<Pallet<T>>::set_allowance(self, &caller, &spender, amount)201			.map_err(dispatch_to_evm::<T>)?;202		Ok(true)203	}204205	/// Burn tokens from account206	/// @dev Function that burns an `amount` of the tokens of a given account,207	/// deducting from the sender's allowance for said account.208	/// @param from The account whose tokens will be burnt.209	/// @param amount The amount that will be burnt.210	#[solidity(hide)]211	#[weight(<SelfWeightOf<T>>::burn_from())]212	fn burn_from(&mut self, caller: Caller, from: Address, amount: U256) -> Result<bool> {213		let caller = T::CrossAccountId::from_eth(caller);214		let from = T::CrossAccountId::from_eth(from);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	/// Burn tokens from account226	/// @dev Function that burns an `amount` of the tokens of a given account,227	/// deducting from the sender's allowance for said account.228	/// @param from The account whose tokens will be burnt.229	/// @param amount The amount that will be burnt.230	#[weight(<SelfWeightOf<T>>::burn_from())]231	fn burn_from_cross(232		&mut self,233		caller: Caller,234		from: pallet_common::eth::CrossAddress,235		amount: U256,236	) -> Result<bool> {237		let caller = T::CrossAccountId::from_eth(caller);238		let from = from.into_sub_cross_account::<T>()?;239		let amount = amount.try_into().map_err(|_| "amount overflow")?;240		let budget = self241			.recorder242			.weight_calls_budget(<StructureWeight<T>>::find_parent());243244		<Pallet<T>>::burn_from(self, &caller, &from, amount, &budget)245			.map_err(dispatch_to_evm::<T>)?;246		Ok(true)247	}248249	/// Mint tokens for multiple accounts.250	/// @param amounts array of pairs of account address and amount251	#[weight(<SelfWeightOf<T>>::create_multiple_items_ex(amounts.len() as u32))]252	fn mint_bulk(&mut self, caller: Caller, amounts: Vec<(Address, U256)>) -> Result<bool> {253		let caller = T::CrossAccountId::from_eth(caller);254		let budget = self255			.recorder256			.weight_calls_budget(<StructureWeight<T>>::find_parent());257		let amounts = amounts258			.into_iter()259			.map(|(to, amount)| {260				Ok((261					T::CrossAccountId::from_eth(to),262					amount.try_into().map_err(|_| "amount overflow")?,263				))264			})265			.collect::<Result<_>>()?;266267		<Pallet<T>>::create_multiple_items(&self, &caller, amounts, &budget)268			.map_err(dispatch_to_evm::<T>)?;269		Ok(true)270	}271272	#[weight(<SelfWeightOf<T>>::transfer())]273	fn transfer_cross(274		&mut self,275		caller: Caller,276		to: pallet_common::eth::CrossAddress,277		amount: U256,278	) -> Result<bool> {279		let caller = T::CrossAccountId::from_eth(caller);280		let to = to.into_sub_cross_account::<T>()?;281		let amount = amount.try_into().map_err(|_| "amount overflow")?;282		let budget = self283			.recorder284			.weight_calls_budget(<StructureWeight<T>>::find_parent());285286		<Pallet<T>>::transfer(self, &caller, &to, amount, &budget).map_err(|_| "transfer error")?;287		Ok(true)288	}289290	#[weight(<SelfWeightOf<T>>::transfer_from())]291	fn transfer_from_cross(292		&mut self,293		caller: Caller,294		from: pallet_common::eth::CrossAddress,295		to: pallet_common::eth::CrossAddress,296		amount: U256,297	) -> Result<bool> {298		let caller = T::CrossAccountId::from_eth(caller);299		let from = from.into_sub_cross_account::<T>()?;300		let to = to.into_sub_cross_account::<T>()?;301		let amount = amount.try_into().map_err(|_| "amount overflow")?;302		let budget = self303			.recorder304			.weight_calls_budget(<StructureWeight<T>>::find_parent());305306		<Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)307			.map_err(dispatch_to_evm::<T>)?;308		Ok(true)309	}310311	/// @notice Returns collection helper contract address312	fn collection_helper_address(&self) -> Result<Address> {313		Ok(T::ContractAddress::get())314	}315}316317#[solidity_interface(318	name = UniqueFungible,319	is(320		ERC20,321		ERC20Mintable,322		ERC20UniqueExtensions,323		Collection(via(common_mut returns CollectionHandle<T>)),324	)325)]326impl<T: Config> FungibleHandle<T> where T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]> {}327328generate_stubgen!(gen_impl, UniqueFungibleCall<()>, true);329generate_stubgen!(gen_iface, UniqueFungibleCall<()>, false);330331impl<T: Config> CommonEvmHandler for FungibleHandle<T>332where333	T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]>,334{335	const CODE: &'static [u8] = include_bytes!("./stubs/UniqueFungible.raw");336337	fn call(self, handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {338		call::<T, UniqueFungibleCall<T>, _, _>(handle, self)339	}340}
modifiedpallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
--- a/pallets/fungible/src/stubs/UniqueFungible.sol
+++ b/pallets/fungible/src/stubs/UniqueFungible.sol
@@ -511,8 +511,22 @@
 	bytes value;
 }
 
-/// @dev the ERC-165 identifier for this interface is 0x65789571
+/// @dev the ERC-165 identifier for this interface is 0x85d7dea6
 contract ERC20UniqueExtensions is Dummy, ERC165 {
+	/// @dev Function to check the amount of tokens that an owner allowed to a spender.
+	/// @param owner crossAddress The address which owns the funds.
+	/// @param spender crossAddress The address which will spend the funds.
+	/// @return A uint256 specifying the amount of tokens still available for the spender.
+	/// @dev EVM selector for this function is: 0xe0af4bd7,
+	///  or in textual repr: allowanceCross((address,uint256),(address,uint256))
+	function allowanceCross(CrossAddress memory owner, CrossAddress memory spender) public view returns (uint256) {
+		require(false, stub_error);
+		owner;
+		spender;
+		dummy;
+		return 0;
+	}
+
 	/// @notice A description for the collection.
 	/// @dev EVM selector for this function is: 0x7284e416,
 	///  or in textual repr: description()
@@ -576,7 +590,7 @@
 	/// @param amounts array of pairs of account address and amount
 	/// @dev EVM selector for this function is: 0x1acf2d55,
 	///  or in textual repr: mintBulk((address,uint256)[])
-	function mintBulk(Tuple9[] memory amounts) public returns (bool) {
+	function mintBulk(Tuple11[] memory amounts) public returns (bool) {
 		require(false, stub_error);
 		amounts;
 		dummy = 0;
@@ -619,7 +633,7 @@
 }
 
 /// @dev anonymous struct
-struct Tuple9 {
+struct Tuple11 {
 	address field_0;
 	uint256 field_1;
 }
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/refungible/CHANGELOG.md
+++ b/pallets/refungible/CHANGELOG.md
@@ -4,6 +4,12 @@
 
 <!-- bureaucrate goes here -->
 
+## [0.2.13] - 2023-02-01
+
+### Added
+
+- The functions `allowanceCross` to `ERC20UniqueExtensions` interface.
+
 ## [0.2.12] - 2023-01-20
 
 ### Fixed
modifiedpallets/refungible/Cargo.tomldiffbeforeafterboth
--- a/pallets/refungible/Cargo.toml
+++ b/pallets/refungible/Cargo.toml
@@ -2,7 +2,7 @@
 edition = "2021"
 license = "GPLv3"
 name = "pallet-refungible"
-version = "0.2.12"
+version = "0.2.13"
 
 [dependencies]
 # Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.
modifiedpallets/refungible/src/erc_token.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc_token.rs
+++ b/pallets/refungible/src/erc_token.rs
@@ -203,6 +203,21 @@
 where
 	T::AccountId: From<[u8; 32]>,
 {
+	/// @dev Function to check the amount of tokens that an owner allowed to a spender.
+	/// @param owner crossAddress The address which owns the funds.
+	/// @param spender crossAddress The address which will spend the funds.
+	/// @return A uint256 specifying the amount of tokens still available for the spender.
+	fn allowance_cross(
+		&self,
+		owner: pallet_common::eth::CrossAddress,
+		spender: pallet_common::eth::CrossAddress,
+	) -> Result<U256> {
+		let owner = owner.into_sub_cross_account::<T>()?;
+		let spender = spender.into_sub_cross_account::<T>()?;
+
+		Ok(<Allowance<T>>::get((self.id, self.1, owner, spender)).into())
+	}
+
 	/// @dev Function that burns an amount of the token of a given account,
 	/// deducting from the sender's allowance for said account.
 	/// @param from The account whose tokens will be burnt.
modifiedpallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungibleToken.soldiffbeforeafterboth
--- a/pallets/refungible/src/stubs/UniqueRefungibleToken.sol
+++ b/pallets/refungible/src/stubs/UniqueRefungibleToken.sol
@@ -36,8 +36,22 @@
 	}
 }
 
-/// @dev the ERC-165 identifier for this interface is 0xe17a7d2b
+/// @dev the ERC-165 identifier for this interface is 0x01d536fc
 contract ERC20UniqueExtensions is Dummy, ERC165 {
+	/// @dev Function to check the amount of tokens that an owner allowed to a spender.
+	/// @param owner crossAddress The address which owns the funds.
+	/// @param spender crossAddress The address which will spend the funds.
+	/// @return A uint256 specifying the amount of tokens still available for the spender.
+	/// @dev EVM selector for this function is: 0xe0af4bd7,
+	///  or in textual repr: allowanceCross((address,uint256),(address,uint256))
+	function allowanceCross(CrossAddress memory owner, CrossAddress memory spender) public view returns (uint256) {
+		require(false, stub_error);
+		owner;
+		spender;
+		dummy;
+		return 0;
+	}
+
 	// /// @dev Function that burns an amount of the token of a given account,
 	// /// deducting from the sender's allowance for said account.
 	// /// @param from The account whose tokens will be burnt.
modifiedpallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedruntime/common/ethereum/sponsoring/refungible.rsdiffbeforeafterboth
--- a/runtime/common/ethereum/sponsoring/refungible.rs
+++ b/runtime/common/ethereum/sponsoring/refungible.rs
@@ -341,7 +341,9 @@
 			ERC165Call(_, _) => None,
 
 			// Not sponsored
-			BurnFrom { .. } | BurnFromCross { .. } | Repartition { .. } => None,
+			AllowanceCross { .. } | BurnFrom { .. } | BurnFromCross { .. } | Repartition { .. } => {
+				None
+			}
 
 			TransferCross { .. } | TransferFromCross { .. } => {
 				let RefungibleTokenHandle(handle, token_id) = token;
modifiedtests/src/eth/abi/fungible.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/fungible.json
+++ b/tests/src/eth/abi/fungible.json
@@ -101,6 +101,32 @@
           { "internalType": "uint256", "name": "sub", "type": "uint256" }
         ],
         "internalType": "struct CrossAddress",
+        "name": "owner",
+        "type": "tuple"
+      },
+      {
+        "components": [
+          { "internalType": "address", "name": "eth", "type": "address" },
+          { "internalType": "uint256", "name": "sub", "type": "uint256" }
+        ],
+        "internalType": "struct CrossAddress",
+        "name": "spender",
+        "type": "tuple"
+      }
+    ],
+    "name": "allowanceCross",
+    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "eth", "type": "address" },
+          { "internalType": "uint256", "name": "sub", "type": "uint256" }
+        ],
+        "internalType": "struct CrossAddress",
         "name": "user",
         "type": "tuple"
       }
@@ -411,7 +437,7 @@
           { "internalType": "address", "name": "field_0", "type": "address" },
           { "internalType": "uint256", "name": "field_1", "type": "uint256" }
         ],
-        "internalType": "struct Tuple9[]",
+        "internalType": "struct Tuple11[]",
         "name": "amounts",
         "type": "tuple[]"
       }
modifiedtests/src/eth/abi/reFungibleToken.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/reFungibleToken.json
+++ b/tests/src/eth/abi/reFungibleToken.json
@@ -61,6 +61,32 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "eth", "type": "address" },
+          { "internalType": "uint256", "name": "sub", "type": "uint256" }
+        ],
+        "internalType": "struct CrossAddress",
+        "name": "owner",
+        "type": "tuple"
+      },
+      {
+        "components": [
+          { "internalType": "address", "name": "eth", "type": "address" },
+          { "internalType": "uint256", "name": "sub", "type": "uint256" }
+        ],
+        "internalType": "struct CrossAddress",
+        "name": "spender",
+        "type": "tuple"
+      }
+    ],
+    "name": "allowanceCross",
+    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "spender", "type": "address" },
       { "internalType": "uint256", "name": "amount", "type": "uint256" }
     ],
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -353,8 +353,16 @@
 	bytes value;
 }
 
-/// @dev the ERC-165 identifier for this interface is 0x65789571
+/// @dev the ERC-165 identifier for this interface is 0x85d7dea6
 interface ERC20UniqueExtensions is Dummy, ERC165 {
+	/// @dev Function to check the amount of tokens that an owner allowed to a spender.
+	/// @param owner crossAddress The address which owns the funds.
+	/// @param spender crossAddress The address which will spend the funds.
+	/// @return A uint256 specifying the amount of tokens still available for the spender.
+	/// @dev EVM selector for this function is: 0xe0af4bd7,
+	///  or in textual repr: allowanceCross((address,uint256),(address,uint256))
+	function allowanceCross(CrossAddress memory owner, CrossAddress memory spender) external view returns (uint256);
+
 	/// @notice A description for the collection.
 	/// @dev EVM selector for this function is: 0x7284e416,
 	///  or in textual repr: description()
@@ -390,7 +398,7 @@
 	/// @param amounts array of pairs of account address and amount
 	/// @dev EVM selector for this function is: 0x1acf2d55,
 	///  or in textual repr: mintBulk((address,uint256)[])
-	function mintBulk(Tuple9[] memory amounts) external returns (bool);
+	function mintBulk(Tuple11[] memory amounts) external returns (bool);
 
 	/// @dev EVM selector for this function is: 0x2ada85ff,
 	///  or in textual repr: transferCross((address,uint256),uint256)
@@ -411,7 +419,7 @@
 }
 
 /// @dev anonymous struct
-struct Tuple9 {
+struct Tuple11 {
 	address field_0;
 	uint256 field_1;
 }
modifiedtests/src/eth/api/UniqueRefungibleToken.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueRefungibleToken.sol
+++ b/tests/src/eth/api/UniqueRefungibleToken.sol
@@ -23,8 +23,16 @@
 	function parentTokenId() external view returns (uint256);
 }
 
-/// @dev the ERC-165 identifier for this interface is 0xe17a7d2b
+/// @dev the ERC-165 identifier for this interface is 0x01d536fc
 interface ERC20UniqueExtensions is Dummy, ERC165 {
+	/// @dev Function to check the amount of tokens that an owner allowed to a spender.
+	/// @param owner crossAddress The address which owns the funds.
+	/// @param spender crossAddress The address which will spend the funds.
+	/// @return A uint256 specifying the amount of tokens still available for the spender.
+	/// @dev EVM selector for this function is: 0xe0af4bd7,
+	///  or in textual repr: allowanceCross((address,uint256),(address,uint256))
+	function allowanceCross(CrossAddress memory owner, CrossAddress memory spender) external view returns (uint256);
+
 	// /// @dev Function that burns an amount of the token of a given account,
 	// /// deducting from the sender's allowance for said account.
 	// /// @param from The account whose tokens will be burnt.
modifiedtests/src/eth/fungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/fungible.test.ts
+++ b/tests/src/eth/fungible.test.ts
@@ -134,6 +134,12 @@
       const allowance = await contract.methods.allowance(owner, spender).call();
       expect(+allowance).to.equal(100);
     }
+    {
+      const ownerCross = helper.ethCrossAccount.fromAddress(owner);
+      const spenderCross = helper.ethCrossAccount.fromAddress(spender);
+      const allowance = await contract.methods.allowanceCross(ownerCross, spenderCross).call();
+      expect(+allowance).to.equal(100);
+    }
   });
 
   itEth('Can perform approveCross()', async ({helper}) => {
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -219,8 +219,16 @@
       await rftToken.methods.approve(operator, 15n).send({from: owner});
       await contract.methods.setApprovalForAll(operator, true).send({from: owner});
       await rftToken.methods.burnFrom(owner, 10n).send({from: operator});
+    }
+    {
       const allowance = await rftToken.methods.allowance(owner, operator).call();
-      expect(allowance).to.be.equal('5');
+      expect(+allowance).to.be.equal(5);
+    }
+    {
+      const ownerCross = helper.ethCrossAccount.fromAddress(owner);
+      const operatorCross = helper.ethCrossAccount.fromAddress(operator);
+      const allowance = await rftToken.methods.allowanceCross(ownerCross, operatorCross).call();
+      expect(+allowance).to.equal(5);
     }
   });