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.soldiffbeforeafterboth1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56/// @dev common stubs holder7contract Dummy {8 uint8 dummy;9 string stub_error = "this contract is implemented in native";10}1112contract ERC165 is Dummy {13 function supportsInterface(bytes4 interfaceID) external view returns (bool) {14 require(false, stub_error);15 interfaceID;16 return true;17 }18}1920/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension21/// @dev See https://eips.ethereum.org/EIPS/eip-72122/// @dev the ERC-165 identifier for this interface is 0x5b5e139f23contract ERC721Metadata is Dummy, ERC165 {24 /// @notice A descriptive name for a collection of NFTs in this contract25 /// @dev EVM selector for this function is: 0x06fdde03,26 /// or in textual repr: name()27 function name() public view returns (string memory) {28 require(false, stub_error);29 dummy;30 return "";31 }3233 /// @notice An abbreviated name for NFTs in this contract34 /// @dev EVM selector for this function is: 0x95d89b41,35 /// or in textual repr: symbol()36 function symbol() public view returns (string memory) {37 require(false, stub_error);38 dummy;39 return "";40 }4142 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.43 ///44 /// @dev If the token has a `url` property and it is not empty, it is returned.45 /// Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.46 /// If the collection property `baseURI` is empty or absent, return "" (empty string)47 /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix48 /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).49 ///50 /// @return token's const_metadata51 /// @dev EVM selector for this function is: 0xc87b56dd,52 /// or in textual repr: tokenURI(uint256)53 function tokenURI(uint256 tokenId) public view returns (string memory) {54 require(false, stub_error);55 tokenId;56 dummy;57 return "";58 }59}6061/// @title A contract that allows to set and delete token properties and change token property permissions.62/// @dev the ERC-165 identifier for this interface is 0x4136937763contract TokenProperties is Dummy, ERC165 {64 /// @notice Set permissions for token property.65 /// @dev Throws error if `msg.sender` is not admin or owner of the collection.66 /// @param key Property key.67 /// @param isMutable Permission to mutate property.68 /// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.69 /// @param tokenOwner Permission to mutate property by token owner if property is mutable.70 /// @dev EVM selector for this function is: 0x222d97fa,71 /// or in textual repr: setTokenPropertyPermission(string,bool,bool,bool)72 function setTokenPropertyPermission(73 string memory key,74 bool isMutable,75 bool collectionAdmin,76 bool tokenOwner77 ) public {78 require(false, stub_error);79 key;80 isMutable;81 collectionAdmin;82 tokenOwner;83 dummy = 0;84 }8586 /// @notice Set token property value.87 /// @dev Throws error if `msg.sender` has no permission to edit the property.88 /// @param tokenId ID of the token.89 /// @param key Property key.90 /// @param value Property value.91 /// @dev EVM selector for this function is: 0x1752d67b,92 /// or in textual repr: setProperty(uint256,string,bytes)93 function setProperty(94 uint256 tokenId,95 string memory key,96 bytes memory value97 ) public {98 require(false, stub_error);99 tokenId;100 key;101 value;102 dummy = 0;103 }104105 /// @notice Delete token property value.106 /// @dev Throws error if `msg.sender` has no permission to edit the property.107 /// @param tokenId ID of the token.108 /// @param key Property key.109 /// @dev EVM selector for this function is: 0x066111d1,110 /// or in textual repr: deleteProperty(uint256,string)111 function deleteProperty(uint256 tokenId, string memory key) public {112 require(false, stub_error);113 tokenId;114 key;115 dummy = 0;116 }117118 /// @notice Get token property value.119 /// @dev Throws error if key not found120 /// @param tokenId ID of the token.121 /// @param key Property key.122 /// @return Property value bytes123 /// @dev EVM selector for this function is: 0x7228c327,124 /// or in textual repr: property(uint256,string)125 function property(uint256 tokenId, string memory key) public view returns (bytes memory) {126 require(false, stub_error);127 tokenId;128 key;129 dummy;130 return hex"";131 }132}133134/// @title A contract that allows you to work with collections.135/// @dev the ERC-165 identifier for this interface is 0x3e1e8083136contract Collection is Dummy, ERC165 {137 /// Set collection property.138 ///139 /// @param key Property key.140 /// @param value Propery value.141 /// @dev EVM selector for this function is: 0x2f073f66,142 /// or in textual repr: setCollectionProperty(string,bytes)143 function setCollectionProperty(string memory key, bytes memory value) public {144 require(false, stub_error);145 key;146 value;147 dummy = 0;148 }149150 /// Delete collection property.151 ///152 /// @param key Property key.153 /// @dev EVM selector for this function is: 0x7b7debce,154 /// or in textual repr: deleteCollectionProperty(string)155 function deleteCollectionProperty(string memory key) public {156 require(false, stub_error);157 key;158 dummy = 0;159 }160161 /// Get collection property.162 ///163 /// @dev Throws error if key not found.164 ///165 /// @param key Property key.166 /// @return bytes The property corresponding to the key.167 /// @dev EVM selector for this function is: 0xcf24fd6d,168 /// or in textual repr: collectionProperty(string)169 function collectionProperty(string memory key) public view returns (bytes memory) {170 require(false, stub_error);171 key;172 dummy;173 return hex"";174 }175176 /// Set the sponsor of the collection.177 ///178 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.179 ///180 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.181 /// @dev EVM selector for this function is: 0x7623402e,182 /// or in textual repr: setCollectionSponsor(address)183 function setCollectionSponsor(address sponsor) public {184 require(false, stub_error);185 sponsor;186 dummy = 0;187 }188189 /// Whether there is a pending sponsor.190 /// @dev EVM selector for this function is: 0x058ac185,191 /// or in textual repr: hasCollectionPendingSponsor()192 function hasCollectionPendingSponsor() public view returns (bool) {193 require(false, stub_error);194 dummy;195 return false;196 }197198 /// Collection sponsorship confirmation.199 ///200 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.201 /// @dev EVM selector for this function is: 0x3c50e97a,202 /// or in textual repr: confirmCollectionSponsorship()203 function confirmCollectionSponsorship() public {204 require(false, stub_error);205 dummy = 0;206 }207208 /// Remove collection sponsor.209 /// @dev EVM selector for this function is: 0x6e0326a3,210 /// or in textual repr: removeCollectionSponsor()211 function removeCollectionSponsor() public {212 require(false, stub_error);213 dummy = 0;214 }215216 /// Get current sponsor.217 ///218 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.219 /// @dev EVM selector for this function is: 0x6ec0a9f1,220 /// or in textual repr: collectionSponsor()221 function collectionSponsor() public view returns (Tuple15 memory) {222 require(false, stub_error);223 dummy;224 return Tuple15(0x0000000000000000000000000000000000000000, 0);225 }226227 /// Set limits for the collection.228 /// @dev Throws error if limit not found.229 /// @param limit Name of the limit. Valid names:230 /// "accountTokenOwnershipLimit",231 /// "sponsoredDataSize",232 /// "sponsoredDataRateLimit",233 /// "tokenLimit",234 /// "sponsorTransferTimeout",235 /// "sponsorApproveTimeout"236 /// @param value Value of the limit.237 /// @dev EVM selector for this function is: 0x6a3841db,238 /// or in textual repr: setCollectionLimit(string,uint32)239 function setCollectionLimit(string memory limit, uint32 value) public {240 require(false, stub_error);241 limit;242 value;243 dummy = 0;244 }245246 /// Set limits for the collection.247 /// @dev Throws error if limit not found.248 /// @param limit Name of the limit. Valid names:249 /// "ownerCanTransfer",250 /// "ownerCanDestroy",251 /// "transfersEnabled"252 /// @param value Value of the limit.253 /// @dev EVM selector for this function is: 0x993b7fba,254 /// or in textual repr: setCollectionLimit(string,bool)255 function setCollectionLimit(string memory limit, bool value) public {256 require(false, stub_error);257 limit;258 value;259 dummy = 0;260 }261262 /// Get contract address.263 /// @dev EVM selector for this function is: 0xf6b4dfb4,264 /// or in textual repr: contractAddress()265 function contractAddress() public view returns (address) {266 require(false, stub_error);267 dummy;268 return 0x0000000000000000000000000000000000000000;269 }270271 /// Add collection admin.272 /// @param newAdmin Address of the added administrator.273 /// @dev EVM selector for this function is: 0x92e462c7,274 /// or in textual repr: addCollectionAdmin(address)275 function addCollectionAdmin(address newAdmin) public {276 require(false, stub_error);277 newAdmin;278 dummy = 0;279 }280281 /// Remove collection admin.282 ///283 /// @param admin Address of the removed administrator.284 /// @dev EVM selector for this function is: 0xfafd7b42,285 /// or in textual repr: removeCollectionAdmin(address)286 function removeCollectionAdmin(address admin) public {287 require(false, stub_error);288 admin;289 dummy = 0;290 }291292 /// Toggle accessibility of collection nesting.293 ///294 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'295 /// @dev EVM selector for this function is: 0x112d4586,296 /// or in textual repr: setCollectionNesting(bool)297 function setCollectionNesting(bool enable) public {298 require(false, stub_error);299 enable;300 dummy = 0;301 }302303 /// Toggle accessibility of collection nesting.304 ///305 /// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'306 /// @param collections Addresses of collections that will be available for nesting.307 /// @dev EVM selector for this function is: 0x64872396,308 /// or in textual repr: setCollectionNesting(bool,address[])309 function setCollectionNesting(bool enable, address[] memory collections) public {310 require(false, stub_error);311 enable;312 collections;313 dummy = 0;314 }315316 /// Set the collection access method.317 /// @param mode Access mode318 /// 0 for Normal319 /// 1 for AllowList320 /// @dev EVM selector for this function is: 0x41835d4c,321 /// or in textual repr: setCollectionAccess(uint8)322 function setCollectionAccess(uint8 mode) public {323 require(false, stub_error);324 mode;325 dummy = 0;326 }327328 /// Checks that user allowed to operate with collection.329 ///330 /// @param user User address to check.331 /// @dev EVM selector for this function is: 0xd63a8e11,332 /// or in textual repr: allowed(address)333 function allowed(address user) public view returns (bool) {334 require(false, stub_error);335 user;336 dummy;337 return false;338 }339340 /// Add the user to the allowed list.341 ///342 /// @param user Address of a trusted user.343 /// @dev EVM selector for this function is: 0x67844fe6,344 /// or in textual repr: addToCollectionAllowList(address)345 function addToCollectionAllowList(address user) public {346 require(false, stub_error);347 user;348 dummy = 0;349 }350351 /// Remove the user from the allowed list.352 ///353 /// @param user Address of a removed user.354 /// @dev EVM selector for this function is: 0x85c51acb,355 /// or in textual repr: removeFromCollectionAllowList(address)356 function removeFromCollectionAllowList(address user) public {357 require(false, stub_error);358 user;359 dummy = 0;360 }361362 /// Switch permission for minting.363 ///364 /// @param mode Enable if "true".365 /// @dev EVM selector for this function is: 0x00018e84,366 /// or in textual repr: setCollectionMintMode(bool)367 function setCollectionMintMode(bool mode) public {368 require(false, stub_error);369 mode;370 dummy = 0;371 }372373 /// Check that account is the owner or admin of the collection374 ///375 /// @param user account to verify376 /// @return "true" if account is the owner or admin377 /// @dev EVM selector for this function is: 0x9811b0c7,378 /// or in textual repr: isOwnerOrAdmin(address)379 function isOwnerOrAdmin(address user) public view returns (bool) {380 require(false, stub_error);381 user;382 dummy;383 return false;384 }385386 /// Returns collection type387 ///388 /// @return `Fungible` or `NFT` or `ReFungible`389 /// @dev EVM selector for this function is: 0xd34b55b8,390 /// or in textual repr: uniqueCollectionType()391 function uniqueCollectionType() public view returns (string memory) {392 require(false, stub_error);393 dummy;394 return "";395 }396397 /// Get collection owner.398 ///399 /// @return Tuble with sponsor address and his substrate mirror.400 /// If address is canonical then substrate mirror is zero and vice versa.401 /// @dev EVM selector for this function is: 0xdf727d3b,402 /// or in textual repr: collectionOwner()403 function collectionOwner() public view returns (Tuple15 memory) {404 require(false, stub_error);405 dummy;406 return Tuple15(0x0000000000000000000000000000000000000000, 0);407 }408409 /// Changes collection owner to another account410 ///411 /// @dev Owner can be changed only by current owner412 /// @param newOwner new owner account413 /// @dev EVM selector for this function is: 0x13af4035,414 /// or in textual repr: setOwner(address)415 function setOwner(address newOwner) public {416 require(false, stub_error);417 newOwner;418 dummy = 0;419 }420}421422/// @dev anonymous struct423struct Tuple15 {424 address field_0;425 uint256 field_1;426}427428/// @title ERC721 Token that can be irreversibly burned (destroyed).429/// @dev the ERC-165 identifier for this interface is 0x42966c68430contract ERC721Burnable is Dummy, ERC165 {431 /// @notice Burns a specific ERC721 token.432 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized433 /// operator of the current owner.434 /// @param tokenId The NFT to approve435 /// @dev EVM selector for this function is: 0x42966c68,436 /// or in textual repr: burn(uint256)437 function burn(uint256 tokenId) public {438 require(false, stub_error);439 tokenId;440 dummy = 0;441 }442}443444/// @dev inlined interface445contract ERC721MintableEvents {446 event MintingFinished();447}448449/// @title ERC721 minting logic.450/// @dev the ERC-165 identifier for this interface is 0x68ccfe89451contract ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {452 /// @dev EVM selector for this function is: 0x05d2035b,453 /// or in textual repr: mintingFinished()454 function mintingFinished() public view returns (bool) {455 require(false, stub_error);456 dummy;457 return false;458 }459460 /// @notice Function to mint token.461 /// @dev `tokenId` should be obtained with `nextTokenId` method,462 /// unlike standard, you can't specify it manually463 /// @param to The new owner464 /// @param tokenId ID of the minted NFT465 /// @dev EVM selector for this function is: 0x40c10f19,466 /// or in textual repr: mint(address,uint256)467 function mint(address to, uint256 tokenId) public returns (bool) {468 require(false, stub_error);469 to;470 tokenId;471 dummy = 0;472 return false;473 }474475 /// @notice Function to mint token with the given tokenUri.476 /// @dev `tokenId` should be obtained with `nextTokenId` method,477 /// unlike standard, you can't specify it manually478 /// @param to The new owner479 /// @param tokenId ID of the minted NFT480 /// @param tokenUri Token URI that would be stored in the NFT properties481 /// @dev EVM selector for this function is: 0x50bb4e7f,482 /// or in textual repr: mintWithTokenURI(address,uint256,string)483 function mintWithTokenURI(484 address to,485 uint256 tokenId,486 string memory tokenUri487 ) public returns (bool) {488 require(false, stub_error);489 to;490 tokenId;491 tokenUri;492 dummy = 0;493 return false;494 }495496 /// @dev Not implemented497 /// @dev EVM selector for this function is: 0x7d64bcb4,498 /// or in textual repr: finishMinting()499 function finishMinting() public returns (bool) {500 require(false, stub_error);501 dummy = 0;502 return false;503 }504}505506/// @title Unique extensions for ERC721.507/// @dev the ERC-165 identifier for this interface is 0xd74d154f508contract ERC721UniqueExtensions is Dummy, ERC165 {509 /// @notice Transfer ownership of an NFT510 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`511 /// is the zero address. Throws if `tokenId` is not a valid NFT.512 /// @param to The new owner513 /// @param tokenId The NFT to transfer514 /// @dev EVM selector for this function is: 0xa9059cbb,515 /// or in textual repr: transfer(address,uint256)516 function transfer(address to, uint256 tokenId) public {517 require(false, stub_error);518 to;519 tokenId;520 dummy = 0;521 }522523 /// @notice Burns a specific ERC721 token.524 /// @dev Throws unless `msg.sender` is the current owner or an authorized525 /// operator for this NFT. Throws if `from` is not the current owner. Throws526 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.527 /// @param from The current owner of the NFT528 /// @param tokenId The NFT to transfer529 /// @dev EVM selector for this function is: 0x79cc6790,530 /// or in textual repr: burnFrom(address,uint256)531 function burnFrom(address from, uint256 tokenId) public {532 require(false, stub_error);533 from;534 tokenId;535 dummy = 0;536 }537538 /// @notice Returns next free NFT ID.539 /// @dev EVM selector for this function is: 0x75794a3c,540 /// or in textual repr: nextTokenId()541 function nextTokenId() public view returns (uint256) {542 require(false, stub_error);543 dummy;544 return 0;545 }546547 /// @notice Function to mint multiple tokens.548 /// @dev `tokenIds` should be an array of consecutive numbers and first number549 /// should be obtained with `nextTokenId` method550 /// @param to The new owner551 /// @param tokenIds IDs of the minted NFTs552 /// @dev EVM selector for this function is: 0x44a9945e,553 /// or in textual repr: mintBulk(address,uint256[])554 function mintBulk(address to, uint256[] memory tokenIds) public returns (bool) {555 require(false, stub_error);556 to;557 tokenIds;558 dummy = 0;559 return false;560 }561562 /// @notice Function to mint multiple tokens with the given tokenUris.563 /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive564 /// numbers and first number should be obtained with `nextTokenId` method565 /// @param to The new owner566 /// @param tokens array of pairs of token ID and token URI for minted tokens567 /// @dev EVM selector for this function is: 0x36543006,568 /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])569 function mintBulkWithTokenURI(address to, Tuple6[] memory tokens) public returns (bool) {570 require(false, stub_error);571 to;572 tokens;573 dummy = 0;574 return false;575 }576}577578/// @dev anonymous struct579struct Tuple6 {580 uint256 field_0;581 string field_1;582}583584/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension585/// @dev See https://eips.ethereum.org/EIPS/eip-721586/// @dev the ERC-165 identifier for this interface is 0x780e9d63587contract ERC721Enumerable is Dummy, ERC165 {588 /// @notice Enumerate valid NFTs589 /// @param index A counter less than `totalSupply()`590 /// @return The token identifier for the `index`th NFT,591 /// (sort order not specified)592 /// @dev EVM selector for this function is: 0x4f6ccce7,593 /// or in textual repr: tokenByIndex(uint256)594 function tokenByIndex(uint256 index) public view returns (uint256) {595 require(false, stub_error);596 index;597 dummy;598 return 0;599 }600601 /// @dev Not implemented602 /// @dev EVM selector for this function is: 0x2f745c59,603 /// or in textual repr: tokenOfOwnerByIndex(address,uint256)604 function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {605 require(false, stub_error);606 owner;607 index;608 dummy;609 return 0;610 }611612 /// @notice Count NFTs tracked by this contract613 /// @return A count of valid NFTs tracked by this contract, where each one of614 /// them has an assigned and queryable owner not equal to the zero address615 /// @dev EVM selector for this function is: 0x18160ddd,616 /// or in textual repr: totalSupply()617 function totalSupply() public view returns (uint256) {618 require(false, stub_error);619 dummy;620 return 0;621 }622}623624/// @dev inlined interface625contract ERC721Events {626 event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);627 event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);628 event ApprovalForAll(address indexed owner, address indexed operator, bool approved);629}630631/// @title ERC-721 Non-Fungible Token Standard632/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md633/// @dev the ERC-165 identifier for this interface is 0x80ac58cd634contract ERC721 is Dummy, ERC165, ERC721Events {635 /// @notice Count all NFTs assigned to an owner636 /// @dev NFTs assigned to the zero address are considered invalid, and this637 /// function throws for queries about the zero address.638 /// @param owner An address for whom to query the balance639 /// @return The number of NFTs owned by `owner`, possibly zero640 /// @dev EVM selector for this function is: 0x70a08231,641 /// or in textual repr: balanceOf(address)642 function balanceOf(address owner) public view returns (uint256) {643 require(false, stub_error);644 owner;645 dummy;646 return 0;647 }648649 /// @notice Find the owner of an NFT650 /// @dev NFTs assigned to zero address are considered invalid, and queries651 /// about them do throw.652 /// @param tokenId The identifier for an NFT653 /// @return The address of the owner of the NFT654 /// @dev EVM selector for this function is: 0x6352211e,655 /// or in textual repr: ownerOf(uint256)656 function ownerOf(uint256 tokenId) public view returns (address) {657 require(false, stub_error);658 tokenId;659 dummy;660 return 0x0000000000000000000000000000000000000000;661 }662663 /// @dev Not implemented664 /// @dev EVM selector for this function is: 0xb88d4fde,665 /// or in textual repr: safeTransferFrom(address,address,uint256,bytes)666 function safeTransferFrom(667 address from,668 address to,669 uint256 tokenId,670 bytes memory data671 ) public {672 require(false, stub_error);673 from;674 to;675 tokenId;676 data;677 dummy = 0;678 }679680 /// @dev Not implemented681 /// @dev EVM selector for this function is: 0x42842e0e,682 /// or in textual repr: safeTransferFrom(address,address,uint256)683 function safeTransferFrom(684 address from,685 address to,686 uint256 tokenId687 ) public {688 require(false, stub_error);689 from;690 to;691 tokenId;692 dummy = 0;693 }694695 /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE696 /// TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE697 /// THEY MAY BE PERMANENTLY LOST698 /// @dev Throws unless `msg.sender` is the current owner or an authorized699 /// operator for this NFT. Throws if `from` is not the current owner. Throws700 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.701 /// @param from The current owner of the NFT702 /// @param to The new owner703 /// @param tokenId The NFT to transfer704 /// @dev EVM selector for this function is: 0x23b872dd,705 /// or in textual repr: transferFrom(address,address,uint256)706 function transferFrom(707 address from,708 address to,709 uint256 tokenId710 ) public {711 require(false, stub_error);712 from;713 to;714 tokenId;715 dummy = 0;716 }717718 /// @notice Set or reaffirm the approved address for an NFT719 /// @dev The zero address indicates there is no approved address.720 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized721 /// operator of the current owner.722 /// @param approved The new approved NFT controller723 /// @param tokenId The NFT to approve724 /// @dev EVM selector for this function is: 0x095ea7b3,725 /// or in textual repr: approve(address,uint256)726 function approve(address approved, uint256 tokenId) public {727 require(false, stub_error);728 approved;729 tokenId;730 dummy = 0;731 }732733 /// @dev Not implemented734 /// @dev EVM selector for this function is: 0xa22cb465,735 /// or in textual repr: setApprovalForAll(address,bool)736 function setApprovalForAll(address operator, bool approved) public {737 require(false, stub_error);738 operator;739 approved;740 dummy = 0;741 }742743 /// @dev Not implemented744 /// @dev EVM selector for this function is: 0x081812fc,745 /// or in textual repr: getApproved(uint256)746 function getApproved(uint256 tokenId) public view returns (address) {747 require(false, stub_error);748 tokenId;749 dummy;750 return 0x0000000000000000000000000000000000000000;751 }752753 /// @dev Not implemented754 /// @dev EVM selector for this function is: 0xe985e9c5,755 /// or in textual repr: isApprovedForAll(address,address)756 function isApprovedForAll(address owner, address operator) public view returns (address) {757 require(false, stub_error);758 owner;759 operator;760 dummy;761 return 0x0000000000000000000000000000000000000000;762 }763}764765contract UniqueNFT is766 Dummy,767 ERC165,768 ERC721,769 ERC721Enumerable,770 ERC721UniqueExtensions,771 ERC721Mintable,772 ERC721Burnable,773 Collection,774 TokenProperties,775 ERC721Metadata776{}tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -16,15 +16,17 @@
/// @dev See https://eips.ethereum.org/EIPS/eip-721
/// @dev the ERC-165 identifier for this interface is 0x5b5e139f
interface 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() external view returns (string memory);
+ // /// @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() external view returns (string memory);
- /// @notice An abbreviated name for NFTs in this contract
- /// @dev EVM selector for this function is: 0x95d89b41,
- /// or in textual repr: symbol()
- function symbol() external view returns (string memory);
+ // /// @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() external view returns (string memory);
/// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
///
@@ -336,8 +338,18 @@
}
/// @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
interface 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() external view returns (string memory);
+
+ /// @notice An abbreviated name for NFTs in this contract
+ /// @dev EVM selector for this function is: 0x95d89b41,
+ /// or in textual repr: symbol()
+ function symbol() external view returns (string memory);
+
/// @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.