difftreelog
fix(nft) name/symbol should be always callable
in: master
4 files changed
pallets/nonfungible/src/erc.rsdiffbeforeafterboth203#[solidity_interface(name = ERC721Metadata, expect_selector = 0x5b5e139f)]203#[solidity_interface(name = ERC721Metadata, expect_selector = 0x5b5e139f)]204impl<T: Config> NonfungibleHandle<T> {204impl<T: Config> NonfungibleHandle<T> {205 /// @notice A descriptive name for a collection of NFTs in this contract205 /// @notice A descriptive name for a collection of NFTs in this contract206 /// @dev real implementation of this function lies in `ERC721UniqueExtensions`207 #[solidity(hide, rename_selector = "name")]206 fn name(&self) -> Result<string> {208 fn name_proxy(&self) -> Result<string> {207 Ok(decode_utf16(self.name.iter().copied())209 self.name()208 .map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))209 .collect::<string>())210 }210 }211211212 /// @notice An abbreviated name for NFTs in this contract212 /// @notice An abbreviated name for NFTs in this contract213 /// @dev real implementation of this function lies in `ERC721UniqueExtensions`214 #[solidity(hide, rename_selector = "symbol")]213 fn symbol(&self) -> Result<string> {215 fn symbol_proxy(&self) -> Result<string> {214 Ok(string::from_utf8_lossy(&self.token_prefix).into())216 self.symbol()215 }217 }216218217 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.219 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.571/// @title Unique extensions for ERC721.573/// @title Unique extensions for ERC721.572#[solidity_interface(name = ERC721UniqueExtensions)]574#[solidity_interface(name = ERC721UniqueExtensions)]573impl<T: Config> NonfungibleHandle<T> {575impl<T: Config> NonfungibleHandle<T> {576 /// @notice A descriptive name for a collection of NFTs in this contract577 fn name(&self) -> Result<string> {578 Ok(decode_utf16(self.name.iter().copied())579 .map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))580 .collect::<string>())581 }582583 /// @notice An abbreviated name for NFTs in this contract584 fn symbol(&self) -> Result<string> {585 Ok(string::from_utf8_lossy(&self.token_prefix).into())586 }587574 /// @notice Transfer ownership of an NFT588 /// @notice Transfer ownership of an NFT575 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`589 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth21/// @dev See https://eips.ethereum.org/EIPS/eip-72121/// @dev See https://eips.ethereum.org/EIPS/eip-72122/// @dev the ERC-165 identifier for this interface is 0x5b5e139f22/// @dev the ERC-165 identifier for this interface is 0x5b5e139f23contract ERC721Metadata is Dummy, ERC165 {23contract ERC721Metadata is Dummy, ERC165 {24 /// @notice A descriptive name for a collection of NFTs in this contract24 // /// @notice A descriptive name for a collection of NFTs in this contract25 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`25 /// @dev EVM selector for this function is: 0x06fdde03,26 // /// @dev EVM selector for this function is: 0x06fdde03,26 /// or in textual repr: name()27 // /// or in textual repr: name()27 function name() public view returns (string memory) {28 // function name() public view returns (string memory) {28 require(false, stub_error);29 // require(false, stub_error);29 dummy;30 // dummy;30 return "";31 // return "";31 }32 // }323333 /// @notice An abbreviated name for NFTs in this contract34 // /// @notice An abbreviated name for NFTs in this contract35 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`34 /// @dev EVM selector for this function is: 0x95d89b41,36 // /// @dev EVM selector for this function is: 0x95d89b41,35 /// or in textual repr: symbol()37 // /// or in textual repr: symbol()36 function symbol() public view returns (string memory) {38 // function symbol() public view returns (string memory) {37 require(false, stub_error);39 // require(false, stub_error);38 dummy;40 // dummy;39 return "";41 // return "";40 }42 // }414342 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.44 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.43 ///45 ///504}506}505507506/// @title Unique extensions for ERC721.508/// @title Unique extensions for ERC721.507/// @dev the ERC-165 identifier for this interface is 0xd74d154f509/// @dev the ERC-165 identifier for this interface is 0x4468500d508contract ERC721UniqueExtensions is Dummy, ERC165 {510contract ERC721UniqueExtensions is Dummy, ERC165 {511 /// @notice A descriptive name for a collection of NFTs in this contract512 /// @dev EVM selector for this function is: 0x06fdde03,513 /// or in textual repr: name()514 function name() public view returns (string memory) {515 require(false, stub_error);516 dummy;517 return "";518 }519520 /// @notice An abbreviated name for NFTs in this contract521 /// @dev EVM selector for this function is: 0x95d89b41,522 /// or in textual repr: symbol()523 function symbol() public view returns (string memory) {524 require(false, stub_error);525 dummy;526 return "";527 }528509 /// @notice Transfer ownership of an NFT529 /// @notice Transfer ownership of an NFT510 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`530 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`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`