git.delta.rocks / unique-network / refs/commits / 825818b094ee

difftreelog

fix(refungible) name/symbol should be always callable

Yaroslav Bolyukin2022-10-13parent: #9d5e6bd.patch.diff
in: master

1 file changed

modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
195195
196#[solidity_interface(name = ERC721Metadata)]196#[solidity_interface(name = ERC721Metadata)]
197impl<T: Config> RefungibleHandle<T> {197impl<T: Config> RefungibleHandle<T> {
198 /// @notice A descriptive name for a collection of RFTs in this contract198 /// @notice A descriptive name for a collection of NFTs in this contract
199 /// @dev real implementation of this function lies in `ERC721UniqueExtensions`
200 #[solidity(hide, rename_selector = "name")]
199 fn name(&self) -> Result<string> {201 fn name_proxy(&self) -> Result<string> {
200 Ok(decode_utf16(self.name.iter().copied())202 self.name()
201 .map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))
202 .collect::<string>())
203 }203 }
204204
205 /// @notice An abbreviated name for RFTs in this contract205 /// @notice An abbreviated name for NFTs in this contract
206 /// @dev real implementation of this function lies in `ERC721UniqueExtensions`
207 #[solidity(hide, rename_selector = "symbol")]
206 fn symbol(&self) -> Result<string> {208 fn symbol_proxy(&self) -> Result<string> {
207 Ok(string::from_utf8_lossy(&self.token_prefix).into())209 self.symbol()
208 }210 }
209211
210 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.212 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
596/// @title Unique extensions for ERC721.598/// @title Unique extensions for ERC721.
597#[solidity_interface(name = ERC721UniqueExtensions)]599#[solidity_interface(name = ERC721UniqueExtensions)]
598impl<T: Config> RefungibleHandle<T> {600impl<T: Config> RefungibleHandle<T> {
601 /// @notice A descriptive name for a collection of NFTs in this contract
602 fn name(&self) -> Result<string> {
603 Ok(decode_utf16(self.name.iter().copied())
604 .map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))
605 .collect::<string>())
606 }
607
608 /// @notice An abbreviated name for NFTs in this contract
609 fn symbol(&self) -> Result<string> {
610 Ok(string::from_utf8_lossy(&self.token_prefix).into())
611 }
612
599 /// @notice Transfer ownership of an RFT613 /// @notice Transfer ownership of an RFT
600 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`614 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`