difftreelog
feat add allowanceCross method
in: master
22 files changed
Cargo.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",
pallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterbothbinary blob — no preview
pallets/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
pallets/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.
pallets/fungible/src/erc.rsdiffbeforeafterboth--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -161,6 +161,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, owner, spender)).into())
+ }
+
/// @notice A description for the collection.
fn description(&self) -> Result<String> {
Ok(decode_utf16(self.description.iter().copied())
pallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/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;
}
pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/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
pallets/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.
pallets/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.
pallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterbothbinary blob — no preview
pallets/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.
pallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterbothbinary blob — no preview
runtime/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;
tests/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[]"
}
tests/src/eth/abi/reFungibleToken.jsondiffbeforeafterboth1[2 {3 "anonymous": false,4 "inputs": [5 {6 "indexed": true,7 "internalType": "address",8 "name": "owner",9 "type": "address"10 },11 {12 "indexed": true,13 "internalType": "address",14 "name": "spender",15 "type": "address"16 },17 {18 "indexed": false,19 "internalType": "uint256",20 "name": "value",21 "type": "uint256"22 }23 ],24 "name": "Approval",25 "type": "event"26 },27 {28 "anonymous": false,29 "inputs": [30 {31 "indexed": true,32 "internalType": "address",33 "name": "from",34 "type": "address"35 },36 {37 "indexed": true,38 "internalType": "address",39 "name": "to",40 "type": "address"41 },42 {43 "indexed": false,44 "internalType": "uint256",45 "name": "value",46 "type": "uint256"47 }48 ],49 "name": "Transfer",50 "type": "event"51 },52 {53 "inputs": [54 { "internalType": "address", "name": "owner", "type": "address" },55 { "internalType": "address", "name": "spender", "type": "address" }56 ],57 "name": "allowance",58 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],59 "stateMutability": "view",60 "type": "function"61 },62 {63 "inputs": [64 { "internalType": "address", "name": "spender", "type": "address" },65 { "internalType": "uint256", "name": "amount", "type": "uint256" }66 ],67 "name": "approve",68 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],69 "stateMutability": "nonpayable",70 "type": "function"71 },72 {73 "inputs": [74 {75 "components": [76 { "internalType": "address", "name": "eth", "type": "address" },77 { "internalType": "uint256", "name": "sub", "type": "uint256" }78 ],79 "internalType": "struct CrossAddress",80 "name": "spender",81 "type": "tuple"82 },83 { "internalType": "uint256", "name": "amount", "type": "uint256" }84 ],85 "name": "approveCross",86 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],87 "stateMutability": "nonpayable",88 "type": "function"89 },90 {91 "inputs": [92 { "internalType": "address", "name": "owner", "type": "address" }93 ],94 "name": "balanceOf",95 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],96 "stateMutability": "view",97 "type": "function"98 },99 {100 "inputs": [101 {102 "components": [103 { "internalType": "address", "name": "eth", "type": "address" },104 { "internalType": "uint256", "name": "sub", "type": "uint256" }105 ],106 "internalType": "struct CrossAddress",107 "name": "from",108 "type": "tuple"109 },110 { "internalType": "uint256", "name": "amount", "type": "uint256" }111 ],112 "name": "burnFromCross",113 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],114 "stateMutability": "nonpayable",115 "type": "function"116 },117 {118 "inputs": [],119 "name": "decimals",120 "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],121 "stateMutability": "view",122 "type": "function"123 },124 {125 "inputs": [],126 "name": "name",127 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],128 "stateMutability": "view",129 "type": "function"130 },131 {132 "inputs": [],133 "name": "parentToken",134 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],135 "stateMutability": "view",136 "type": "function"137 },138 {139 "inputs": [],140 "name": "parentTokenId",141 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],142 "stateMutability": "view",143 "type": "function"144 },145 {146 "inputs": [147 { "internalType": "uint256", "name": "amount", "type": "uint256" }148 ],149 "name": "repartition",150 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],151 "stateMutability": "nonpayable",152 "type": "function"153 },154 {155 "inputs": [156 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }157 ],158 "name": "supportsInterface",159 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],160 "stateMutability": "view",161 "type": "function"162 },163 {164 "inputs": [],165 "name": "symbol",166 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],167 "stateMutability": "view",168 "type": "function"169 },170 {171 "inputs": [],172 "name": "totalSupply",173 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],174 "stateMutability": "view",175 "type": "function"176 },177 {178 "inputs": [179 { "internalType": "address", "name": "to", "type": "address" },180 { "internalType": "uint256", "name": "amount", "type": "uint256" }181 ],182 "name": "transfer",183 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],184 "stateMutability": "nonpayable",185 "type": "function"186 },187 {188 "inputs": [189 {190 "components": [191 { "internalType": "address", "name": "eth", "type": "address" },192 { "internalType": "uint256", "name": "sub", "type": "uint256" }193 ],194 "internalType": "struct CrossAddress",195 "name": "to",196 "type": "tuple"197 },198 { "internalType": "uint256", "name": "amount", "type": "uint256" }199 ],200 "name": "transferCross",201 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],202 "stateMutability": "nonpayable",203 "type": "function"204 },205 {206 "inputs": [207 { "internalType": "address", "name": "from", "type": "address" },208 { "internalType": "address", "name": "to", "type": "address" },209 { "internalType": "uint256", "name": "amount", "type": "uint256" }210 ],211 "name": "transferFrom",212 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],213 "stateMutability": "nonpayable",214 "type": "function"215 },216 {217 "inputs": [218 {219 "components": [220 { "internalType": "address", "name": "eth", "type": "address" },221 { "internalType": "uint256", "name": "sub", "type": "uint256" }222 ],223 "internalType": "struct CrossAddress",224 "name": "from",225 "type": "tuple"226 },227 {228 "components": [229 { "internalType": "address", "name": "eth", "type": "address" },230 { "internalType": "uint256", "name": "sub", "type": "uint256" }231 ],232 "internalType": "struct CrossAddress",233 "name": "to",234 "type": "tuple"235 },236 { "internalType": "uint256", "name": "amount", "type": "uint256" }237 ],238 "name": "transferFromCross",239 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],240 "stateMutability": "nonpayable",241 "type": "function"242 }243]1[2 {3 "anonymous": false,4 "inputs": [5 {6 "indexed": true,7 "internalType": "address",8 "name": "owner",9 "type": "address"10 },11 {12 "indexed": true,13 "internalType": "address",14 "name": "spender",15 "type": "address"16 },17 {18 "indexed": false,19 "internalType": "uint256",20 "name": "value",21 "type": "uint256"22 }23 ],24 "name": "Approval",25 "type": "event"26 },27 {28 "anonymous": false,29 "inputs": [30 {31 "indexed": true,32 "internalType": "address",33 "name": "from",34 "type": "address"35 },36 {37 "indexed": true,38 "internalType": "address",39 "name": "to",40 "type": "address"41 },42 {43 "indexed": false,44 "internalType": "uint256",45 "name": "value",46 "type": "uint256"47 }48 ],49 "name": "Transfer",50 "type": "event"51 },52 {53 "inputs": [54 { "internalType": "address", "name": "owner", "type": "address" },55 { "internalType": "address", "name": "spender", "type": "address" }56 ],57 "name": "allowance",58 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],59 "stateMutability": "view",60 "type": "function"61 },62 {63 "inputs": [64 {65 "components": [66 { "internalType": "address", "name": "eth", "type": "address" },67 { "internalType": "uint256", "name": "sub", "type": "uint256" }68 ],69 "internalType": "struct CrossAddress",70 "name": "owner",71 "type": "tuple"72 },73 {74 "components": [75 { "internalType": "address", "name": "eth", "type": "address" },76 { "internalType": "uint256", "name": "sub", "type": "uint256" }77 ],78 "internalType": "struct CrossAddress",79 "name": "spender",80 "type": "tuple"81 }82 ],83 "name": "allowanceCross",84 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],85 "stateMutability": "view",86 "type": "function"87 },88 {89 "inputs": [90 { "internalType": "address", "name": "spender", "type": "address" },91 { "internalType": "uint256", "name": "amount", "type": "uint256" }92 ],93 "name": "approve",94 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],95 "stateMutability": "nonpayable",96 "type": "function"97 },98 {99 "inputs": [100 {101 "components": [102 { "internalType": "address", "name": "eth", "type": "address" },103 { "internalType": "uint256", "name": "sub", "type": "uint256" }104 ],105 "internalType": "struct CrossAddress",106 "name": "spender",107 "type": "tuple"108 },109 { "internalType": "uint256", "name": "amount", "type": "uint256" }110 ],111 "name": "approveCross",112 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],113 "stateMutability": "nonpayable",114 "type": "function"115 },116 {117 "inputs": [118 { "internalType": "address", "name": "owner", "type": "address" }119 ],120 "name": "balanceOf",121 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],122 "stateMutability": "view",123 "type": "function"124 },125 {126 "inputs": [127 {128 "components": [129 { "internalType": "address", "name": "eth", "type": "address" },130 { "internalType": "uint256", "name": "sub", "type": "uint256" }131 ],132 "internalType": "struct CrossAddress",133 "name": "from",134 "type": "tuple"135 },136 { "internalType": "uint256", "name": "amount", "type": "uint256" }137 ],138 "name": "burnFromCross",139 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],140 "stateMutability": "nonpayable",141 "type": "function"142 },143 {144 "inputs": [],145 "name": "decimals",146 "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],147 "stateMutability": "view",148 "type": "function"149 },150 {151 "inputs": [],152 "name": "name",153 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],154 "stateMutability": "view",155 "type": "function"156 },157 {158 "inputs": [],159 "name": "parentToken",160 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],161 "stateMutability": "view",162 "type": "function"163 },164 {165 "inputs": [],166 "name": "parentTokenId",167 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],168 "stateMutability": "view",169 "type": "function"170 },171 {172 "inputs": [173 { "internalType": "uint256", "name": "amount", "type": "uint256" }174 ],175 "name": "repartition",176 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],177 "stateMutability": "nonpayable",178 "type": "function"179 },180 {181 "inputs": [182 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }183 ],184 "name": "supportsInterface",185 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],186 "stateMutability": "view",187 "type": "function"188 },189 {190 "inputs": [],191 "name": "symbol",192 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],193 "stateMutability": "view",194 "type": "function"195 },196 {197 "inputs": [],198 "name": "totalSupply",199 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],200 "stateMutability": "view",201 "type": "function"202 },203 {204 "inputs": [205 { "internalType": "address", "name": "to", "type": "address" },206 { "internalType": "uint256", "name": "amount", "type": "uint256" }207 ],208 "name": "transfer",209 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],210 "stateMutability": "nonpayable",211 "type": "function"212 },213 {214 "inputs": [215 {216 "components": [217 { "internalType": "address", "name": "eth", "type": "address" },218 { "internalType": "uint256", "name": "sub", "type": "uint256" }219 ],220 "internalType": "struct CrossAddress",221 "name": "to",222 "type": "tuple"223 },224 { "internalType": "uint256", "name": "amount", "type": "uint256" }225 ],226 "name": "transferCross",227 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],228 "stateMutability": "nonpayable",229 "type": "function"230 },231 {232 "inputs": [233 { "internalType": "address", "name": "from", "type": "address" },234 { "internalType": "address", "name": "to", "type": "address" },235 { "internalType": "uint256", "name": "amount", "type": "uint256" }236 ],237 "name": "transferFrom",238 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],239 "stateMutability": "nonpayable",240 "type": "function"241 },242 {243 "inputs": [244 {245 "components": [246 { "internalType": "address", "name": "eth", "type": "address" },247 { "internalType": "uint256", "name": "sub", "type": "uint256" }248 ],249 "internalType": "struct CrossAddress",250 "name": "from",251 "type": "tuple"252 },253 {254 "components": [255 { "internalType": "address", "name": "eth", "type": "address" },256 { "internalType": "uint256", "name": "sub", "type": "uint256" }257 ],258 "internalType": "struct CrossAddress",259 "name": "to",260 "type": "tuple"261 },262 { "internalType": "uint256", "name": "amount", "type": "uint256" }263 ],264 "name": "transferFromCross",265 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],266 "stateMutability": "nonpayable",267 "type": "function"268 }269]tests/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;
}
tests/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.
tests/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}) => {
tests/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);
}
});