difftreelog
fix(nft) name/symbol should be always callable
in: master
4 files changed
pallets/nonfungible/src/erc.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -203,15 +203,17 @@
#[solidity_interface(name = ERC721Metadata, expect_selector = 0x5b5e139f)]
impl<T: Config> NonfungibleHandle<T> {
/// @notice A descriptive name for a collection of NFTs in this contract
- fn name(&self) -> Result<string> {
- Ok(decode_utf16(self.name.iter().copied())
- .map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))
- .collect::<string>())
+ /// @dev real implementation of this function lies in `ERC721UniqueExtensions`
+ #[solidity(hide, rename_selector = "name")]
+ fn name_proxy(&self) -> Result<string> {
+ self.name()
}
/// @notice An abbreviated name for NFTs in this contract
- fn symbol(&self) -> Result<string> {
- Ok(string::from_utf8_lossy(&self.token_prefix).into())
+ /// @dev real implementation of this function lies in `ERC721UniqueExtensions`
+ #[solidity(hide, rename_selector = "symbol")]
+ fn symbol_proxy(&self) -> Result<string> {
+ self.symbol()
}
/// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
@@ -571,6 +573,18 @@
/// @title Unique extensions for ERC721.
#[solidity_interface(name = ERC721UniqueExtensions)]
impl<T: Config> NonfungibleHandle<T> {
+ /// @notice A descriptive name for a collection of NFTs in this contract
+ fn name(&self) -> Result<string> {
+ Ok(decode_utf16(self.name.iter().copied())
+ .map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))
+ .collect::<string>())
+ }
+
+ /// @notice An abbreviated name for NFTs in this contract
+ fn symbol(&self) -> Result<string> {
+ Ok(string::from_utf8_lossy(&self.token_prefix).into())
+ }
+
/// @notice Transfer ownership of an NFT
/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
/// is the zero address. Throws if `tokenId` is not a valid NFT.
pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -21,23 +21,25 @@
/// @dev See https://eips.ethereum.org/EIPS/eip-721
/// @dev the ERC-165 identifier for this interface is 0x5b5e139f
contract ERC721Metadata is Dummy, ERC165 {
- /// @notice A descriptive name for a collection of NFTs in this contract
- /// @dev EVM selector for this function is: 0x06fdde03,
- /// or in textual repr: name()
- function name() public view returns (string memory) {
- require(false, stub_error);
- dummy;
- return "";
- }
+ // /// @notice A descriptive name for a collection of NFTs in this contract
+ // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`
+ // /// @dev EVM selector for this function is: 0x06fdde03,
+ // /// or in textual repr: name()
+ // function name() public view returns (string memory) {
+ // require(false, stub_error);
+ // dummy;
+ // return "";
+ // }
- /// @notice An abbreviated name for NFTs in this contract
- /// @dev EVM selector for this function is: 0x95d89b41,
- /// or in textual repr: symbol()
- function symbol() public view returns (string memory) {
- require(false, stub_error);
- dummy;
- return "";
- }
+ // /// @notice An abbreviated name for NFTs in this contract
+ // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`
+ // /// @dev EVM selector for this function is: 0x95d89b41,
+ // /// or in textual repr: symbol()
+ // function symbol() public view returns (string memory) {
+ // require(false, stub_error);
+ // dummy;
+ // return "";
+ // }
/// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
///
@@ -504,8 +506,26 @@
}
/// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0xd74d154f
+/// @dev the ERC-165 identifier for this interface is 0x4468500d
contract ERC721UniqueExtensions is Dummy, ERC165 {
+ /// @notice A descriptive name for a collection of NFTs in this contract
+ /// @dev EVM selector for this function is: 0x06fdde03,
+ /// or in textual repr: name()
+ function name() public view returns (string memory) {
+ require(false, stub_error);
+ dummy;
+ return "";
+ }
+
+ /// @notice An abbreviated name for NFTs in this contract
+ /// @dev EVM selector for this function is: 0x95d89b41,
+ /// or in textual repr: symbol()
+ function symbol() public view returns (string memory) {
+ require(false, stub_error);
+ dummy;
+ return "";
+ }
+
/// @notice Transfer ownership of an NFT
/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
/// is the zero address. Throws if `tokenId` is not a valid NFT.
tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth16/// @dev See https://eips.ethereum.org/EIPS/eip-72116/// @dev See https://eips.ethereum.org/EIPS/eip-72117/// @dev the ERC-165 identifier for this interface is 0x5b5e139f17/// @dev the ERC-165 identifier for this interface is 0x5b5e139f18interface ERC721Metadata is Dummy, ERC165 {18interface ERC721Metadata is Dummy, ERC165 {19 /// @notice A descriptive name for a collection of NFTs in this contract19 // /// @notice A descriptive name for a collection of NFTs in this contract20 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`20 /// @dev EVM selector for this function is: 0x06fdde03,21 // /// @dev EVM selector for this function is: 0x06fdde03,21 /// or in textual repr: name()22 // /// or in textual repr: name()22 function name() external view returns (string memory);23 // function name() external view returns (string memory);232424 /// @notice An abbreviated name for NFTs in this contract25 // /// @notice An abbreviated name for NFTs in this contract26 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`25 /// @dev EVM selector for this function is: 0x95d89b41,27 // /// @dev EVM selector for this function is: 0x95d89b41,26 /// or in textual repr: symbol()28 // /// or in textual repr: symbol()27 function symbol() external view returns (string memory);29 // function symbol() external view returns (string memory);283029 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.31 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.30 ///32 ///336}338}337339338/// @title Unique extensions for ERC721.340/// @title Unique extensions for ERC721.339/// @dev the ERC-165 identifier for this interface is 0xd74d154f341/// @dev the ERC-165 identifier for this interface is 0x4468500d340interface ERC721UniqueExtensions is Dummy, ERC165 {342interface ERC721UniqueExtensions is Dummy, ERC165 {343 /// @notice A descriptive name for a collection of NFTs in this contract344 /// @dev EVM selector for this function is: 0x06fdde03,345 /// or in textual repr: name()346 function name() external view returns (string memory);347348 /// @notice An abbreviated name for NFTs in this contract349 /// @dev EVM selector for this function is: 0x95d89b41,350 /// or in textual repr: symbol()351 function symbol() external view returns (string memory);352341 /// @notice Transfer ownership of an NFT353 /// @notice Transfer ownership of an NFT342 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`354 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`