git.delta.rocks / unique-network / refs/commits / 35f818f58d56

difftreelog

Merge pull request #853 from UniqueNetwork/fix/erc20

Yaroslav Bolyukin2023-01-23parents: #1154c05 #dc96dca.patch.diff
in: master

9 files changed

modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -57,7 +57,7 @@
 	},
 }
 
-#[solidity_interface(name = ERC20, events(ERC20Events))]
+#[solidity_interface(name = ERC20, events(ERC20Events), expect_selector = 0x942e8b22)]
 impl<T: Config> FungibleHandle<T> {
 	fn name(&self) -> Result<String> {
 		Ok(decode_utf16(self.name.iter().copied())
@@ -134,11 +134,6 @@
 		let spender = T::CrossAccountId::from_eth(spender);
 
 		Ok(<Allowance<T>>::get((self.id, owner, spender)).into())
-	}
-
-	/// @notice Returns collection helper contract address
-	fn collection_helper_address(&self) -> Result<Address> {
-		Ok(T::ContractAddress::get())
 	}
 }
 
@@ -312,6 +307,11 @@
 			.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
+
+	/// @notice Returns collection helper contract address
+	fn collection_helper_address(&self) -> Result<Address> {
+		Ok(T::ContractAddress::get())
+	}
 }
 
 #[solidity_interface(
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,7 +511,7 @@
 	bytes value;
 }
 
-/// @dev the ERC-165 identifier for this interface is 0x7dee5997
+/// @dev the ERC-165 identifier for this interface is 0x65789571
 contract ERC20UniqueExtensions is Dummy, ERC165 {
 	/// @notice A description for the collection.
 	/// @dev EVM selector for this function is: 0x7284e416,
@@ -607,6 +607,15 @@
 		dummy = 0;
 		return false;
 	}
+
+	/// @notice Returns collection helper contract address
+	/// @dev EVM selector for this function is: 0x1896cce6,
+	///  or in textual repr: collectionHelperAddress()
+	function collectionHelperAddress() public view returns (address) {
+		require(false, stub_error);
+		dummy;
+		return 0x0000000000000000000000000000000000000000;
+	}
 }
 
 /// @dev anonymous struct
@@ -637,7 +646,7 @@
 	event Approval(address indexed owner, address indexed spender, uint256 value);
 }
 
-/// @dev the ERC-165 identifier for this interface is 0x8cb847c4
+/// @dev the ERC-165 identifier for this interface is 0x942e8b22
 contract ERC20 is Dummy, ERC165, ERC20Events {
 	/// @dev EVM selector for this function is: 0x06fdde03,
 	///  or in textual repr: name()
@@ -723,15 +732,6 @@
 		spender;
 		dummy;
 		return 0;
-	}
-
-	/// @notice Returns collection helper contract address
-	/// @dev EVM selector for this function is: 0x1896cce6,
-	///  or in textual repr: collectionHelperAddress()
-	function collectionHelperAddress() public view returns (address) {
-		require(false, stub_error);
-		dummy;
-		return 0x0000000000000000000000000000000000000000;
 	}
 }
 
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
353 bytes value;353 bytes value;
354}354}
355355
356/// @dev the ERC-165 identifier for this interface is 0x7dee5997356/// @dev the ERC-165 identifier for this interface is 0x65789571
357interface ERC20UniqueExtensions is Dummy, ERC165 {357interface ERC20UniqueExtensions is Dummy, ERC165 {
358 /// @notice A description for the collection.358 /// @notice A description for the collection.
359 /// @dev EVM selector for this function is: 0x7284e416,359 /// @dev EVM selector for this function is: 0x7284e416,
404 uint256 amount404 uint256 amount
405 ) external returns (bool);405 ) external returns (bool);
406
407 /// @notice Returns collection helper contract address
408 /// @dev EVM selector for this function is: 0x1896cce6,
409 /// or in textual repr: collectionHelperAddress()
410 function collectionHelperAddress() external view returns (address);
406}411}
407412
408/// @dev anonymous struct413/// @dev anonymous struct
427 event Approval(address indexed owner, address indexed spender, uint256 value);432 event Approval(address indexed owner, address indexed spender, uint256 value);
428}433}
429434
430/// @dev the ERC-165 identifier for this interface is 0x8cb847c4435/// @dev the ERC-165 identifier for this interface is 0x942e8b22
431interface ERC20 is Dummy, ERC165, ERC20Events {436interface ERC20 is Dummy, ERC165, ERC20Events {
432 /// @dev EVM selector for this function is: 0x06fdde03,437 /// @dev EVM selector for this function is: 0x06fdde03,
433 /// or in textual repr: name()438 /// or in textual repr: name()
469 /// or in textual repr: allowance(address,address)474 /// or in textual repr: allowance(address,address)
470 function allowance(address owner, address spender) external view returns (uint256);475 function allowance(address owner, address spender) external view returns (uint256);
471
472 /// @notice Returns collection helper contract address
473 /// @dev EVM selector for this function is: 0x1896cce6,
474 /// or in textual repr: collectionHelperAddress()
475 function collectionHelperAddress() external view returns (address);
476}476}
477477
478interface UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}478interface UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}