difftreelog
Added `set_properties` method for `TokenProperties` interface.
in: master
19 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6358,7 +6358,7 @@
[[package]]
name = "pallet-nonfungible"
-version = "0.1.5"
+version = "0.1.6"
dependencies = [
"ethereum",
"evm-coder",
@@ -6480,7 +6480,7 @@
[[package]]
name = "pallet-refungible"
-version = "0.2.4"
+version = "0.2.5"
dependencies = [
"derivative",
"ethereum",
pallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth--- a/pallets/fungible/src/stubs/UniqueFungible.sol
+++ b/pallets/fungible/src/stubs/UniqueFungible.sol
@@ -385,7 +385,7 @@
/// Get collection owner.
///
- /// @return Tuble with sponsor address and his substrate mirror.
+ /// @return Tuple with sponsor address and his substrate mirror.
/// If address is canonical then substrate mirror is zero and vice versa.
/// @dev EVM selector for this function is: 0xdf727d3b,
/// or in textual repr: collectionOwner()
pallets/nonfungible/CHANGELOG.mddiffbeforeafterboth--- a/pallets/nonfungible/CHANGELOG.md
+++ b/pallets/nonfungible/CHANGELOG.md
@@ -2,12 +2,20 @@
All notable changes to this project will be documented in this file.
+<!-- bureaucrate goes here -->
+
+## [v0.1.6] - 2022-20-10
+
+### Change
+
+- Added `set_properties` method for `TokenProperties` interface.
+
## [v0.1.5] - 2022-08-24
### Change
- - Add bound `AsRef<[u8; 32]>` to `T::CrossAccountId`.
-<!-- bureaucrate goes here -->
+- Add bound `AsRef<[u8; 32]>` to `T::CrossAccountId`.
+
## [v0.1.4] 2022-08-16
### Other changes
@@ -28,7 +36,9 @@
- build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b
## [0.1.2] - 2022-07-25
+
### Changed
+
- New `token_uri` retrieval logic:
If the collection has a `url` property and it is not empty, it is returned.
@@ -39,8 +49,9 @@
otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).
## [0.1.1] - 2022-07-14
+
### Added
- Implementation of RPC method `token_owners`.
- For reasons of compatibility with this pallet, returns only one owner if token exists.
- This was an internal request to improve the web interface and support fractionalization event.
+ For reasons of compatibility with this pallet, returns only one owner if token exists.
+ This was an internal request to improve the web interface and support fractionalization event.
pallets/nonfungible/Cargo.tomldiffbeforeafterboth--- a/pallets/nonfungible/Cargo.toml
+++ b/pallets/nonfungible/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "pallet-nonfungible"
-version = "0.1.5"
+version = "0.1.6"
license = "GPLv3"
edition = "2021"
pallets/nonfungible/src/erc.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -114,6 +114,47 @@
.map_err(dispatch_to_evm::<T>)
}
+ /// @notice Set token properties value.
+ /// @dev Throws error if `msg.sender` has no permission to edit the property.
+ /// @param tokenId ID of the token.
+ /// @param properties settable properties
+ fn set_properties(
+ &mut self,
+ caller: caller,
+ token_id: uint256,
+ properties: Vec<(string, bytes)>,
+ ) -> Result<()> {
+ let caller = T::CrossAccountId::from_eth(caller);
+ let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
+
+ let nesting_budget = self
+ .recorder
+ .weight_calls_budget(<StructureWeight<T>>::find_parent());
+
+ let properties = properties
+ .into_iter()
+ .map(|(key, value)| {
+ let key = <Vec<u8>>::from(key)
+ .try_into()
+ .map_err(|_| "key too large")?;
+
+ let value = value.0.try_into().map_err(|_| "value too large")?;
+
+ Ok(Property { key, value })
+ })
+ .collect::<Result<Vec<_>>>()?;
+
+ <Pallet<T>>::set_token_properties(
+ self,
+ &caller,
+ TokenId(token_id),
+ properties.into_iter(),
+ <Pallet<T>>::token_exists(&self, TokenId(token_id)),
+ &nesting_budget,
+ )
+ .map_err(dispatch_to_evm::<T>)
+ }
+
/// @notice Delete token property value.
/// @dev Throws error if `msg.sender` has no permission to edit the property.
/// @param tokenId ID of the token.
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 A contract that allows to set and delete token properties and change token property permissions.21/// @dev the ERC-165 identifier for this interface is 0x4136937722contract TokenProperties is Dummy, ERC165 {23 /// @notice Set permissions for token property.24 /// @dev Throws error if `msg.sender` is not admin or owner of the collection.25 /// @param key Property key.26 /// @param isMutable Permission to mutate property.27 /// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.28 /// @param tokenOwner Permission to mutate property by token owner if property is mutable.29 /// @dev EVM selector for this function is: 0x222d97fa,30 /// or in textual repr: setTokenPropertyPermission(string,bool,bool,bool)31 function setTokenPropertyPermission(32 string memory key,33 bool isMutable,34 bool collectionAdmin,35 bool tokenOwner36 ) public {37 require(false, stub_error);38 key;39 isMutable;40 collectionAdmin;41 tokenOwner;42 dummy = 0;43 }4445 /// @notice Set token property value.46 /// @dev Throws error if `msg.sender` has no permission to edit the property.47 /// @param tokenId ID of the token.48 /// @param key Property key.49 /// @param value Property value.50 /// @dev EVM selector for this function is: 0x1752d67b,51 /// or in textual repr: setProperty(uint256,string,bytes)52 function setProperty(53 uint256 tokenId,54 string memory key,55 bytes memory value56 ) public {57 require(false, stub_error);58 tokenId;59 key;60 value;61 dummy = 0;62 }6364 /// @notice Delete token property value.65 /// @dev Throws error if `msg.sender` has no permission to edit the property.66 /// @param tokenId ID of the token.67 /// @param key Property key.68 /// @dev EVM selector for this function is: 0x066111d1,69 /// or in textual repr: deleteProperty(uint256,string)70 function deleteProperty(uint256 tokenId, string memory key) public {71 require(false, stub_error);72 tokenId;73 key;74 dummy = 0;75 }7677 /// @notice Get token property value.78 /// @dev Throws error if key not found79 /// @param tokenId ID of the token.80 /// @param key Property key.81 /// @return Property value bytes82 /// @dev EVM selector for this function is: 0x7228c327,83 /// or in textual repr: property(uint256,string)84 function property(uint256 tokenId, string memory key) public view returns (bytes memory) {85 require(false, stub_error);86 tokenId;87 key;88 dummy;89 return hex"";90 }91}9293/// @title A contract that allows you to work with collections.94/// @dev the ERC-165 identifier for this interface is 0xb3152af395contract Collection is Dummy, ERC165 {96 /// Set collection property.97 ///98 /// @param key Property key.99 /// @param value Propery value.100 /// @dev EVM selector for this function is: 0x2f073f66,101 /// or in textual repr: setCollectionProperty(string,bytes)102 function setCollectionProperty(string memory key, bytes memory value) public {103 require(false, stub_error);104 key;105 value;106 dummy = 0;107 }108109 /// Set collection properties.110 ///111 /// @param properties Vector of properties key/value pair.112 /// @dev EVM selector for this function is: 0x50b26b2a,113 /// or in textual repr: setCollectionProperties((string,bytes)[])114 function setCollectionProperties(Tuple19[] memory properties) public {115 require(false, stub_error);116 properties;117 dummy = 0;118 }119120 /// Delete collection property.121 ///122 /// @param key Property key.123 /// @dev EVM selector for this function is: 0x7b7debce,124 /// or in textual repr: deleteCollectionProperty(string)125 function deleteCollectionProperty(string memory key) public {126 require(false, stub_error);127 key;128 dummy = 0;129 }130131 /// Delete collection properties.132 ///133 /// @param keys Properties keys.134 /// @dev EVM selector for this function is: 0xee206ee3,135 /// or in textual repr: deleteCollectionProperties(string[])136 function deleteCollectionProperties(string[] memory keys) public {137 require(false, stub_error);138 keys;139 dummy = 0;140 }141142 /// Get collection property.143 ///144 /// @dev Throws error if key not found.145 ///146 /// @param key Property key.147 /// @return bytes The property corresponding to the key.148 /// @dev EVM selector for this function is: 0xcf24fd6d,149 /// or in textual repr: collectionProperty(string)150 function collectionProperty(string memory key) public view returns (bytes memory) {151 require(false, stub_error);152 key;153 dummy;154 return hex"";155 }156157 /// Get collection properties.158 ///159 /// @param keys Properties keys. Empty keys for all propertyes.160 /// @return Vector of properties key/value pairs.161 /// @dev EVM selector for this function is: 0x285fb8e6,162 /// or in textual repr: collectionProperties(string[])163 function collectionProperties(string[] memory keys) public view returns (Tuple19[] memory) {164 require(false, stub_error);165 keys;166 dummy;167 return new Tuple19[](0);168 }169170 /// Set the sponsor of the collection.171 ///172 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.173 ///174 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.175 /// @dev EVM selector for this function is: 0x7623402e,176 /// or in textual repr: setCollectionSponsor(address)177 function setCollectionSponsor(address sponsor) public {178 require(false, stub_error);179 sponsor;180 dummy = 0;181 }182183 /// Set the sponsor of the collection.184 ///185 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.186 ///187 /// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.188 /// @dev EVM selector for this function is: 0x84a1d5a8,189 /// or in textual repr: setCollectionSponsorCross((address,uint256))190 function setCollectionSponsorCross(Tuple6 memory sponsor) public {191 require(false, stub_error);192 sponsor;193 dummy = 0;194 }195196 /// Whether there is a pending sponsor.197 /// @dev EVM selector for this function is: 0x058ac185,198 /// or in textual repr: hasCollectionPendingSponsor()199 function hasCollectionPendingSponsor() public view returns (bool) {200 require(false, stub_error);201 dummy;202 return false;203 }204205 /// Collection sponsorship confirmation.206 ///207 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.208 /// @dev EVM selector for this function is: 0x3c50e97a,209 /// or in textual repr: confirmCollectionSponsorship()210 function confirmCollectionSponsorship() public {211 require(false, stub_error);212 dummy = 0;213 }214215 /// Remove collection sponsor.216 /// @dev EVM selector for this function is: 0x6e0326a3,217 /// or in textual repr: removeCollectionSponsor()218 function removeCollectionSponsor() public {219 require(false, stub_error);220 dummy = 0;221 }222223 /// Get current sponsor.224 ///225 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.226 /// @dev EVM selector for this function is: 0x6ec0a9f1,227 /// or in textual repr: collectionSponsor()228 function collectionSponsor() public view returns (Tuple6 memory) {229 require(false, stub_error);230 dummy;231 return Tuple6(0x0000000000000000000000000000000000000000, 0);232 }233234 /// Set limits for the collection.235 /// @dev Throws error if limit not found.236 /// @param limit Name of the limit. Valid names:237 /// "accountTokenOwnershipLimit",238 /// "sponsoredDataSize",239 /// "sponsoredDataRateLimit",240 /// "tokenLimit",241 /// "sponsorTransferTimeout",242 /// "sponsorApproveTimeout"243 /// @param value Value of the limit.244 /// @dev EVM selector for this function is: 0x6a3841db,245 /// or in textual repr: setCollectionLimit(string,uint32)246 function setCollectionLimit(string memory limit, uint32 value) public {247 require(false, stub_error);248 limit;249 value;250 dummy = 0;251 }252253 /// Set limits for the collection.254 /// @dev Throws error if limit not found.255 /// @param limit Name of the limit. Valid names:256 /// "ownerCanTransfer",257 /// "ownerCanDestroy",258 /// "transfersEnabled"259 /// @param value Value of the limit.260 /// @dev EVM selector for this function is: 0x993b7fba,261 /// or in textual repr: setCollectionLimit(string,bool)262 function setCollectionLimit(string memory limit, bool value) public {263 require(false, stub_error);264 limit;265 value;266 dummy = 0;267 }268269 /// Get contract address.270 /// @dev EVM selector for this function is: 0xf6b4dfb4,271 /// or in textual repr: contractAddress()272 function contractAddress() public view returns (address) {273 require(false, stub_error);274 dummy;275 return 0x0000000000000000000000000000000000000000;276 }277278 /// Add collection admin.279 /// @param newAdmin Cross account administrator address.280 /// @dev EVM selector for this function is: 0x859aa7d6,281 /// or in textual repr: addCollectionAdminCross((address,uint256))282 function addCollectionAdminCross(Tuple6 memory newAdmin) public {283 require(false, stub_error);284 newAdmin;285 dummy = 0;286 }287288 /// Remove collection admin.289 /// @param admin Cross account administrator address.290 /// @dev EVM selector for this function is: 0x6c0cd173,291 /// or in textual repr: removeCollectionAdminCross((address,uint256))292 function removeCollectionAdminCross(Tuple6 memory admin) public {293 require(false, stub_error);294 admin;295 dummy = 0;296 }297298 /// Add collection admin.299 /// @param newAdmin Address of the added administrator.300 /// @dev EVM selector for this function is: 0x92e462c7,301 /// or in textual repr: addCollectionAdmin(address)302 function addCollectionAdmin(address newAdmin) public {303 require(false, stub_error);304 newAdmin;305 dummy = 0;306 }307308 /// Remove collection admin.309 ///310 /// @param admin Address of the removed administrator.311 /// @dev EVM selector for this function is: 0xfafd7b42,312 /// or in textual repr: removeCollectionAdmin(address)313 function removeCollectionAdmin(address admin) public {314 require(false, stub_error);315 admin;316 dummy = 0;317 }318319 /// Toggle accessibility of collection nesting.320 ///321 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'322 /// @dev EVM selector for this function is: 0x112d4586,323 /// or in textual repr: setCollectionNesting(bool)324 function setCollectionNesting(bool enable) public {325 require(false, stub_error);326 enable;327 dummy = 0;328 }329330 /// Toggle accessibility of collection nesting.331 ///332 /// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'333 /// @param collections Addresses of collections that will be available for nesting.334 /// @dev EVM selector for this function is: 0x64872396,335 /// or in textual repr: setCollectionNesting(bool,address[])336 function setCollectionNesting(bool enable, address[] memory collections) public {337 require(false, stub_error);338 enable;339 collections;340 dummy = 0;341 }342343 /// Set the collection access method.344 /// @param mode Access mode345 /// 0 for Normal346 /// 1 for AllowList347 /// @dev EVM selector for this function is: 0x41835d4c,348 /// or in textual repr: setCollectionAccess(uint8)349 function setCollectionAccess(uint8 mode) public {350 require(false, stub_error);351 mode;352 dummy = 0;353 }354355 /// Checks that user allowed to operate with collection.356 ///357 /// @param user User address to check.358 /// @dev EVM selector for this function is: 0xd63a8e11,359 /// or in textual repr: allowed(address)360 function allowed(address user) public view returns (bool) {361 require(false, stub_error);362 user;363 dummy;364 return false;365 }366367 /// Add the user to the allowed list.368 ///369 /// @param user Address of a trusted user.370 /// @dev EVM selector for this function is: 0x67844fe6,371 /// or in textual repr: addToCollectionAllowList(address)372 function addToCollectionAllowList(address user) public {373 require(false, stub_error);374 user;375 dummy = 0;376 }377378 /// Add user to allowed list.379 ///380 /// @param user User cross account address.381 /// @dev EVM selector for this function is: 0xa0184a3a,382 /// or in textual repr: addToCollectionAllowListCross((address,uint256))383 function addToCollectionAllowListCross(Tuple6 memory user) public {384 require(false, stub_error);385 user;386 dummy = 0;387 }388389 /// Remove the user from the allowed list.390 ///391 /// @param user Address of a removed user.392 /// @dev EVM selector for this function is: 0x85c51acb,393 /// or in textual repr: removeFromCollectionAllowList(address)394 function removeFromCollectionAllowList(address user) public {395 require(false, stub_error);396 user;397 dummy = 0;398 }399400 /// Remove user from allowed list.401 ///402 /// @param user User cross account address.403 /// @dev EVM selector for this function is: 0x09ba452a,404 /// or in textual repr: removeFromCollectionAllowListCross((address,uint256))405 function removeFromCollectionAllowListCross(Tuple6 memory user) public {406 require(false, stub_error);407 user;408 dummy = 0;409 }410411 /// Switch permission for minting.412 ///413 /// @param mode Enable if "true".414 /// @dev EVM selector for this function is: 0x00018e84,415 /// or in textual repr: setCollectionMintMode(bool)416 function setCollectionMintMode(bool mode) public {417 require(false, stub_error);418 mode;419 dummy = 0;420 }421422 /// Check that account is the owner or admin of the collection423 ///424 /// @param user account to verify425 /// @return "true" if account is the owner or admin426 /// @dev EVM selector for this function is: 0x9811b0c7,427 /// or in textual repr: isOwnerOrAdmin(address)428 function isOwnerOrAdmin(address user) public view returns (bool) {429 require(false, stub_error);430 user;431 dummy;432 return false;433 }434435 /// Check that account is the owner or admin of the collection436 ///437 /// @param user User cross account to verify438 /// @return "true" if account is the owner or admin439 /// @dev EVM selector for this function is: 0x3e75a905,440 /// or in textual repr: isOwnerOrAdminCross((address,uint256))441 function isOwnerOrAdminCross(Tuple6 memory user) public view returns (bool) {442 require(false, stub_error);443 user;444 dummy;445 return false;446 }447448 /// Returns collection type449 ///450 /// @return `Fungible` or `NFT` or `ReFungible`451 /// @dev EVM selector for this function is: 0xd34b55b8,452 /// or in textual repr: uniqueCollectionType()453 function uniqueCollectionType() public view returns (string memory) {454 require(false, stub_error);455 dummy;456 return "";457 }458459 /// Get collection owner.460 ///461 /// @return Tuble with sponsor address and his substrate mirror.462 /// If address is canonical then substrate mirror is zero and vice versa.463 /// @dev EVM selector for this function is: 0xdf727d3b,464 /// or in textual repr: collectionOwner()465 function collectionOwner() public view returns (Tuple6 memory) {466 require(false, stub_error);467 dummy;468 return Tuple6(0x0000000000000000000000000000000000000000, 0);469 }470471 /// Changes collection owner to another account472 ///473 /// @dev Owner can be changed only by current owner474 /// @param newOwner new owner account475 /// @dev EVM selector for this function is: 0x4f53e226,476 /// or in textual repr: changeCollectionOwner(address)477 function changeCollectionOwner(address newOwner) public {478 require(false, stub_error);479 newOwner;480 dummy = 0;481 }482483 /// Get collection administrators484 ///485 /// @return Vector of tuples with admins address and his substrate mirror.486 /// If address is canonical then substrate mirror is zero and vice versa.487 /// @dev EVM selector for this function is: 0x5813216b,488 /// or in textual repr: collectionAdmins()489 function collectionAdmins() public view returns (Tuple6[] memory) {490 require(false, stub_error);491 dummy;492 return new Tuple6[](0);493 }494495 /// Changes collection owner to another account496 ///497 /// @dev Owner can be changed only by current owner498 /// @param newOwner new owner cross account499 /// @dev EVM selector for this function is: 0xe5c9913f,500 /// or in textual repr: setOwnerCross((address,uint256))501 function setOwnerCross(Tuple6 memory newOwner) public {502 require(false, stub_error);503 newOwner;504 dummy = 0;505 }506}507508/// @dev anonymous struct509struct Tuple19 {510 string field_0;511 bytes field_1;512}513514/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension515/// @dev See https://eips.ethereum.org/EIPS/eip-721516/// @dev the ERC-165 identifier for this interface is 0x5b5e139f517contract ERC721Metadata is Dummy, ERC165 {518 // /// @notice A descriptive name for a collection of NFTs in this contract519 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`520 // /// @dev EVM selector for this function is: 0x06fdde03,521 // /// or in textual repr: name()522 // function name() public view returns (string memory) {523 // require(false, stub_error);524 // dummy;525 // return "";526 // }527528 // /// @notice An abbreviated name for NFTs in this contract529 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`530 // /// @dev EVM selector for this function is: 0x95d89b41,531 // /// or in textual repr: symbol()532 // function symbol() public view returns (string memory) {533 // require(false, stub_error);534 // dummy;535 // return "";536 // }537538 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.539 ///540 /// @dev If the token has a `url` property and it is not empty, it is returned.541 /// 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`.542 /// If the collection property `baseURI` is empty or absent, return "" (empty string)543 /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix544 /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).545 ///546 /// @return token's const_metadata547 /// @dev EVM selector for this function is: 0xc87b56dd,548 /// or in textual repr: tokenURI(uint256)549 function tokenURI(uint256 tokenId) public view returns (string memory) {550 require(false, stub_error);551 tokenId;552 dummy;553 return "";554 }555}556557/// @title ERC721 Token that can be irreversibly burned (destroyed).558/// @dev the ERC-165 identifier for this interface is 0x42966c68559contract ERC721Burnable is Dummy, ERC165 {560 /// @notice Burns a specific ERC721 token.561 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized562 /// operator of the current owner.563 /// @param tokenId The NFT to approve564 /// @dev EVM selector for this function is: 0x42966c68,565 /// or in textual repr: burn(uint256)566 function burn(uint256 tokenId) public {567 require(false, stub_error);568 tokenId;569 dummy = 0;570 }571}572573/// @dev inlined interface574contract ERC721UniqueMintableEvents {575 event MintingFinished();576}577578/// @title ERC721 minting logic.579/// @dev the ERC-165 identifier for this interface is 0x476ff149580contract ERC721UniqueMintable is Dummy, ERC165, ERC721UniqueMintableEvents {581 /// @dev EVM selector for this function is: 0x05d2035b,582 /// or in textual repr: mintingFinished()583 function mintingFinished() public view returns (bool) {584 require(false, stub_error);585 dummy;586 return false;587 }588589 /// @notice Function to mint token.590 /// @param to The new owner591 /// @return uint256 The id of the newly minted token592 /// @dev EVM selector for this function is: 0x6a627842,593 /// or in textual repr: mint(address)594 function mint(address to) public returns (uint256) {595 require(false, stub_error);596 to;597 dummy = 0;598 return 0;599 }600601 // /// @notice Function to mint token.602 // /// @dev `tokenId` should be obtained with `nextTokenId` method,603 // /// unlike standard, you can't specify it manually604 // /// @param to The new owner605 // /// @param tokenId ID of the minted NFT606 // /// @dev EVM selector for this function is: 0x40c10f19,607 // /// or in textual repr: mint(address,uint256)608 // function mint(address to, uint256 tokenId) public returns (bool) {609 // require(false, stub_error);610 // to;611 // tokenId;612 // dummy = 0;613 // return false;614 // }615616 /// @notice Function to mint token with the given tokenUri.617 /// @param to The new owner618 /// @param tokenUri Token URI that would be stored in the NFT properties619 /// @return uint256 The id of the newly minted token620 /// @dev EVM selector for this function is: 0x45c17782,621 /// or in textual repr: mintWithTokenURI(address,string)622 function mintWithTokenURI(address to, string memory tokenUri) public returns (uint256) {623 require(false, stub_error);624 to;625 tokenUri;626 dummy = 0;627 return 0;628 }629630 // /// @notice Function to mint token with the given tokenUri.631 // /// @dev `tokenId` should be obtained with `nextTokenId` method,632 // /// unlike standard, you can't specify it manually633 // /// @param to The new owner634 // /// @param tokenId ID of the minted NFT635 // /// @param tokenUri Token URI that would be stored in the NFT properties636 // /// @dev EVM selector for this function is: 0x50bb4e7f,637 // /// or in textual repr: mintWithTokenURI(address,uint256,string)638 // function mintWithTokenURI(address to, uint256 tokenId, string memory tokenUri) public returns (bool) {639 // require(false, stub_error);640 // to;641 // tokenId;642 // tokenUri;643 // dummy = 0;644 // return false;645 // }646647 /// @dev Not implemented648 /// @dev EVM selector for this function is: 0x7d64bcb4,649 /// or in textual repr: finishMinting()650 function finishMinting() public returns (bool) {651 require(false, stub_error);652 dummy = 0;653 return false;654 }655}656657/// @title Unique extensions for ERC721.658/// @dev the ERC-165 identifier for this interface is 0x244543ee659contract ERC721UniqueExtensions is Dummy, ERC165 {660 /// @notice A descriptive name for a collection of NFTs in this contract661 /// @dev EVM selector for this function is: 0x06fdde03,662 /// or in textual repr: name()663 function name() public view returns (string memory) {664 require(false, stub_error);665 dummy;666 return "";667 }668669 /// @notice An abbreviated name for NFTs in this contract670 /// @dev EVM selector for this function is: 0x95d89b41,671 /// or in textual repr: symbol()672 function symbol() public view returns (string memory) {673 require(false, stub_error);674 dummy;675 return "";676 }677678 /// @notice Set or reaffirm the approved address for an NFT679 /// @dev The zero address indicates there is no approved address.680 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized681 /// operator of the current owner.682 /// @param approved The new substrate address approved NFT controller683 /// @param tokenId The NFT to approve684 /// @dev EVM selector for this function is: 0x0ecd0ab0,685 /// or in textual repr: approveCross((address,uint256),uint256)686 function approveCross(Tuple6 memory approved, uint256 tokenId) public {687 require(false, stub_error);688 approved;689 tokenId;690 dummy = 0;691 }692693 /// @notice Transfer ownership of an NFT694 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`695 /// is the zero address. Throws if `tokenId` is not a valid NFT.696 /// @param to The new owner697 /// @param tokenId The NFT to transfer698 /// @dev EVM selector for this function is: 0xa9059cbb,699 /// or in textual repr: transfer(address,uint256)700 function transfer(address to, uint256 tokenId) public {701 require(false, stub_error);702 to;703 tokenId;704 dummy = 0;705 }706707 /// @notice Transfer ownership of an NFT from cross account address to cross account address708 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`709 /// is the zero address. Throws if `tokenId` is not a valid NFT.710 /// @param from Cross acccount address of current owner711 /// @param to Cross acccount address of new owner712 /// @param tokenId The NFT to transfer713 /// @dev EVM selector for this function is: 0xd5cf430b,714 /// or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)715 function transferFromCross(716 Tuple6 memory from,717 Tuple6 memory to,718 uint256 tokenId719 ) public {720 require(false, stub_error);721 from;722 to;723 tokenId;724 dummy = 0;725 }726727 /// @notice Burns a specific ERC721 token.728 /// @dev Throws unless `msg.sender` is the current owner or an authorized729 /// operator for this NFT. Throws if `from` is not the current owner. Throws730 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.731 /// @param from The current owner of the NFT732 /// @param tokenId The NFT to transfer733 /// @dev EVM selector for this function is: 0x79cc6790,734 /// or in textual repr: burnFrom(address,uint256)735 function burnFrom(address from, uint256 tokenId) public {736 require(false, stub_error);737 from;738 tokenId;739 dummy = 0;740 }741742 /// @notice Burns a specific ERC721 token.743 /// @dev Throws unless `msg.sender` is the current owner or an authorized744 /// operator for this NFT. Throws if `from` is not the current owner. Throws745 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.746 /// @param from The current owner of the NFT747 /// @param tokenId The NFT to transfer748 /// @dev EVM selector for this function is: 0xbb2f5a58,749 /// or in textual repr: burnFromCross((address,uint256),uint256)750 function burnFromCross(Tuple6 memory from, uint256 tokenId) public {751 require(false, stub_error);752 from;753 tokenId;754 dummy = 0;755 }756757 /// @notice Returns next free NFT ID.758 /// @dev EVM selector for this function is: 0x75794a3c,759 /// or in textual repr: nextTokenId()760 function nextTokenId() public view returns (uint256) {761 require(false, stub_error);762 dummy;763 return 0;764 }765 // /// @notice Function to mint multiple tokens.766 // /// @dev `tokenIds` should be an array of consecutive numbers and first number767 // /// should be obtained with `nextTokenId` method768 // /// @param to The new owner769 // /// @param tokenIds IDs of the minted NFTs770 // /// @dev EVM selector for this function is: 0x44a9945e,771 // /// or in textual repr: mintBulk(address,uint256[])772 // function mintBulk(address to, uint256[] memory tokenIds) public returns (bool) {773 // require(false, stub_error);774 // to;775 // tokenIds;776 // dummy = 0;777 // return false;778 // }779780 // /// @notice Function to mint multiple tokens with the given tokenUris.781 // /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive782 // /// numbers and first number should be obtained with `nextTokenId` method783 // /// @param to The new owner784 // /// @param tokens array of pairs of token ID and token URI for minted tokens785 // /// @dev EVM selector for this function is: 0x36543006,786 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])787 // function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) public returns (bool) {788 // require(false, stub_error);789 // to;790 // tokens;791 // dummy = 0;792 // return false;793 // }794795}796797/// @dev anonymous struct798struct Tuple8 {799 uint256 field_0;800 string field_1;801}802803/// @dev anonymous struct804struct Tuple6 {805 address field_0;806 uint256 field_1;807}808809/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension810/// @dev See https://eips.ethereum.org/EIPS/eip-721811/// @dev the ERC-165 identifier for this interface is 0x780e9d63812contract ERC721Enumerable is Dummy, ERC165 {813 /// @notice Enumerate valid NFTs814 /// @param index A counter less than `totalSupply()`815 /// @return The token identifier for the `index`th NFT,816 /// (sort order not specified)817 /// @dev EVM selector for this function is: 0x4f6ccce7,818 /// or in textual repr: tokenByIndex(uint256)819 function tokenByIndex(uint256 index) public view returns (uint256) {820 require(false, stub_error);821 index;822 dummy;823 return 0;824 }825826 /// @dev Not implemented827 /// @dev EVM selector for this function is: 0x2f745c59,828 /// or in textual repr: tokenOfOwnerByIndex(address,uint256)829 function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {830 require(false, stub_error);831 owner;832 index;833 dummy;834 return 0;835 }836837 /// @notice Count NFTs tracked by this contract838 /// @return A count of valid NFTs tracked by this contract, where each one of839 /// them has an assigned and queryable owner not equal to the zero address840 /// @dev EVM selector for this function is: 0x18160ddd,841 /// or in textual repr: totalSupply()842 function totalSupply() public view returns (uint256) {843 require(false, stub_error);844 dummy;845 return 0;846 }847}848849/// @dev inlined interface850contract ERC721Events {851 event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);852 event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);853 event ApprovalForAll(address indexed owner, address indexed operator, bool approved);854}855856/// @title ERC-721 Non-Fungible Token Standard857/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md858/// @dev the ERC-165 identifier for this interface is 0x80ac58cd859contract ERC721 is Dummy, ERC165, ERC721Events {860 /// @notice Count all NFTs assigned to an owner861 /// @dev NFTs assigned to the zero address are considered invalid, and this862 /// function throws for queries about the zero address.863 /// @param owner An address for whom to query the balance864 /// @return The number of NFTs owned by `owner`, possibly zero865 /// @dev EVM selector for this function is: 0x70a08231,866 /// or in textual repr: balanceOf(address)867 function balanceOf(address owner) public view returns (uint256) {868 require(false, stub_error);869 owner;870 dummy;871 return 0;872 }873874 /// @notice Find the owner of an NFT875 /// @dev NFTs assigned to zero address are considered invalid, and queries876 /// about them do throw.877 /// @param tokenId The identifier for an NFT878 /// @return The address of the owner of the NFT879 /// @dev EVM selector for this function is: 0x6352211e,880 /// or in textual repr: ownerOf(uint256)881 function ownerOf(uint256 tokenId) public view returns (address) {882 require(false, stub_error);883 tokenId;884 dummy;885 return 0x0000000000000000000000000000000000000000;886 }887888 /// @dev Not implemented889 /// @dev EVM selector for this function is: 0xb88d4fde,890 /// or in textual repr: safeTransferFrom(address,address,uint256,bytes)891 function safeTransferFrom(892 address from,893 address to,894 uint256 tokenId,895 bytes memory data896 ) public {897 require(false, stub_error);898 from;899 to;900 tokenId;901 data;902 dummy = 0;903 }904905 /// @dev Not implemented906 /// @dev EVM selector for this function is: 0x42842e0e,907 /// or in textual repr: safeTransferFrom(address,address,uint256)908 function safeTransferFrom(909 address from,910 address to,911 uint256 tokenId912 ) public {913 require(false, stub_error);914 from;915 to;916 tokenId;917 dummy = 0;918 }919920 /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE921 /// TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE922 /// THEY MAY BE PERMANENTLY LOST923 /// @dev Throws unless `msg.sender` is the current owner or an authorized924 /// operator for this NFT. Throws if `from` is not the current owner. Throws925 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.926 /// @param from The current owner of the NFT927 /// @param to The new owner928 /// @param tokenId The NFT to transfer929 /// @dev EVM selector for this function is: 0x23b872dd,930 /// or in textual repr: transferFrom(address,address,uint256)931 function transferFrom(932 address from,933 address to,934 uint256 tokenId935 ) public {936 require(false, stub_error);937 from;938 to;939 tokenId;940 dummy = 0;941 }942943 /// @notice Set or reaffirm the approved address for an NFT944 /// @dev The zero address indicates there is no approved address.945 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized946 /// operator of the current owner.947 /// @param approved The new approved NFT controller948 /// @param tokenId The NFT to approve949 /// @dev EVM selector for this function is: 0x095ea7b3,950 /// or in textual repr: approve(address,uint256)951 function approve(address approved, uint256 tokenId) public {952 require(false, stub_error);953 approved;954 tokenId;955 dummy = 0;956 }957958 /// @dev Not implemented959 /// @dev EVM selector for this function is: 0xa22cb465,960 /// or in textual repr: setApprovalForAll(address,bool)961 function setApprovalForAll(address operator, bool approved) public {962 require(false, stub_error);963 operator;964 approved;965 dummy = 0;966 }967968 /// @dev Not implemented969 /// @dev EVM selector for this function is: 0x081812fc,970 /// or in textual repr: getApproved(uint256)971 function getApproved(uint256 tokenId) public view returns (address) {972 require(false, stub_error);973 tokenId;974 dummy;975 return 0x0000000000000000000000000000000000000000;976 }977978 /// @dev Not implemented979 /// @dev EVM selector for this function is: 0xe985e9c5,980 /// or in textual repr: isApprovedForAll(address,address)981 function isApprovedForAll(address owner, address operator) public view returns (address) {982 require(false, stub_error);983 owner;984 operator;985 dummy;986 return 0x0000000000000000000000000000000000000000;987 }988}989990contract UniqueNFT is991 Dummy,992 ERC165,993 ERC721,994 ERC721Enumerable,995 ERC721UniqueExtensions,996 ERC721UniqueMintable,997 ERC721Burnable,998 ERC721Metadata,999 Collection,1000 TokenProperties1001{}1// 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 A contract that allows to set and delete token properties and change token property permissions.21/// @dev the ERC-165 identifier for this interface is 0x55dba91922contract TokenProperties is Dummy, ERC165 {23 /// @notice Set permissions for token property.24 /// @dev Throws error if `msg.sender` is not admin or owner of the collection.25 /// @param key Property key.26 /// @param isMutable Permission to mutate property.27 /// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.28 /// @param tokenOwner Permission to mutate property by token owner if property is mutable.29 /// @dev EVM selector for this function is: 0x222d97fa,30 /// or in textual repr: setTokenPropertyPermission(string,bool,bool,bool)31 function setTokenPropertyPermission(32 string memory key,33 bool isMutable,34 bool collectionAdmin,35 bool tokenOwner36 ) public {37 require(false, stub_error);38 key;39 isMutable;40 collectionAdmin;41 tokenOwner;42 dummy = 0;43 }4445 /// @notice Set token property value.46 /// @dev Throws error if `msg.sender` has no permission to edit the property.47 /// @param tokenId ID of the token.48 /// @param key Property key.49 /// @param value Property value.50 /// @dev EVM selector for this function is: 0x1752d67b,51 /// or in textual repr: setProperty(uint256,string,bytes)52 function setProperty(53 uint256 tokenId,54 string memory key,55 bytes memory value56 ) public {57 require(false, stub_error);58 tokenId;59 key;60 value;61 dummy = 0;62 }6364 /// @notice Set token properties value.65 /// @dev Throws error if `msg.sender` has no permission to edit the property.66 /// @param tokenId ID of the token.67 /// @param properties settable properties68 /// @dev EVM selector for this function is: 0x14ed3a6e,69 /// or in textual repr: setProperties(uint256,(string,bytes)[])70 function setProperties(uint256 tokenId, Tuple19[] memory properties) public {71 require(false, stub_error);72 tokenId;73 properties;74 dummy = 0;75 }7677 /// @notice Delete token property value.78 /// @dev Throws error if `msg.sender` has no permission to edit the property.79 /// @param tokenId ID of the token.80 /// @param key Property key.81 /// @dev EVM selector for this function is: 0x066111d1,82 /// or in textual repr: deleteProperty(uint256,string)83 function deleteProperty(uint256 tokenId, string memory key) public {84 require(false, stub_error);85 tokenId;86 key;87 dummy = 0;88 }8990 /// @notice Get token property value.91 /// @dev Throws error if key not found92 /// @param tokenId ID of the token.93 /// @param key Property key.94 /// @return Property value bytes95 /// @dev EVM selector for this function is: 0x7228c327,96 /// or in textual repr: property(uint256,string)97 function property(uint256 tokenId, string memory key) public view returns (bytes memory) {98 require(false, stub_error);99 tokenId;100 key;101 dummy;102 return hex"";103 }104}105106/// @title A contract that allows you to work with collections.107/// @dev the ERC-165 identifier for this interface is 0xb3152af3108contract Collection is Dummy, ERC165 {109 /// Set collection property.110 ///111 /// @param key Property key.112 /// @param value Propery value.113 /// @dev EVM selector for this function is: 0x2f073f66,114 /// or in textual repr: setCollectionProperty(string,bytes)115 function setCollectionProperty(string memory key, bytes memory value) public {116 require(false, stub_error);117 key;118 value;119 dummy = 0;120 }121122 /// Set collection properties.123 ///124 /// @param properties Vector of properties key/value pair.125 /// @dev EVM selector for this function is: 0x50b26b2a,126 /// or in textual repr: setCollectionProperties((string,bytes)[])127 function setCollectionProperties(Tuple19[] memory properties) public {128 require(false, stub_error);129 properties;130 dummy = 0;131 }132133 /// Delete collection property.134 ///135 /// @param key Property key.136 /// @dev EVM selector for this function is: 0x7b7debce,137 /// or in textual repr: deleteCollectionProperty(string)138 function deleteCollectionProperty(string memory key) public {139 require(false, stub_error);140 key;141 dummy = 0;142 }143144 /// Delete collection properties.145 ///146 /// @param keys Properties keys.147 /// @dev EVM selector for this function is: 0xee206ee3,148 /// or in textual repr: deleteCollectionProperties(string[])149 function deleteCollectionProperties(string[] memory keys) public {150 require(false, stub_error);151 keys;152 dummy = 0;153 }154155 /// Get collection property.156 ///157 /// @dev Throws error if key not found.158 ///159 /// @param key Property key.160 /// @return bytes The property corresponding to the key.161 /// @dev EVM selector for this function is: 0xcf24fd6d,162 /// or in textual repr: collectionProperty(string)163 function collectionProperty(string memory key) public view returns (bytes memory) {164 require(false, stub_error);165 key;166 dummy;167 return hex"";168 }169170 /// Get collection properties.171 ///172 /// @param keys Properties keys. Empty keys for all propertyes.173 /// @return Vector of properties key/value pairs.174 /// @dev EVM selector for this function is: 0x285fb8e6,175 /// or in textual repr: collectionProperties(string[])176 function collectionProperties(string[] memory keys) public view returns (Tuple19[] memory) {177 require(false, stub_error);178 keys;179 dummy;180 return new Tuple19[](0);181 }182183 /// Set the sponsor of the collection.184 ///185 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.186 ///187 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.188 /// @dev EVM selector for this function is: 0x7623402e,189 /// or in textual repr: setCollectionSponsor(address)190 function setCollectionSponsor(address sponsor) public {191 require(false, stub_error);192 sponsor;193 dummy = 0;194 }195196 /// Set the sponsor of the collection.197 ///198 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.199 ///200 /// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.201 /// @dev EVM selector for this function is: 0x84a1d5a8,202 /// or in textual repr: setCollectionSponsorCross((address,uint256))203 function setCollectionSponsorCross(Tuple6 memory sponsor) public {204 require(false, stub_error);205 sponsor;206 dummy = 0;207 }208209 /// Whether there is a pending sponsor.210 /// @dev EVM selector for this function is: 0x058ac185,211 /// or in textual repr: hasCollectionPendingSponsor()212 function hasCollectionPendingSponsor() public view returns (bool) {213 require(false, stub_error);214 dummy;215 return false;216 }217218 /// Collection sponsorship confirmation.219 ///220 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.221 /// @dev EVM selector for this function is: 0x3c50e97a,222 /// or in textual repr: confirmCollectionSponsorship()223 function confirmCollectionSponsorship() public {224 require(false, stub_error);225 dummy = 0;226 }227228 /// Remove collection sponsor.229 /// @dev EVM selector for this function is: 0x6e0326a3,230 /// or in textual repr: removeCollectionSponsor()231 function removeCollectionSponsor() public {232 require(false, stub_error);233 dummy = 0;234 }235236 /// Get current sponsor.237 ///238 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.239 /// @dev EVM selector for this function is: 0x6ec0a9f1,240 /// or in textual repr: collectionSponsor()241 function collectionSponsor() public view returns (Tuple6 memory) {242 require(false, stub_error);243 dummy;244 return Tuple6(0x0000000000000000000000000000000000000000, 0);245 }246247 /// Set limits for the collection.248 /// @dev Throws error if limit not found.249 /// @param limit Name of the limit. Valid names:250 /// "accountTokenOwnershipLimit",251 /// "sponsoredDataSize",252 /// "sponsoredDataRateLimit",253 /// "tokenLimit",254 /// "sponsorTransferTimeout",255 /// "sponsorApproveTimeout"256 /// @param value Value of the limit.257 /// @dev EVM selector for this function is: 0x6a3841db,258 /// or in textual repr: setCollectionLimit(string,uint32)259 function setCollectionLimit(string memory limit, uint32 value) public {260 require(false, stub_error);261 limit;262 value;263 dummy = 0;264 }265266 /// Set limits for the collection.267 /// @dev Throws error if limit not found.268 /// @param limit Name of the limit. Valid names:269 /// "ownerCanTransfer",270 /// "ownerCanDestroy",271 /// "transfersEnabled"272 /// @param value Value of the limit.273 /// @dev EVM selector for this function is: 0x993b7fba,274 /// or in textual repr: setCollectionLimit(string,bool)275 function setCollectionLimit(string memory limit, bool value) public {276 require(false, stub_error);277 limit;278 value;279 dummy = 0;280 }281282 /// Get contract address.283 /// @dev EVM selector for this function is: 0xf6b4dfb4,284 /// or in textual repr: contractAddress()285 function contractAddress() public view returns (address) {286 require(false, stub_error);287 dummy;288 return 0x0000000000000000000000000000000000000000;289 }290291 /// Add collection admin.292 /// @param newAdmin Cross account administrator address.293 /// @dev EVM selector for this function is: 0x859aa7d6,294 /// or in textual repr: addCollectionAdminCross((address,uint256))295 function addCollectionAdminCross(Tuple6 memory newAdmin) public {296 require(false, stub_error);297 newAdmin;298 dummy = 0;299 }300301 /// Remove collection admin.302 /// @param admin Cross account administrator address.303 /// @dev EVM selector for this function is: 0x6c0cd173,304 /// or in textual repr: removeCollectionAdminCross((address,uint256))305 function removeCollectionAdminCross(Tuple6 memory admin) public {306 require(false, stub_error);307 admin;308 dummy = 0;309 }310311 /// Add collection admin.312 /// @param newAdmin Address of the added administrator.313 /// @dev EVM selector for this function is: 0x92e462c7,314 /// or in textual repr: addCollectionAdmin(address)315 function addCollectionAdmin(address newAdmin) public {316 require(false, stub_error);317 newAdmin;318 dummy = 0;319 }320321 /// Remove collection admin.322 ///323 /// @param admin Address of the removed administrator.324 /// @dev EVM selector for this function is: 0xfafd7b42,325 /// or in textual repr: removeCollectionAdmin(address)326 function removeCollectionAdmin(address admin) public {327 require(false, stub_error);328 admin;329 dummy = 0;330 }331332 /// Toggle accessibility of collection nesting.333 ///334 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'335 /// @dev EVM selector for this function is: 0x112d4586,336 /// or in textual repr: setCollectionNesting(bool)337 function setCollectionNesting(bool enable) public {338 require(false, stub_error);339 enable;340 dummy = 0;341 }342343 /// Toggle accessibility of collection nesting.344 ///345 /// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'346 /// @param collections Addresses of collections that will be available for nesting.347 /// @dev EVM selector for this function is: 0x64872396,348 /// or in textual repr: setCollectionNesting(bool,address[])349 function setCollectionNesting(bool enable, address[] memory collections) public {350 require(false, stub_error);351 enable;352 collections;353 dummy = 0;354 }355356 /// Set the collection access method.357 /// @param mode Access mode358 /// 0 for Normal359 /// 1 for AllowList360 /// @dev EVM selector for this function is: 0x41835d4c,361 /// or in textual repr: setCollectionAccess(uint8)362 function setCollectionAccess(uint8 mode) public {363 require(false, stub_error);364 mode;365 dummy = 0;366 }367368 /// Checks that user allowed to operate with collection.369 ///370 /// @param user User address to check.371 /// @dev EVM selector for this function is: 0xd63a8e11,372 /// or in textual repr: allowed(address)373 function allowed(address user) public view returns (bool) {374 require(false, stub_error);375 user;376 dummy;377 return false;378 }379380 /// Add the user to the allowed list.381 ///382 /// @param user Address of a trusted user.383 /// @dev EVM selector for this function is: 0x67844fe6,384 /// or in textual repr: addToCollectionAllowList(address)385 function addToCollectionAllowList(address user) public {386 require(false, stub_error);387 user;388 dummy = 0;389 }390391 /// Add user to allowed list.392 ///393 /// @param user User cross account address.394 /// @dev EVM selector for this function is: 0xa0184a3a,395 /// or in textual repr: addToCollectionAllowListCross((address,uint256))396 function addToCollectionAllowListCross(Tuple6 memory user) public {397 require(false, stub_error);398 user;399 dummy = 0;400 }401402 /// Remove the user from the allowed list.403 ///404 /// @param user Address of a removed user.405 /// @dev EVM selector for this function is: 0x85c51acb,406 /// or in textual repr: removeFromCollectionAllowList(address)407 function removeFromCollectionAllowList(address user) public {408 require(false, stub_error);409 user;410 dummy = 0;411 }412413 /// Remove user from allowed list.414 ///415 /// @param user User cross account address.416 /// @dev EVM selector for this function is: 0x09ba452a,417 /// or in textual repr: removeFromCollectionAllowListCross((address,uint256))418 function removeFromCollectionAllowListCross(Tuple6 memory user) public {419 require(false, stub_error);420 user;421 dummy = 0;422 }423424 /// Switch permission for minting.425 ///426 /// @param mode Enable if "true".427 /// @dev EVM selector for this function is: 0x00018e84,428 /// or in textual repr: setCollectionMintMode(bool)429 function setCollectionMintMode(bool mode) public {430 require(false, stub_error);431 mode;432 dummy = 0;433 }434435 /// Check that account is the owner or admin of the collection436 ///437 /// @param user account to verify438 /// @return "true" if account is the owner or admin439 /// @dev EVM selector for this function is: 0x9811b0c7,440 /// or in textual repr: isOwnerOrAdmin(address)441 function isOwnerOrAdmin(address user) public view returns (bool) {442 require(false, stub_error);443 user;444 dummy;445 return false;446 }447448 /// Check that account is the owner or admin of the collection449 ///450 /// @param user User cross account to verify451 /// @return "true" if account is the owner or admin452 /// @dev EVM selector for this function is: 0x3e75a905,453 /// or in textual repr: isOwnerOrAdminCross((address,uint256))454 function isOwnerOrAdminCross(Tuple6 memory user) public view returns (bool) {455 require(false, stub_error);456 user;457 dummy;458 return false;459 }460461 /// Returns collection type462 ///463 /// @return `Fungible` or `NFT` or `ReFungible`464 /// @dev EVM selector for this function is: 0xd34b55b8,465 /// or in textual repr: uniqueCollectionType()466 function uniqueCollectionType() public view returns (string memory) {467 require(false, stub_error);468 dummy;469 return "";470 }471472 /// Get collection owner.473 ///474 /// @return Tuple with sponsor address and his substrate mirror.475 /// If address is canonical then substrate mirror is zero and vice versa.476 /// @dev EVM selector for this function is: 0xdf727d3b,477 /// or in textual repr: collectionOwner()478 function collectionOwner() public view returns (Tuple6 memory) {479 require(false, stub_error);480 dummy;481 return Tuple6(0x0000000000000000000000000000000000000000, 0);482 }483484 /// Changes collection owner to another account485 ///486 /// @dev Owner can be changed only by current owner487 /// @param newOwner new owner account488 /// @dev EVM selector for this function is: 0x4f53e226,489 /// or in textual repr: changeCollectionOwner(address)490 function changeCollectionOwner(address newOwner) public {491 require(false, stub_error);492 newOwner;493 dummy = 0;494 }495496 /// Get collection administrators497 ///498 /// @return Vector of tuples with admins address and his substrate mirror.499 /// If address is canonical then substrate mirror is zero and vice versa.500 /// @dev EVM selector for this function is: 0x5813216b,501 /// or in textual repr: collectionAdmins()502 function collectionAdmins() public view returns (Tuple6[] memory) {503 require(false, stub_error);504 dummy;505 return new Tuple6[](0);506 }507508 /// Changes collection owner to another account509 ///510 /// @dev Owner can be changed only by current owner511 /// @param newOwner new owner cross account512 /// @dev EVM selector for this function is: 0xe5c9913f,513 /// or in textual repr: setOwnerCross((address,uint256))514 function setOwnerCross(Tuple6 memory newOwner) public {515 require(false, stub_error);516 newOwner;517 dummy = 0;518 }519}520521/// @dev anonymous struct522struct Tuple19 {523 string field_0;524 bytes field_1;525}526527/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension528/// @dev See https://eips.ethereum.org/EIPS/eip-721529/// @dev the ERC-165 identifier for this interface is 0x5b5e139f530contract ERC721Metadata is Dummy, ERC165 {531 // /// @notice A descriptive name for a collection of NFTs in this contract532 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`533 // /// @dev EVM selector for this function is: 0x06fdde03,534 // /// or in textual repr: name()535 // function name() public view returns (string memory) {536 // require(false, stub_error);537 // dummy;538 // return "";539 // }540541 // /// @notice An abbreviated name for NFTs in this contract542 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`543 // /// @dev EVM selector for this function is: 0x95d89b41,544 // /// or in textual repr: symbol()545 // function symbol() public view returns (string memory) {546 // require(false, stub_error);547 // dummy;548 // return "";549 // }550551 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.552 ///553 /// @dev If the token has a `url` property and it is not empty, it is returned.554 /// 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`.555 /// If the collection property `baseURI` is empty or absent, return "" (empty string)556 /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix557 /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).558 ///559 /// @return token's const_metadata560 /// @dev EVM selector for this function is: 0xc87b56dd,561 /// or in textual repr: tokenURI(uint256)562 function tokenURI(uint256 tokenId) public view returns (string memory) {563 require(false, stub_error);564 tokenId;565 dummy;566 return "";567 }568}569570/// @title ERC721 Token that can be irreversibly burned (destroyed).571/// @dev the ERC-165 identifier for this interface is 0x42966c68572contract ERC721Burnable is Dummy, ERC165 {573 /// @notice Burns a specific ERC721 token.574 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized575 /// operator of the current owner.576 /// @param tokenId The NFT to approve577 /// @dev EVM selector for this function is: 0x42966c68,578 /// or in textual repr: burn(uint256)579 function burn(uint256 tokenId) public {580 require(false, stub_error);581 tokenId;582 dummy = 0;583 }584}585586/// @dev inlined interface587contract ERC721UniqueMintableEvents {588 event MintingFinished();589}590591/// @title ERC721 minting logic.592/// @dev the ERC-165 identifier for this interface is 0x476ff149593contract ERC721UniqueMintable is Dummy, ERC165, ERC721UniqueMintableEvents {594 /// @dev EVM selector for this function is: 0x05d2035b,595 /// or in textual repr: mintingFinished()596 function mintingFinished() public view returns (bool) {597 require(false, stub_error);598 dummy;599 return false;600 }601602 /// @notice Function to mint token.603 /// @param to The new owner604 /// @return uint256 The id of the newly minted token605 /// @dev EVM selector for this function is: 0x6a627842,606 /// or in textual repr: mint(address)607 function mint(address to) public returns (uint256) {608 require(false, stub_error);609 to;610 dummy = 0;611 return 0;612 }613614 // /// @notice Function to mint token.615 // /// @dev `tokenId` should be obtained with `nextTokenId` method,616 // /// unlike standard, you can't specify it manually617 // /// @param to The new owner618 // /// @param tokenId ID of the minted NFT619 // /// @dev EVM selector for this function is: 0x40c10f19,620 // /// or in textual repr: mint(address,uint256)621 // function mint(address to, uint256 tokenId) public returns (bool) {622 // require(false, stub_error);623 // to;624 // tokenId;625 // dummy = 0;626 // return false;627 // }628629 /// @notice Function to mint token with the given tokenUri.630 /// @param to The new owner631 /// @param tokenUri Token URI that would be stored in the NFT properties632 /// @return uint256 The id of the newly minted token633 /// @dev EVM selector for this function is: 0x45c17782,634 /// or in textual repr: mintWithTokenURI(address,string)635 function mintWithTokenURI(address to, string memory tokenUri) public returns (uint256) {636 require(false, stub_error);637 to;638 tokenUri;639 dummy = 0;640 return 0;641 }642643 // /// @notice Function to mint token with the given tokenUri.644 // /// @dev `tokenId` should be obtained with `nextTokenId` method,645 // /// unlike standard, you can't specify it manually646 // /// @param to The new owner647 // /// @param tokenId ID of the minted NFT648 // /// @param tokenUri Token URI that would be stored in the NFT properties649 // /// @dev EVM selector for this function is: 0x50bb4e7f,650 // /// or in textual repr: mintWithTokenURI(address,uint256,string)651 // function mintWithTokenURI(address to, uint256 tokenId, string memory tokenUri) public returns (bool) {652 // require(false, stub_error);653 // to;654 // tokenId;655 // tokenUri;656 // dummy = 0;657 // return false;658 // }659660 /// @dev Not implemented661 /// @dev EVM selector for this function is: 0x7d64bcb4,662 /// or in textual repr: finishMinting()663 function finishMinting() public returns (bool) {664 require(false, stub_error);665 dummy = 0;666 return false;667 }668}669670/// @title Unique extensions for ERC721.671/// @dev the ERC-165 identifier for this interface is 0x244543ee672contract ERC721UniqueExtensions is Dummy, ERC165 {673 /// @notice A descriptive name for a collection of NFTs in this contract674 /// @dev EVM selector for this function is: 0x06fdde03,675 /// or in textual repr: name()676 function name() public view returns (string memory) {677 require(false, stub_error);678 dummy;679 return "";680 }681682 /// @notice An abbreviated name for NFTs in this contract683 /// @dev EVM selector for this function is: 0x95d89b41,684 /// or in textual repr: symbol()685 function symbol() public view returns (string memory) {686 require(false, stub_error);687 dummy;688 return "";689 }690691 /// @notice Set or reaffirm the approved address for an NFT692 /// @dev The zero address indicates there is no approved address.693 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized694 /// operator of the current owner.695 /// @param approved The new substrate address approved NFT controller696 /// @param tokenId The NFT to approve697 /// @dev EVM selector for this function is: 0x0ecd0ab0,698 /// or in textual repr: approveCross((address,uint256),uint256)699 function approveCross(Tuple6 memory approved, uint256 tokenId) public {700 require(false, stub_error);701 approved;702 tokenId;703 dummy = 0;704 }705706 /// @notice Transfer ownership of an NFT707 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`708 /// is the zero address. Throws if `tokenId` is not a valid NFT.709 /// @param to The new owner710 /// @param tokenId The NFT to transfer711 /// @dev EVM selector for this function is: 0xa9059cbb,712 /// or in textual repr: transfer(address,uint256)713 function transfer(address to, uint256 tokenId) public {714 require(false, stub_error);715 to;716 tokenId;717 dummy = 0;718 }719720 /// @notice Transfer ownership of an NFT from cross account address to cross account address721 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`722 /// is the zero address. Throws if `tokenId` is not a valid NFT.723 /// @param from Cross acccount address of current owner724 /// @param to Cross acccount address of new owner725 /// @param tokenId The NFT to transfer726 /// @dev EVM selector for this function is: 0xd5cf430b,727 /// or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)728 function transferFromCross(729 Tuple6 memory from,730 Tuple6 memory to,731 uint256 tokenId732 ) public {733 require(false, stub_error);734 from;735 to;736 tokenId;737 dummy = 0;738 }739740 /// @notice Burns a specific ERC721 token.741 /// @dev Throws unless `msg.sender` is the current owner or an authorized742 /// operator for this NFT. Throws if `from` is not the current owner. Throws743 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.744 /// @param from The current owner of the NFT745 /// @param tokenId The NFT to transfer746 /// @dev EVM selector for this function is: 0x79cc6790,747 /// or in textual repr: burnFrom(address,uint256)748 function burnFrom(address from, uint256 tokenId) public {749 require(false, stub_error);750 from;751 tokenId;752 dummy = 0;753 }754755 /// @notice Burns a specific ERC721 token.756 /// @dev Throws unless `msg.sender` is the current owner or an authorized757 /// operator for this NFT. Throws if `from` is not the current owner. Throws758 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.759 /// @param from The current owner of the NFT760 /// @param tokenId The NFT to transfer761 /// @dev EVM selector for this function is: 0xbb2f5a58,762 /// or in textual repr: burnFromCross((address,uint256),uint256)763 function burnFromCross(Tuple6 memory from, uint256 tokenId) public {764 require(false, stub_error);765 from;766 tokenId;767 dummy = 0;768 }769770 /// @notice Returns next free NFT ID.771 /// @dev EVM selector for this function is: 0x75794a3c,772 /// or in textual repr: nextTokenId()773 function nextTokenId() public view returns (uint256) {774 require(false, stub_error);775 dummy;776 return 0;777 }778 // /// @notice Function to mint multiple tokens.779 // /// @dev `tokenIds` should be an array of consecutive numbers and first number780 // /// should be obtained with `nextTokenId` method781 // /// @param to The new owner782 // /// @param tokenIds IDs of the minted NFTs783 // /// @dev EVM selector for this function is: 0x44a9945e,784 // /// or in textual repr: mintBulk(address,uint256[])785 // function mintBulk(address to, uint256[] memory tokenIds) public returns (bool) {786 // require(false, stub_error);787 // to;788 // tokenIds;789 // dummy = 0;790 // return false;791 // }792793 // /// @notice Function to mint multiple tokens with the given tokenUris.794 // /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive795 // /// numbers and first number should be obtained with `nextTokenId` method796 // /// @param to The new owner797 // /// @param tokens array of pairs of token ID and token URI for minted tokens798 // /// @dev EVM selector for this function is: 0x36543006,799 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])800 // function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) public returns (bool) {801 // require(false, stub_error);802 // to;803 // tokens;804 // dummy = 0;805 // return false;806 // }807808}809810/// @dev anonymous struct811struct Tuple8 {812 uint256 field_0;813 string field_1;814}815816/// @dev anonymous struct817struct Tuple6 {818 address field_0;819 uint256 field_1;820}821822/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension823/// @dev See https://eips.ethereum.org/EIPS/eip-721824/// @dev the ERC-165 identifier for this interface is 0x780e9d63825contract ERC721Enumerable is Dummy, ERC165 {826 /// @notice Enumerate valid NFTs827 /// @param index A counter less than `totalSupply()`828 /// @return The token identifier for the `index`th NFT,829 /// (sort order not specified)830 /// @dev EVM selector for this function is: 0x4f6ccce7,831 /// or in textual repr: tokenByIndex(uint256)832 function tokenByIndex(uint256 index) public view returns (uint256) {833 require(false, stub_error);834 index;835 dummy;836 return 0;837 }838839 /// @dev Not implemented840 /// @dev EVM selector for this function is: 0x2f745c59,841 /// or in textual repr: tokenOfOwnerByIndex(address,uint256)842 function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {843 require(false, stub_error);844 owner;845 index;846 dummy;847 return 0;848 }849850 /// @notice Count NFTs tracked by this contract851 /// @return A count of valid NFTs tracked by this contract, where each one of852 /// them has an assigned and queryable owner not equal to the zero address853 /// @dev EVM selector for this function is: 0x18160ddd,854 /// or in textual repr: totalSupply()855 function totalSupply() public view returns (uint256) {856 require(false, stub_error);857 dummy;858 return 0;859 }860}861862/// @dev inlined interface863contract ERC721Events {864 event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);865 event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);866 event ApprovalForAll(address indexed owner, address indexed operator, bool approved);867}868869/// @title ERC-721 Non-Fungible Token Standard870/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md871/// @dev the ERC-165 identifier for this interface is 0x80ac58cd872contract ERC721 is Dummy, ERC165, ERC721Events {873 /// @notice Count all NFTs assigned to an owner874 /// @dev NFTs assigned to the zero address are considered invalid, and this875 /// function throws for queries about the zero address.876 /// @param owner An address for whom to query the balance877 /// @return The number of NFTs owned by `owner`, possibly zero878 /// @dev EVM selector for this function is: 0x70a08231,879 /// or in textual repr: balanceOf(address)880 function balanceOf(address owner) public view returns (uint256) {881 require(false, stub_error);882 owner;883 dummy;884 return 0;885 }886887 /// @notice Find the owner of an NFT888 /// @dev NFTs assigned to zero address are considered invalid, and queries889 /// about them do throw.890 /// @param tokenId The identifier for an NFT891 /// @return The address of the owner of the NFT892 /// @dev EVM selector for this function is: 0x6352211e,893 /// or in textual repr: ownerOf(uint256)894 function ownerOf(uint256 tokenId) public view returns (address) {895 require(false, stub_error);896 tokenId;897 dummy;898 return 0x0000000000000000000000000000000000000000;899 }900901 /// @dev Not implemented902 /// @dev EVM selector for this function is: 0xb88d4fde,903 /// or in textual repr: safeTransferFrom(address,address,uint256,bytes)904 function safeTransferFrom(905 address from,906 address to,907 uint256 tokenId,908 bytes memory data909 ) public {910 require(false, stub_error);911 from;912 to;913 tokenId;914 data;915 dummy = 0;916 }917918 /// @dev Not implemented919 /// @dev EVM selector for this function is: 0x42842e0e,920 /// or in textual repr: safeTransferFrom(address,address,uint256)921 function safeTransferFrom(922 address from,923 address to,924 uint256 tokenId925 ) public {926 require(false, stub_error);927 from;928 to;929 tokenId;930 dummy = 0;931 }932933 /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE934 /// TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE935 /// THEY MAY BE PERMANENTLY LOST936 /// @dev Throws unless `msg.sender` is the current owner or an authorized937 /// operator for this NFT. Throws if `from` is not the current owner. Throws938 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.939 /// @param from The current owner of the NFT940 /// @param to The new owner941 /// @param tokenId The NFT to transfer942 /// @dev EVM selector for this function is: 0x23b872dd,943 /// or in textual repr: transferFrom(address,address,uint256)944 function transferFrom(945 address from,946 address to,947 uint256 tokenId948 ) public {949 require(false, stub_error);950 from;951 to;952 tokenId;953 dummy = 0;954 }955956 /// @notice Set or reaffirm the approved address for an NFT957 /// @dev The zero address indicates there is no approved address.958 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized959 /// operator of the current owner.960 /// @param approved The new approved NFT controller961 /// @param tokenId The NFT to approve962 /// @dev EVM selector for this function is: 0x095ea7b3,963 /// or in textual repr: approve(address,uint256)964 function approve(address approved, uint256 tokenId) public {965 require(false, stub_error);966 approved;967 tokenId;968 dummy = 0;969 }970971 /// @dev Not implemented972 /// @dev EVM selector for this function is: 0xa22cb465,973 /// or in textual repr: setApprovalForAll(address,bool)974 function setApprovalForAll(address operator, bool approved) public {975 require(false, stub_error);976 operator;977 approved;978 dummy = 0;979 }980981 /// @dev Not implemented982 /// @dev EVM selector for this function is: 0x081812fc,983 /// or in textual repr: getApproved(uint256)984 function getApproved(uint256 tokenId) public view returns (address) {985 require(false, stub_error);986 tokenId;987 dummy;988 return 0x0000000000000000000000000000000000000000;989 }990991 /// @dev Not implemented992 /// @dev EVM selector for this function is: 0xe985e9c5,993 /// or in textual repr: isApprovedForAll(address,address)994 function isApprovedForAll(address owner, address operator) public view returns (address) {995 require(false, stub_error);996 owner;997 operator;998 dummy;999 return 0x0000000000000000000000000000000000000000;1000 }1001}10021003contract UniqueNFT is1004 Dummy,1005 ERC165,1006 ERC721,1007 ERC721Enumerable,1008 ERC721UniqueExtensions,1009 ERC721UniqueMintable,1010 ERC721Burnable,1011 ERC721Metadata,1012 Collection,1013 TokenProperties1014{}pallets/refungible/CHANGELOG.mddiffbeforeafterboth--- a/pallets/refungible/CHANGELOG.md
+++ b/pallets/refungible/CHANGELOG.md
@@ -2,12 +2,20 @@
All notable changes to this project will be documented in this file.
+## [v0.2.5] - 2022-20-10
+
+### Change
+
+- Added `set_properties` method for `TokenProperties` interface.
+
## [v0.2.4] - 2022-08-24
### Change
- - Add bound `AsRef<[u8; 32]>` to `T::CrossAccountId`.
+- Add bound `AsRef<[u8; 32]>` to `T::CrossAccountId`.
+
<!-- bureaucrate goes here -->
+
## [v0.2.3] 2022-08-16
### Other changes
pallets/refungible/Cargo.tomldiffbeforeafterboth--- a/pallets/refungible/Cargo.toml
+++ b/pallets/refungible/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "pallet-refungible"
-version = "0.2.4"
+version = "0.2.5"
license = "GPLv3"
edition = "2021"
pallets/refungible/src/erc.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -117,6 +117,47 @@
.map_err(dispatch_to_evm::<T>)
}
+ /// @notice Set token properties value.
+ /// @dev Throws error if `msg.sender` has no permission to edit the property.
+ /// @param tokenId ID of the token.
+ /// @param properties settable properties
+ fn set_properties(
+ &mut self,
+ caller: caller,
+ token_id: uint256,
+ properties: Vec<(string, bytes)>,
+ ) -> Result<()> {
+ let caller = T::CrossAccountId::from_eth(caller);
+ let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
+
+ let nesting_budget = self
+ .recorder
+ .weight_calls_budget(<StructureWeight<T>>::find_parent());
+
+ let properties = properties
+ .into_iter()
+ .map(|(key, value)| {
+ let key = <Vec<u8>>::from(key)
+ .try_into()
+ .map_err(|_| "key too large")?;
+
+ let value = value.0.try_into().map_err(|_| "value too large")?;
+
+ Ok(Property { key, value })
+ })
+ .collect::<Result<Vec<_>>>()?;
+
+ <Pallet<T>>::set_token_properties(
+ self,
+ &caller,
+ TokenId(token_id),
+ properties.into_iter(),
+ <Pallet<T>>::token_exists(&self, TokenId(token_id)),
+ &nesting_budget,
+ )
+ .map_err(dispatch_to_evm::<T>)
+ }
+
/// @notice Delete token property value.
/// @dev Throws error if `msg.sender` has no permission to edit the property.
/// @param tokenId ID of the token.
pallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth--- a/pallets/refungible/src/stubs/UniqueRefungible.sol
+++ b/pallets/refungible/src/stubs/UniqueRefungible.sol
@@ -18,7 +18,7 @@
}
/// @title A contract that allows to set and delete token properties and change token property permissions.
-/// @dev the ERC-165 identifier for this interface is 0x41369377
+/// @dev the ERC-165 identifier for this interface is 0x55dba919
contract TokenProperties is Dummy, ERC165 {
/// @notice Set permissions for token property.
/// @dev Throws error if `msg.sender` is not admin or owner of the collection.
@@ -61,6 +61,19 @@
dummy = 0;
}
+ /// @notice Set token properties value.
+ /// @dev Throws error if `msg.sender` has no permission to edit the property.
+ /// @param tokenId ID of the token.
+ /// @param properties settable properties
+ /// @dev EVM selector for this function is: 0x14ed3a6e,
+ /// or in textual repr: setProperties(uint256,(string,bytes)[])
+ function setProperties(uint256 tokenId, Tuple19[] memory properties) public {
+ require(false, stub_error);
+ tokenId;
+ properties;
+ dummy = 0;
+ }
+
/// @notice Delete token property value.
/// @dev Throws error if `msg.sender` has no permission to edit the property.
/// @param tokenId ID of the token.
@@ -458,7 +471,7 @@
/// Get collection owner.
///
- /// @return Tuble with sponsor address and his substrate mirror.
+ /// @return Tuple with sponsor address and his substrate mirror.
/// If address is canonical then substrate mirror is zero and vice versa.
/// @dev EVM selector for this function is: 0xdf727d3b,
/// or in textual repr: collectionOwner()
tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -249,7 +249,7 @@
/// Get collection owner.
///
- /// @return Tuble with sponsor address and his substrate mirror.
+ /// @return Tuple with sponsor address and his substrate mirror.
/// If address is canonical then substrate mirror is zero and vice versa.
/// @dev EVM selector for this function is: 0xdf727d3b,
/// or in textual repr: collectionOwner()
tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -13,7 +13,7 @@
}
/// @title A contract that allows to set and delete token properties and change token property permissions.
-/// @dev the ERC-165 identifier for this interface is 0x41369377
+/// @dev the ERC-165 identifier for this interface is 0x55dba919
interface TokenProperties is Dummy, ERC165 {
/// @notice Set permissions for token property.
/// @dev Throws error if `msg.sender` is not admin or owner of the collection.
@@ -43,6 +43,14 @@
bytes memory value
) external;
+ /// @notice Set token properties value.
+ /// @dev Throws error if `msg.sender` has no permission to edit the property.
+ /// @param tokenId ID of the token.
+ /// @param properties settable properties
+ /// @dev EVM selector for this function is: 0x14ed3a6e,
+ /// or in textual repr: setProperties(uint256,(string,bytes)[])
+ function setProperties(uint256 tokenId, Tuple19[] memory properties) external;
+
/// @notice Delete token property value.
/// @dev Throws error if `msg.sender` has no permission to edit the property.
/// @param tokenId ID of the token.
@@ -298,7 +306,7 @@
/// Get collection owner.
///
- /// @return Tuble with sponsor address and his substrate mirror.
+ /// @return Tuple with sponsor address and his substrate mirror.
/// If address is canonical then substrate mirror is zero and vice versa.
/// @dev EVM selector for this function is: 0xdf727d3b,
/// or in textual repr: collectionOwner()
tests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -13,7 +13,7 @@
}
/// @title A contract that allows to set and delete token properties and change token property permissions.
-/// @dev the ERC-165 identifier for this interface is 0x41369377
+/// @dev the ERC-165 identifier for this interface is 0x55dba919
interface TokenProperties is Dummy, ERC165 {
/// @notice Set permissions for token property.
/// @dev Throws error if `msg.sender` is not admin or owner of the collection.
@@ -43,6 +43,14 @@
bytes memory value
) external;
+ /// @notice Set token properties value.
+ /// @dev Throws error if `msg.sender` has no permission to edit the property.
+ /// @param tokenId ID of the token.
+ /// @param properties settable properties
+ /// @dev EVM selector for this function is: 0x14ed3a6e,
+ /// or in textual repr: setProperties(uint256,(string,bytes)[])
+ function setProperties(uint256 tokenId, Tuple19[] memory properties) external;
+
/// @notice Delete token property value.
/// @dev Throws error if `msg.sender` has no permission to edit the property.
/// @param tokenId ID of the token.
@@ -298,7 +306,7 @@
/// Get collection owner.
///
- /// @return Tuble with sponsor address and his substrate mirror.
+ /// @return Tuple with sponsor address and his substrate mirror.
/// If address is canonical then substrate mirror is zero and vice versa.
/// @dev EVM selector for this function is: 0xdf727d3b,
/// or in textual repr: collectionOwner()
tests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -677,6 +677,24 @@
{
"inputs": [
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+ {
+ "components": [
+ { "internalType": "string", "name": "field_0", "type": "string" },
+ { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+ ],
+ "internalType": "struct Tuple19[]",
+ "name": "properties",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "setProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
{ "internalType": "string", "name": "key", "type": "string" },
{ "internalType": "bytes", "name": "value", "type": "bytes" }
],
tests/src/eth/reFungibleAbi.jsondiffbeforeafterboth--- a/tests/src/eth/reFungibleAbi.json
+++ b/tests/src/eth/reFungibleAbi.json
@@ -659,6 +659,24 @@
{
"inputs": [
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+ {
+ "components": [
+ { "internalType": "string", "name": "field_0", "type": "string" },
+ { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+ ],
+ "internalType": "struct Tuple19[]",
+ "name": "properties",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "setProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
{ "internalType": "string", "name": "key", "type": "string" },
{ "internalType": "bytes", "name": "value", "type": "bytes" }
],
tests/src/eth/tokenProperties.test.tsdiffbeforeafterboth--- a/tests/src/eth/tokenProperties.test.ts
+++ b/tests/src/eth/tokenProperties.test.ts
@@ -16,6 +16,7 @@
import {itEth, usingEthPlaygrounds, expect} from './util';
import {IKeyringPair} from '@polkadot/types/types';
+import {ITokenPropertyPermission} from '../util/playgrounds/types';
describe('EVM token properties', () => {
let donor: IKeyringPair;
@@ -68,6 +69,64 @@
const [{value}] = await token.getProperties(['testKey']);
expect(value).to.equal('testValue');
});
+
+ itEth('Can be multiple set for NFT ', async({helper}) => {
+ const caller = await helper.eth.createAccountWithBalance(donor);
+
+ const properties = Array(5).fill(0).map((_, i) => { return {field_0: `key_${i}`, field_1: Buffer.from(`value_${i}`)}; });
+ const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.field_0, permission: {tokenOwner: true,
+ collectionAdmin: true,
+ mutable: true}}; });
+
+ const collection = await helper.nft.mintCollection(alice, {
+ tokenPrefix: 'ethp',
+ tokenPropertyPermissions: permissions,
+ });
+
+ const token = await collection.mintToken(alice);
+
+ const valuesBefore = await token.getProperties(properties.map(p => p.field_0));
+ expect(valuesBefore).to.be.deep.equal([]);
+
+ await collection.addAdmin(alice, {Ethereum: caller});
+
+ const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+ const contract = helper.ethNativeContract.collection(address, 'nft', caller);
+
+ await contract.methods.setProperties(token.tokenId, properties).send({from: caller});
+
+ const values = await token.getProperties(properties.map(p => p.field_0));
+ expect(values).to.be.deep.equal(properties.map(p => { return {key: p.field_0, value: p.field_1.toString()}; }));
+ });
+
+ itEth('Can be multiple set for RFT ', async({helper}) => {
+ const caller = await helper.eth.createAccountWithBalance(donor);
+
+ const properties = Array(5).fill(0).map((_, i) => { return {field_0: `key_${i}`, field_1: Buffer.from(`value_${i}`)}; });
+ const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.field_0, permission: {tokenOwner: true,
+ collectionAdmin: true,
+ mutable: true}}; });
+
+ const collection = await helper.rft.mintCollection(alice, {
+ tokenPrefix: 'ethp',
+ tokenPropertyPermissions: permissions,
+ });
+
+ const token = await collection.mintToken(alice);
+
+ const valuesBefore = await token.getProperties(properties.map(p => p.field_0));
+ expect(valuesBefore).to.be.deep.equal([]);
+
+ await collection.addAdmin(alice, {Ethereum: caller});
+
+ const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+ const contract = helper.ethNativeContract.collection(address, 'rft', caller);
+
+ await contract.methods.setProperties(token.tokenId, properties).send({from: caller});
+
+ const values = await token.getProperties(properties.map(p => p.field_0));
+ expect(values).to.be.deep.equal(properties.map(p => { return {key: p.field_0, value: p.field_1.toString()}; }));
+ });
itEth('Can be deleted', async({helper}) => {
const caller = await helper.eth.createAccountWithBalance(donor);