difftreelog
feat add delete properties
in: master
17 files changed
pallets/common/src/erc.rsdiffbeforeafterboth--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -117,8 +117,6 @@
/// @param key Property key.
#[weight(<SelfWeightOf<T>>::delete_collection_properties(1))]
fn delete_collection_property(&mut self, caller: caller, key: string) -> Result<()> {
- self.consume_store_reads_and_writes(1, 1)?;
-
let caller = T::CrossAccountId::from_eth(caller);
let key = <Vec<u8>>::from(key)
.try_into()
@@ -127,6 +125,24 @@
<Pallet<T>>::delete_collection_property(self, &caller, key).map_err(dispatch_to_evm::<T>)
}
+ /// Delete collection properties.
+ ///
+ /// @param keys Properties keys.
+ #[weight(<SelfWeightOf<T>>::delete_collection_properties(keys.len() as u32))]
+ fn delete_collection_properties(&mut self, caller: caller, keys: Vec<string>) -> Result<()> {
+ let caller = T::CrossAccountId::from_eth(caller);
+ let keys = keys
+ .into_iter()
+ .map(|key| {
+ <Vec<u8>>::from(key)
+ .try_into()
+ .map_err(|_| Error::Revert("key too large".into()))
+ })
+ .collect::<Result<Vec<_>>>()?;
+
+ <Pallet<T>>::delete_collection_properties(self, &caller, keys).map_err(dispatch_to_evm::<T>)
+ }
+
/// Get collection property.
///
/// @dev Throws error if key not found.
@@ -146,28 +162,34 @@
/// Get collection properties.
///
- /// @param keys Properties keys.
+ /// @param keys Properties keys. Empty keys for all propertyes.
/// @return Vector of properties key/value pairs.
fn collection_properties(&self, keys: Vec<string>) -> Result<Vec<(string, bytes)>> {
- let mut keys_ = Vec::<PropertyKey>::with_capacity(keys.len());
- for key in keys {
- keys_.push(
+ let keys = keys
+ .into_iter()
+ .map(|key| {
<Vec<u8>>::from(key)
.try_into()
- .map_err(|_| Error::Revert("key too large".into()))?,
- )
- }
- let properties = Pallet::<T>::filter_collection_properties(self.id, Some(keys_))
- .map_err(dispatch_to_evm::<T>)?;
+ .map_err(|_| Error::Revert("key too large".into()))
+ })
+ .collect::<Result<Vec<_>>>()?;
- let mut properties_ = Vec::<(string, bytes)>::with_capacity(properties.len());
- for p in properties {
- let key =
- string::from_utf8(p.key.into()).map_err(|e| Error::Revert(format!("{}", e)))?;
- let value = bytes(p.value.to_vec());
- properties_.push((key, value));
- }
- Ok(properties_)
+ let properties = Pallet::<T>::filter_collection_properties(
+ self.id,
+ if keys.is_empty() { None } else { Some(keys) },
+ )
+ .map_err(dispatch_to_evm::<T>)?;
+
+ let properties = properties
+ .into_iter()
+ .map(|p| {
+ let key =
+ string::from_utf8(p.key.into()).map_err(|e| Error::Revert(format!("{}", e)))?;
+ let value = bytes(p.value.to_vec());
+ Ok((key, value))
+ })
+ .collect::<Result<Vec<_>>>()?;
+ Ok(properties)
}
/// Set the sponsor of the collection.
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
@@ -18,7 +18,7 @@
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x5d354410
+/// @dev the ERC-165 identifier for this interface is 0xb3152af3
contract Collection is Dummy, ERC165 {
/// Set collection property.
///
@@ -55,6 +55,17 @@
dummy = 0;
}
+ /// Delete collection properties.
+ ///
+ /// @param keys Properties keys.
+ /// @dev EVM selector for this function is: 0xee206ee3,
+ /// or in textual repr: deleteCollectionProperties(string[])
+ function deleteCollectionProperties(string[] memory keys) public {
+ require(false, stub_error);
+ keys;
+ dummy = 0;
+ }
+
/// Get collection property.
///
/// @dev Throws error if key not found.
@@ -72,7 +83,7 @@
/// Get collection properties.
///
- /// @param keys Properties keys.
+ /// @param keys Properties keys. Empty keys for all propertyes.
/// @return Vector of properties key/value pairs.
/// @dev EVM selector for this function is: 0x285fb8e6,
/// or in textual repr: collectionProperties(string[])
pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -91,7 +91,7 @@
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x5d354410
+/// @dev the ERC-165 identifier for this interface is 0xb3152af3
contract Collection is Dummy, ERC165 {
/// Set collection property.
///
@@ -128,6 +128,17 @@
dummy = 0;
}
+ /// Delete collection properties.
+ ///
+ /// @param keys Properties keys.
+ /// @dev EVM selector for this function is: 0xee206ee3,
+ /// or in textual repr: deleteCollectionProperties(string[])
+ function deleteCollectionProperties(string[] memory keys) public {
+ require(false, stub_error);
+ keys;
+ dummy = 0;
+ }
+
/// Get collection property.
///
/// @dev Throws error if key not found.
@@ -145,7 +156,7 @@
/// Get collection properties.
///
- /// @param keys Properties keys.
+ /// @param keys Properties keys. Empty keys for all propertyes.
/// @return Vector of properties key/value pairs.
/// @dev EVM selector for this function is: 0x285fb8e6,
/// or in textual repr: collectionProperties(string[])
pallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungible.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 0x5d35441095contract 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 /// Get collection property.132 ///133 /// @dev Throws error if key not found.134 ///135 /// @param key Property key.136 /// @return bytes The property corresponding to the key.137 /// @dev EVM selector for this function is: 0xcf24fd6d,138 /// or in textual repr: collectionProperty(string)139 function collectionProperty(string memory key) public view returns (bytes memory) {140 require(false, stub_error);141 key;142 dummy;143 return hex"";144 }145146 /// Get collection properties.147 ///148 /// @param keys Properties keys.149 /// @return Vector of properties key/value pairs.150 /// @dev EVM selector for this function is: 0x285fb8e6,151 /// or in textual repr: collectionProperties(string[])152 function collectionProperties(string[] memory keys) public view returns (Tuple19[] memory) {153 require(false, stub_error);154 keys;155 dummy;156 return new Tuple19[](0);157 }158159 /// Set the sponsor of the collection.160 ///161 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.162 ///163 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.164 /// @dev EVM selector for this function is: 0x7623402e,165 /// or in textual repr: setCollectionSponsor(address)166 function setCollectionSponsor(address sponsor) public {167 require(false, stub_error);168 sponsor;169 dummy = 0;170 }171172 /// Set the sponsor of the collection.173 ///174 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.175 ///176 /// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.177 /// @dev EVM selector for this function is: 0x84a1d5a8,178 /// or in textual repr: setCollectionSponsorCross((address,uint256))179 function setCollectionSponsorCross(Tuple6 memory sponsor) public {180 require(false, stub_error);181 sponsor;182 dummy = 0;183 }184185 /// Whether there is a pending sponsor.186 /// @dev EVM selector for this function is: 0x058ac185,187 /// or in textual repr: hasCollectionPendingSponsor()188 function hasCollectionPendingSponsor() public view returns (bool) {189 require(false, stub_error);190 dummy;191 return false;192 }193194 /// Collection sponsorship confirmation.195 ///196 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.197 /// @dev EVM selector for this function is: 0x3c50e97a,198 /// or in textual repr: confirmCollectionSponsorship()199 function confirmCollectionSponsorship() public {200 require(false, stub_error);201 dummy = 0;202 }203204 /// Remove collection sponsor.205 /// @dev EVM selector for this function is: 0x6e0326a3,206 /// or in textual repr: removeCollectionSponsor()207 function removeCollectionSponsor() public {208 require(false, stub_error);209 dummy = 0;210 }211212 /// Get current sponsor.213 ///214 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.215 /// @dev EVM selector for this function is: 0x6ec0a9f1,216 /// or in textual repr: collectionSponsor()217 function collectionSponsor() public view returns (Tuple6 memory) {218 require(false, stub_error);219 dummy;220 return Tuple6(0x0000000000000000000000000000000000000000, 0);221 }222223 /// Set limits for the collection.224 /// @dev Throws error if limit not found.225 /// @param limit Name of the limit. Valid names:226 /// "accountTokenOwnershipLimit",227 /// "sponsoredDataSize",228 /// "sponsoredDataRateLimit",229 /// "tokenLimit",230 /// "sponsorTransferTimeout",231 /// "sponsorApproveTimeout"232 /// @param value Value of the limit.233 /// @dev EVM selector for this function is: 0x6a3841db,234 /// or in textual repr: setCollectionLimit(string,uint32)235 function setCollectionLimit(string memory limit, uint32 value) public {236 require(false, stub_error);237 limit;238 value;239 dummy = 0;240 }241242 /// Set limits for the collection.243 /// @dev Throws error if limit not found.244 /// @param limit Name of the limit. Valid names:245 /// "ownerCanTransfer",246 /// "ownerCanDestroy",247 /// "transfersEnabled"248 /// @param value Value of the limit.249 /// @dev EVM selector for this function is: 0x993b7fba,250 /// or in textual repr: setCollectionLimit(string,bool)251 function setCollectionLimit(string memory limit, bool value) public {252 require(false, stub_error);253 limit;254 value;255 dummy = 0;256 }257258 /// Get contract address.259 /// @dev EVM selector for this function is: 0xf6b4dfb4,260 /// or in textual repr: contractAddress()261 function contractAddress() public view returns (address) {262 require(false, stub_error);263 dummy;264 return 0x0000000000000000000000000000000000000000;265 }266267 /// Add collection admin.268 /// @param newAdmin Cross account administrator address.269 /// @dev EVM selector for this function is: 0x859aa7d6,270 /// or in textual repr: addCollectionAdminCross((address,uint256))271 function addCollectionAdminCross(Tuple6 memory newAdmin) public {272 require(false, stub_error);273 newAdmin;274 dummy = 0;275 }276277 /// Remove collection admin.278 /// @param admin Cross account administrator address.279 /// @dev EVM selector for this function is: 0x6c0cd173,280 /// or in textual repr: removeCollectionAdminCross((address,uint256))281 function removeCollectionAdminCross(Tuple6 memory admin) public {282 require(false, stub_error);283 admin;284 dummy = 0;285 }286287 /// Add collection admin.288 /// @param newAdmin Address of the added administrator.289 /// @dev EVM selector for this function is: 0x92e462c7,290 /// or in textual repr: addCollectionAdmin(address)291 function addCollectionAdmin(address newAdmin) public {292 require(false, stub_error);293 newAdmin;294 dummy = 0;295 }296297 /// Remove collection admin.298 ///299 /// @param admin Address of the removed administrator.300 /// @dev EVM selector for this function is: 0xfafd7b42,301 /// or in textual repr: removeCollectionAdmin(address)302 function removeCollectionAdmin(address admin) public {303 require(false, stub_error);304 admin;305 dummy = 0;306 }307308 /// Toggle accessibility of collection nesting.309 ///310 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'311 /// @dev EVM selector for this function is: 0x112d4586,312 /// or in textual repr: setCollectionNesting(bool)313 function setCollectionNesting(bool enable) public {314 require(false, stub_error);315 enable;316 dummy = 0;317 }318319 /// Toggle accessibility of collection nesting.320 ///321 /// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'322 /// @param collections Addresses of collections that will be available for nesting.323 /// @dev EVM selector for this function is: 0x64872396,324 /// or in textual repr: setCollectionNesting(bool,address[])325 function setCollectionNesting(bool enable, address[] memory collections) public {326 require(false, stub_error);327 enable;328 collections;329 dummy = 0;330 }331332 /// Set the collection access method.333 /// @param mode Access mode334 /// 0 for Normal335 /// 1 for AllowList336 /// @dev EVM selector for this function is: 0x41835d4c,337 /// or in textual repr: setCollectionAccess(uint8)338 function setCollectionAccess(uint8 mode) public {339 require(false, stub_error);340 mode;341 dummy = 0;342 }343344 /// Checks that user allowed to operate with collection.345 ///346 /// @param user User address to check.347 /// @dev EVM selector for this function is: 0xd63a8e11,348 /// or in textual repr: allowed(address)349 function allowed(address user) public view returns (bool) {350 require(false, stub_error);351 user;352 dummy;353 return false;354 }355356 /// Add the user to the allowed list.357 ///358 /// @param user Address of a trusted user.359 /// @dev EVM selector for this function is: 0x67844fe6,360 /// or in textual repr: addToCollectionAllowList(address)361 function addToCollectionAllowList(address user) public {362 require(false, stub_error);363 user;364 dummy = 0;365 }366367 /// Add user to allowed list.368 ///369 /// @param user User cross account address.370 /// @dev EVM selector for this function is: 0xa0184a3a,371 /// or in textual repr: addToCollectionAllowListCross((address,uint256))372 function addToCollectionAllowListCross(Tuple6 memory user) public {373 require(false, stub_error);374 user;375 dummy = 0;376 }377378 /// Remove the user from the allowed list.379 ///380 /// @param user Address of a removed user.381 /// @dev EVM selector for this function is: 0x85c51acb,382 /// or in textual repr: removeFromCollectionAllowList(address)383 function removeFromCollectionAllowList(address user) public {384 require(false, stub_error);385 user;386 dummy = 0;387 }388389 /// Remove user from allowed list.390 ///391 /// @param user User cross account address.392 /// @dev EVM selector for this function is: 0x09ba452a,393 /// or in textual repr: removeFromCollectionAllowListCross((address,uint256))394 function removeFromCollectionAllowListCross(Tuple6 memory user) public {395 require(false, stub_error);396 user;397 dummy = 0;398 }399400 /// Switch permission for minting.401 ///402 /// @param mode Enable if "true".403 /// @dev EVM selector for this function is: 0x00018e84,404 /// or in textual repr: setCollectionMintMode(bool)405 function setCollectionMintMode(bool mode) public {406 require(false, stub_error);407 mode;408 dummy = 0;409 }410411 /// Check that account is the owner or admin of the collection412 ///413 /// @param user account to verify414 /// @return "true" if account is the owner or admin415 /// @dev EVM selector for this function is: 0x9811b0c7,416 /// or in textual repr: isOwnerOrAdmin(address)417 function isOwnerOrAdmin(address user) public view returns (bool) {418 require(false, stub_error);419 user;420 dummy;421 return false;422 }423424 /// Check that account is the owner or admin of the collection425 ///426 /// @param user User cross account to verify427 /// @return "true" if account is the owner or admin428 /// @dev EVM selector for this function is: 0x3e75a905,429 /// or in textual repr: isOwnerOrAdminCross((address,uint256))430 function isOwnerOrAdminCross(Tuple6 memory user) public view returns (bool) {431 require(false, stub_error);432 user;433 dummy;434 return false;435 }436437 /// Returns collection type438 ///439 /// @return `Fungible` or `NFT` or `ReFungible`440 /// @dev EVM selector for this function is: 0xd34b55b8,441 /// or in textual repr: uniqueCollectionType()442 function uniqueCollectionType() public view returns (string memory) {443 require(false, stub_error);444 dummy;445 return "";446 }447448 /// Get collection owner.449 ///450 /// @return Tuble with sponsor address and his substrate mirror.451 /// If address is canonical then substrate mirror is zero and vice versa.452 /// @dev EVM selector for this function is: 0xdf727d3b,453 /// or in textual repr: collectionOwner()454 function collectionOwner() public view returns (Tuple6 memory) {455 require(false, stub_error);456 dummy;457 return Tuple6(0x0000000000000000000000000000000000000000, 0);458 }459460 /// Changes collection owner to another account461 ///462 /// @dev Owner can be changed only by current owner463 /// @param newOwner new owner account464 /// @dev EVM selector for this function is: 0x4f53e226,465 /// or in textual repr: changeCollectionOwner(address)466 function changeCollectionOwner(address newOwner) public {467 require(false, stub_error);468 newOwner;469 dummy = 0;470 }471472 /// Get collection administrators473 ///474 /// @return Vector of tuples with admins 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: 0x5813216b,477 /// or in textual repr: collectionAdmins()478 function collectionAdmins() public view returns (Tuple6[] memory) {479 require(false, stub_error);480 dummy;481 return new Tuple6[](0);482 }483484 /// Changes collection owner to another account485 ///486 /// @dev Owner can be changed only by current owner487 /// @param newOwner new owner cross account488 /// @dev EVM selector for this function is: 0xe5c9913f,489 /// or in textual repr: setOwnerCross((address,uint256))490 function setOwnerCross(Tuple6 memory newOwner) public {491 require(false, stub_error);492 newOwner;493 dummy = 0;494 }495}496497/// @dev anonymous struct498struct Tuple19 {499 string field_0;500 bytes field_1;501}502503/// @dev the ERC-165 identifier for this interface is 0x5b5e139f504contract ERC721Metadata is Dummy, ERC165 {505 // /// @notice A descriptive name for a collection of NFTs in this contract506 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`507 // /// @dev EVM selector for this function is: 0x06fdde03,508 // /// or in textual repr: name()509 // function name() public view returns (string memory) {510 // require(false, stub_error);511 // dummy;512 // return "";513 // }514515 // /// @notice An abbreviated name for NFTs in this contract516 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`517 // /// @dev EVM selector for this function is: 0x95d89b41,518 // /// or in textual repr: symbol()519 // function symbol() public view returns (string memory) {520 // require(false, stub_error);521 // dummy;522 // return "";523 // }524525 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.526 ///527 /// @dev If the token has a `url` property and it is not empty, it is returned.528 /// 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`.529 /// If the collection property `baseURI` is empty or absent, return "" (empty string)530 /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix531 /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).532 ///533 /// @return token's const_metadata534 /// @dev EVM selector for this function is: 0xc87b56dd,535 /// or in textual repr: tokenURI(uint256)536 function tokenURI(uint256 tokenId) public view returns (string memory) {537 require(false, stub_error);538 tokenId;539 dummy;540 return "";541 }542}543544/// @title ERC721 Token that can be irreversibly burned (destroyed).545/// @dev the ERC-165 identifier for this interface is 0x42966c68546contract ERC721Burnable is Dummy, ERC165 {547 /// @notice Burns a specific ERC721 token.548 /// @dev Throws unless `msg.sender` is the current RFT owner, or an authorized549 /// operator of the current owner.550 /// @param tokenId The RFT to approve551 /// @dev EVM selector for this function is: 0x42966c68,552 /// or in textual repr: burn(uint256)553 function burn(uint256 tokenId) public {554 require(false, stub_error);555 tokenId;556 dummy = 0;557 }558}559560/// @dev inlined interface561contract ERC721UniqueMintableEvents {562 event MintingFinished();563}564565/// @title ERC721 minting logic.566/// @dev the ERC-165 identifier for this interface is 0x476ff149567contract ERC721UniqueMintable is Dummy, ERC165, ERC721UniqueMintableEvents {568 /// @dev EVM selector for this function is: 0x05d2035b,569 /// or in textual repr: mintingFinished()570 function mintingFinished() public view returns (bool) {571 require(false, stub_error);572 dummy;573 return false;574 }575576 /// @notice Function to mint token.577 /// @param to The new owner578 /// @return uint256 The id of the newly minted token579 /// @dev EVM selector for this function is: 0x6a627842,580 /// or in textual repr: mint(address)581 function mint(address to) public returns (uint256) {582 require(false, stub_error);583 to;584 dummy = 0;585 return 0;586 }587588 // /// @notice Function to mint token.589 // /// @dev `tokenId` should be obtained with `nextTokenId` method,590 // /// unlike standard, you can't specify it manually591 // /// @param to The new owner592 // /// @param tokenId ID of the minted RFT593 // /// @dev EVM selector for this function is: 0x40c10f19,594 // /// or in textual repr: mint(address,uint256)595 // function mint(address to, uint256 tokenId) public returns (bool) {596 // require(false, stub_error);597 // to;598 // tokenId;599 // dummy = 0;600 // return false;601 // }602603 /// @notice Function to mint token with the given tokenUri.604 /// @param to The new owner605 /// @param tokenUri Token URI that would be stored in the NFT properties606 /// @return uint256 The id of the newly minted token607 /// @dev EVM selector for this function is: 0x45c17782,608 /// or in textual repr: mintWithTokenURI(address,string)609 function mintWithTokenURI(address to, string memory tokenUri) public returns (uint256) {610 require(false, stub_error);611 to;612 tokenUri;613 dummy = 0;614 return 0;615 }616617 // /// @notice Function to mint token with the given tokenUri.618 // /// @dev `tokenId` should be obtained with `nextTokenId` method,619 // /// unlike standard, you can't specify it manually620 // /// @param to The new owner621 // /// @param tokenId ID of the minted RFT622 // /// @param tokenUri Token URI that would be stored in the RFT properties623 // /// @dev EVM selector for this function is: 0x50bb4e7f,624 // /// or in textual repr: mintWithTokenURI(address,uint256,string)625 // function mintWithTokenURI(address to, uint256 tokenId, string memory tokenUri) public returns (bool) {626 // require(false, stub_error);627 // to;628 // tokenId;629 // tokenUri;630 // dummy = 0;631 // return false;632 // }633634 /// @dev Not implemented635 /// @dev EVM selector for this function is: 0x7d64bcb4,636 /// or in textual repr: finishMinting()637 function finishMinting() public returns (bool) {638 require(false, stub_error);639 dummy = 0;640 return false;641 }642}643644/// @title Unique extensions for ERC721.645/// @dev the ERC-165 identifier for this interface is 0x81feb398646contract ERC721UniqueExtensions is Dummy, ERC165 {647 /// @notice A descriptive name for a collection of NFTs in this contract648 /// @dev EVM selector for this function is: 0x06fdde03,649 /// or in textual repr: name()650 function name() public view returns (string memory) {651 require(false, stub_error);652 dummy;653 return "";654 }655656 /// @notice An abbreviated name for NFTs in this contract657 /// @dev EVM selector for this function is: 0x95d89b41,658 /// or in textual repr: symbol()659 function symbol() public view returns (string memory) {660 require(false, stub_error);661 dummy;662 return "";663 }664665 /// @notice Transfer ownership of an RFT666 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`667 /// is the zero address. Throws if `tokenId` is not a valid RFT.668 /// Throws if RFT pieces have multiple owners.669 /// @param to The new owner670 /// @param tokenId The RFT to transfer671 /// @dev EVM selector for this function is: 0xa9059cbb,672 /// or in textual repr: transfer(address,uint256)673 function transfer(address to, uint256 tokenId) public {674 require(false, stub_error);675 to;676 tokenId;677 dummy = 0;678 }679680 /// @notice Transfer ownership of an RFT681 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`682 /// is the zero address. Throws if `tokenId` is not a valid RFT.683 /// Throws if RFT pieces have multiple owners.684 /// @param to The new owner685 /// @param tokenId The RFT to transfer686 /// @dev EVM selector for this function is: 0xd5cf430b,687 /// or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)688 function transferFromCross(689 Tuple6 memory from,690 Tuple6 memory to,691 uint256 tokenId692 ) public {693 require(false, stub_error);694 from;695 to;696 tokenId;697 dummy = 0;698 }699700 /// @notice Burns a specific ERC721 token.701 /// @dev Throws unless `msg.sender` is the current owner or an authorized702 /// operator for this RFT. Throws if `from` is not the current owner. Throws703 /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.704 /// Throws if RFT pieces have multiple owners.705 /// @param from The current owner of the RFT706 /// @param tokenId The RFT to transfer707 /// @dev EVM selector for this function is: 0x79cc6790,708 /// or in textual repr: burnFrom(address,uint256)709 function burnFrom(address from, uint256 tokenId) public {710 require(false, stub_error);711 from;712 tokenId;713 dummy = 0;714 }715716 /// @notice Burns a specific ERC721 token.717 /// @dev Throws unless `msg.sender` is the current owner or an authorized718 /// operator for this RFT. Throws if `from` is not the current owner. Throws719 /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.720 /// Throws if RFT pieces have multiple owners.721 /// @param from The current owner of the RFT722 /// @param tokenId The RFT to transfer723 /// @dev EVM selector for this function is: 0xbb2f5a58,724 /// or in textual repr: burnFromCross((address,uint256),uint256)725 function burnFromCross(Tuple6 memory from, uint256 tokenId) public {726 require(false, stub_error);727 from;728 tokenId;729 dummy = 0;730 }731732 /// @notice Returns next free RFT ID.733 /// @dev EVM selector for this function is: 0x75794a3c,734 /// or in textual repr: nextTokenId()735 function nextTokenId() public view returns (uint256) {736 require(false, stub_error);737 dummy;738 return 0;739 }740741 // /// @notice Function to mint multiple tokens.742 // /// @dev `tokenIds` should be an array of consecutive numbers and first number743 // /// should be obtained with `nextTokenId` method744 // /// @param to The new owner745 // /// @param tokenIds IDs of the minted RFTs746 // /// @dev EVM selector for this function is: 0x44a9945e,747 // /// or in textual repr: mintBulk(address,uint256[])748 // function mintBulk(address to, uint256[] memory tokenIds) public returns (bool) {749 // require(false, stub_error);750 // to;751 // tokenIds;752 // dummy = 0;753 // return false;754 // }755756 // /// @notice Function to mint multiple tokens with the given tokenUris.757 // /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive758 // /// numbers and first number should be obtained with `nextTokenId` method759 // /// @param to The new owner760 // /// @param tokens array of pairs of token ID and token URI for minted tokens761 // /// @dev EVM selector for this function is: 0x36543006,762 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])763 // function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) public returns (bool) {764 // require(false, stub_error);765 // to;766 // tokens;767 // dummy = 0;768 // return false;769 // }770771 /// Returns EVM address for refungible token772 ///773 /// @param token ID of the token774 /// @dev EVM selector for this function is: 0xab76fac6,775 /// or in textual repr: tokenContractAddress(uint256)776 function tokenContractAddress(uint256 token) public view returns (address) {777 require(false, stub_error);778 token;779 dummy;780 return 0x0000000000000000000000000000000000000000;781 }782}783784/// @dev anonymous struct785struct Tuple8 {786 uint256 field_0;787 string field_1;788}789790/// @dev anonymous struct791struct Tuple6 {792 address field_0;793 uint256 field_1;794}795796/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension797/// @dev See https://eips.ethereum.org/EIPS/eip-721798/// @dev the ERC-165 identifier for this interface is 0x780e9d63799contract ERC721Enumerable is Dummy, ERC165 {800 /// @notice Enumerate valid RFTs801 /// @param index A counter less than `totalSupply()`802 /// @return The token identifier for the `index`th NFT,803 /// (sort order not specified)804 /// @dev EVM selector for this function is: 0x4f6ccce7,805 /// or in textual repr: tokenByIndex(uint256)806 function tokenByIndex(uint256 index) public view returns (uint256) {807 require(false, stub_error);808 index;809 dummy;810 return 0;811 }812813 /// Not implemented814 /// @dev EVM selector for this function is: 0x2f745c59,815 /// or in textual repr: tokenOfOwnerByIndex(address,uint256)816 function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {817 require(false, stub_error);818 owner;819 index;820 dummy;821 return 0;822 }823824 /// @notice Count RFTs tracked by this contract825 /// @return A count of valid RFTs tracked by this contract, where each one of826 /// them has an assigned and queryable owner not equal to the zero address827 /// @dev EVM selector for this function is: 0x18160ddd,828 /// or in textual repr: totalSupply()829 function totalSupply() public view returns (uint256) {830 require(false, stub_error);831 dummy;832 return 0;833 }834}835836/// @dev inlined interface837contract ERC721Events {838 event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);839 event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);840 event ApprovalForAll(address indexed owner, address indexed operator, bool approved);841}842843/// @title ERC-721 Non-Fungible Token Standard844/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md845/// @dev the ERC-165 identifier for this interface is 0x58800161846contract ERC721 is Dummy, ERC165, ERC721Events {847 /// @notice Count all RFTs assigned to an owner848 /// @dev RFTs assigned to the zero address are considered invalid, and this849 /// function throws for queries about the zero address.850 /// @param owner An address for whom to query the balance851 /// @return The number of RFTs owned by `owner`, possibly zero852 /// @dev EVM selector for this function is: 0x70a08231,853 /// or in textual repr: balanceOf(address)854 function balanceOf(address owner) public view returns (uint256) {855 require(false, stub_error);856 owner;857 dummy;858 return 0;859 }860861 /// @notice Find the owner of an RFT862 /// @dev RFTs assigned to zero address are considered invalid, and queries863 /// about them do throw.864 /// Returns special 0xffffffffffffffffffffffffffffffffffffffff address for865 /// the tokens that are partially owned.866 /// @param tokenId The identifier for an RFT867 /// @return The address of the owner of the RFT868 /// @dev EVM selector for this function is: 0x6352211e,869 /// or in textual repr: ownerOf(uint256)870 function ownerOf(uint256 tokenId) public view returns (address) {871 require(false, stub_error);872 tokenId;873 dummy;874 return 0x0000000000000000000000000000000000000000;875 }876877 /// @dev Not implemented878 /// @dev EVM selector for this function is: 0x60a11672,879 /// or in textual repr: safeTransferFromWithData(address,address,uint256,bytes)880 function safeTransferFromWithData(881 address from,882 address to,883 uint256 tokenId,884 bytes memory data885 ) public {886 require(false, stub_error);887 from;888 to;889 tokenId;890 data;891 dummy = 0;892 }893894 /// @dev Not implemented895 /// @dev EVM selector for this function is: 0x42842e0e,896 /// or in textual repr: safeTransferFrom(address,address,uint256)897 function safeTransferFrom(898 address from,899 address to,900 uint256 tokenId901 ) public {902 require(false, stub_error);903 from;904 to;905 tokenId;906 dummy = 0;907 }908909 /// @notice Transfer ownership of an RFT -- THE CALLER IS RESPONSIBLE910 /// TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE911 /// THEY MAY BE PERMANENTLY LOST912 /// @dev Throws unless `msg.sender` is the current owner or an authorized913 /// operator for this RFT. Throws if `from` is not the current owner. Throws914 /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.915 /// Throws if RFT pieces have multiple owners.916 /// @param from The current owner of the NFT917 /// @param to The new owner918 /// @param tokenId The NFT to transfer919 /// @dev EVM selector for this function is: 0x23b872dd,920 /// or in textual repr: transferFrom(address,address,uint256)921 function transferFrom(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 /// @dev Not implemented934 /// @dev EVM selector for this function is: 0x095ea7b3,935 /// or in textual repr: approve(address,uint256)936 function approve(address approved, uint256 tokenId) public {937 require(false, stub_error);938 approved;939 tokenId;940 dummy = 0;941 }942943 /// @dev Not implemented944 /// @dev EVM selector for this function is: 0xa22cb465,945 /// or in textual repr: setApprovalForAll(address,bool)946 function setApprovalForAll(address operator, bool approved) public {947 require(false, stub_error);948 operator;949 approved;950 dummy = 0;951 }952953 /// @dev Not implemented954 /// @dev EVM selector for this function is: 0x081812fc,955 /// or in textual repr: getApproved(uint256)956 function getApproved(uint256 tokenId) public view returns (address) {957 require(false, stub_error);958 tokenId;959 dummy;960 return 0x0000000000000000000000000000000000000000;961 }962963 /// @dev Not implemented964 /// @dev EVM selector for this function is: 0xe985e9c5,965 /// or in textual repr: isApprovedForAll(address,address)966 function isApprovedForAll(address owner, address operator) public view returns (address) {967 require(false, stub_error);968 owner;969 operator;970 dummy;971 return 0x0000000000000000000000000000000000000000;972 }973}974975contract UniqueRefungible is976 Dummy,977 ERC165,978 ERC721,979 ERC721Enumerable,980 ERC721UniqueExtensions,981 ERC721UniqueMintable,982 ERC721Burnable,983 ERC721Metadata,984 Collection,985 TokenProperties986{}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 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/// @dev the ERC-165 identifier for this interface is 0x5b5e139f515contract ERC721Metadata is Dummy, ERC165 {516 // /// @notice A descriptive name for a collection of NFTs in this contract517 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`518 // /// @dev EVM selector for this function is: 0x06fdde03,519 // /// or in textual repr: name()520 // function name() public view returns (string memory) {521 // require(false, stub_error);522 // dummy;523 // return "";524 // }525526 // /// @notice An abbreviated name for NFTs in this contract527 // /// @dev real implementation of this function lies in `ERC721UniqueExtensions`528 // /// @dev EVM selector for this function is: 0x95d89b41,529 // /// or in textual repr: symbol()530 // function symbol() public view returns (string memory) {531 // require(false, stub_error);532 // dummy;533 // return "";534 // }535536 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.537 ///538 /// @dev If the token has a `url` property and it is not empty, it is returned.539 /// 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`.540 /// If the collection property `baseURI` is empty or absent, return "" (empty string)541 /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix542 /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).543 ///544 /// @return token's const_metadata545 /// @dev EVM selector for this function is: 0xc87b56dd,546 /// or in textual repr: tokenURI(uint256)547 function tokenURI(uint256 tokenId) public view returns (string memory) {548 require(false, stub_error);549 tokenId;550 dummy;551 return "";552 }553}554555/// @title ERC721 Token that can be irreversibly burned (destroyed).556/// @dev the ERC-165 identifier for this interface is 0x42966c68557contract ERC721Burnable is Dummy, ERC165 {558 /// @notice Burns a specific ERC721 token.559 /// @dev Throws unless `msg.sender` is the current RFT owner, or an authorized560 /// operator of the current owner.561 /// @param tokenId The RFT to approve562 /// @dev EVM selector for this function is: 0x42966c68,563 /// or in textual repr: burn(uint256)564 function burn(uint256 tokenId) public {565 require(false, stub_error);566 tokenId;567 dummy = 0;568 }569}570571/// @dev inlined interface572contract ERC721UniqueMintableEvents {573 event MintingFinished();574}575576/// @title ERC721 minting logic.577/// @dev the ERC-165 identifier for this interface is 0x476ff149578contract ERC721UniqueMintable is Dummy, ERC165, ERC721UniqueMintableEvents {579 /// @dev EVM selector for this function is: 0x05d2035b,580 /// or in textual repr: mintingFinished()581 function mintingFinished() public view returns (bool) {582 require(false, stub_error);583 dummy;584 return false;585 }586587 /// @notice Function to mint token.588 /// @param to The new owner589 /// @return uint256 The id of the newly minted token590 /// @dev EVM selector for this function is: 0x6a627842,591 /// or in textual repr: mint(address)592 function mint(address to) public returns (uint256) {593 require(false, stub_error);594 to;595 dummy = 0;596 return 0;597 }598599 // /// @notice Function to mint token.600 // /// @dev `tokenId` should be obtained with `nextTokenId` method,601 // /// unlike standard, you can't specify it manually602 // /// @param to The new owner603 // /// @param tokenId ID of the minted RFT604 // /// @dev EVM selector for this function is: 0x40c10f19,605 // /// or in textual repr: mint(address,uint256)606 // function mint(address to, uint256 tokenId) public returns (bool) {607 // require(false, stub_error);608 // to;609 // tokenId;610 // dummy = 0;611 // return false;612 // }613614 /// @notice Function to mint token with the given tokenUri.615 /// @param to The new owner616 /// @param tokenUri Token URI that would be stored in the NFT properties617 /// @return uint256 The id of the newly minted token618 /// @dev EVM selector for this function is: 0x45c17782,619 /// or in textual repr: mintWithTokenURI(address,string)620 function mintWithTokenURI(address to, string memory tokenUri) public returns (uint256) {621 require(false, stub_error);622 to;623 tokenUri;624 dummy = 0;625 return 0;626 }627628 // /// @notice Function to mint token with the given tokenUri.629 // /// @dev `tokenId` should be obtained with `nextTokenId` method,630 // /// unlike standard, you can't specify it manually631 // /// @param to The new owner632 // /// @param tokenId ID of the minted RFT633 // /// @param tokenUri Token URI that would be stored in the RFT properties634 // /// @dev EVM selector for this function is: 0x50bb4e7f,635 // /// or in textual repr: mintWithTokenURI(address,uint256,string)636 // function mintWithTokenURI(address to, uint256 tokenId, string memory tokenUri) public returns (bool) {637 // require(false, stub_error);638 // to;639 // tokenId;640 // tokenUri;641 // dummy = 0;642 // return false;643 // }644645 /// @dev Not implemented646 /// @dev EVM selector for this function is: 0x7d64bcb4,647 /// or in textual repr: finishMinting()648 function finishMinting() public returns (bool) {649 require(false, stub_error);650 dummy = 0;651 return false;652 }653}654655/// @title Unique extensions for ERC721.656/// @dev the ERC-165 identifier for this interface is 0x81feb398657contract ERC721UniqueExtensions is Dummy, ERC165 {658 /// @notice A descriptive name for a collection of NFTs in this contract659 /// @dev EVM selector for this function is: 0x06fdde03,660 /// or in textual repr: name()661 function name() public view returns (string memory) {662 require(false, stub_error);663 dummy;664 return "";665 }666667 /// @notice An abbreviated name for NFTs in this contract668 /// @dev EVM selector for this function is: 0x95d89b41,669 /// or in textual repr: symbol()670 function symbol() public view returns (string memory) {671 require(false, stub_error);672 dummy;673 return "";674 }675676 /// @notice Transfer ownership of an RFT677 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`678 /// is the zero address. Throws if `tokenId` is not a valid RFT.679 /// Throws if RFT pieces have multiple owners.680 /// @param to The new owner681 /// @param tokenId The RFT to transfer682 /// @dev EVM selector for this function is: 0xa9059cbb,683 /// or in textual repr: transfer(address,uint256)684 function transfer(address to, uint256 tokenId) public {685 require(false, stub_error);686 to;687 tokenId;688 dummy = 0;689 }690691 /// @notice Transfer ownership of an RFT692 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`693 /// is the zero address. Throws if `tokenId` is not a valid RFT.694 /// Throws if RFT pieces have multiple owners.695 /// @param to The new owner696 /// @param tokenId The RFT to transfer697 /// @dev EVM selector for this function is: 0xd5cf430b,698 /// or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)699 function transferFromCross(700 Tuple6 memory from,701 Tuple6 memory to,702 uint256 tokenId703 ) public {704 require(false, stub_error);705 from;706 to;707 tokenId;708 dummy = 0;709 }710711 /// @notice Burns a specific ERC721 token.712 /// @dev Throws unless `msg.sender` is the current owner or an authorized713 /// operator for this RFT. Throws if `from` is not the current owner. Throws714 /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.715 /// Throws if RFT pieces have multiple owners.716 /// @param from The current owner of the RFT717 /// @param tokenId The RFT to transfer718 /// @dev EVM selector for this function is: 0x79cc6790,719 /// or in textual repr: burnFrom(address,uint256)720 function burnFrom(address from, uint256 tokenId) public {721 require(false, stub_error);722 from;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 RFT. Throws if `from` is not the current owner. Throws730 /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.731 /// Throws if RFT pieces have multiple owners.732 /// @param from The current owner of the RFT733 /// @param tokenId The RFT to transfer734 /// @dev EVM selector for this function is: 0xbb2f5a58,735 /// or in textual repr: burnFromCross((address,uint256),uint256)736 function burnFromCross(Tuple6 memory from, uint256 tokenId) public {737 require(false, stub_error);738 from;739 tokenId;740 dummy = 0;741 }742743 /// @notice Returns next free RFT ID.744 /// @dev EVM selector for this function is: 0x75794a3c,745 /// or in textual repr: nextTokenId()746 function nextTokenId() public view returns (uint256) {747 require(false, stub_error);748 dummy;749 return 0;750 }751752 // /// @notice Function to mint multiple tokens.753 // /// @dev `tokenIds` should be an array of consecutive numbers and first number754 // /// should be obtained with `nextTokenId` method755 // /// @param to The new owner756 // /// @param tokenIds IDs of the minted RFTs757 // /// @dev EVM selector for this function is: 0x44a9945e,758 // /// or in textual repr: mintBulk(address,uint256[])759 // function mintBulk(address to, uint256[] memory tokenIds) public returns (bool) {760 // require(false, stub_error);761 // to;762 // tokenIds;763 // dummy = 0;764 // return false;765 // }766767 // /// @notice Function to mint multiple tokens with the given tokenUris.768 // /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive769 // /// numbers and first number should be obtained with `nextTokenId` method770 // /// @param to The new owner771 // /// @param tokens array of pairs of token ID and token URI for minted tokens772 // /// @dev EVM selector for this function is: 0x36543006,773 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])774 // function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) public returns (bool) {775 // require(false, stub_error);776 // to;777 // tokens;778 // dummy = 0;779 // return false;780 // }781782 /// Returns EVM address for refungible token783 ///784 /// @param token ID of the token785 /// @dev EVM selector for this function is: 0xab76fac6,786 /// or in textual repr: tokenContractAddress(uint256)787 function tokenContractAddress(uint256 token) public view returns (address) {788 require(false, stub_error);789 token;790 dummy;791 return 0x0000000000000000000000000000000000000000;792 }793}794795/// @dev anonymous struct796struct Tuple8 {797 uint256 field_0;798 string field_1;799}800801/// @dev anonymous struct802struct Tuple6 {803 address field_0;804 uint256 field_1;805}806807/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension808/// @dev See https://eips.ethereum.org/EIPS/eip-721809/// @dev the ERC-165 identifier for this interface is 0x780e9d63810contract ERC721Enumerable is Dummy, ERC165 {811 /// @notice Enumerate valid RFTs812 /// @param index A counter less than `totalSupply()`813 /// @return The token identifier for the `index`th NFT,814 /// (sort order not specified)815 /// @dev EVM selector for this function is: 0x4f6ccce7,816 /// or in textual repr: tokenByIndex(uint256)817 function tokenByIndex(uint256 index) public view returns (uint256) {818 require(false, stub_error);819 index;820 dummy;821 return 0;822 }823824 /// Not implemented825 /// @dev EVM selector for this function is: 0x2f745c59,826 /// or in textual repr: tokenOfOwnerByIndex(address,uint256)827 function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {828 require(false, stub_error);829 owner;830 index;831 dummy;832 return 0;833 }834835 /// @notice Count RFTs tracked by this contract836 /// @return A count of valid RFTs tracked by this contract, where each one of837 /// them has an assigned and queryable owner not equal to the zero address838 /// @dev EVM selector for this function is: 0x18160ddd,839 /// or in textual repr: totalSupply()840 function totalSupply() public view returns (uint256) {841 require(false, stub_error);842 dummy;843 return 0;844 }845}846847/// @dev inlined interface848contract ERC721Events {849 event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);850 event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);851 event ApprovalForAll(address indexed owner, address indexed operator, bool approved);852}853854/// @title ERC-721 Non-Fungible Token Standard855/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md856/// @dev the ERC-165 identifier for this interface is 0x58800161857contract ERC721 is Dummy, ERC165, ERC721Events {858 /// @notice Count all RFTs assigned to an owner859 /// @dev RFTs assigned to the zero address are considered invalid, and this860 /// function throws for queries about the zero address.861 /// @param owner An address for whom to query the balance862 /// @return The number of RFTs owned by `owner`, possibly zero863 /// @dev EVM selector for this function is: 0x70a08231,864 /// or in textual repr: balanceOf(address)865 function balanceOf(address owner) public view returns (uint256) {866 require(false, stub_error);867 owner;868 dummy;869 return 0;870 }871872 /// @notice Find the owner of an RFT873 /// @dev RFTs assigned to zero address are considered invalid, and queries874 /// about them do throw.875 /// Returns special 0xffffffffffffffffffffffffffffffffffffffff address for876 /// the tokens that are partially owned.877 /// @param tokenId The identifier for an RFT878 /// @return The address of the owner of the RFT879 /// @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: 0x60a11672,890 /// or in textual repr: safeTransferFromWithData(address,address,uint256,bytes)891 function safeTransferFromWithData(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 RFT -- 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 RFT. Throws if `from` is not the current owner. Throws925 /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.926 /// Throws if RFT pieces have multiple owners.927 /// @param from The current owner of the NFT928 /// @param to The new owner929 /// @param tokenId The NFT to transfer930 /// @dev EVM selector for this function is: 0x23b872dd,931 /// or in textual repr: transferFrom(address,address,uint256)932 function transferFrom(933 address from,934 address to,935 uint256 tokenId936 ) public {937 require(false, stub_error);938 from;939 to;940 tokenId;941 dummy = 0;942 }943944 /// @dev Not implemented945 /// @dev EVM selector for this function is: 0x095ea7b3,946 /// or in textual repr: approve(address,uint256)947 function approve(address approved, uint256 tokenId) public {948 require(false, stub_error);949 approved;950 tokenId;951 dummy = 0;952 }953954 /// @dev Not implemented955 /// @dev EVM selector for this function is: 0xa22cb465,956 /// or in textual repr: setApprovalForAll(address,bool)957 function setApprovalForAll(address operator, bool approved) public {958 require(false, stub_error);959 operator;960 approved;961 dummy = 0;962 }963964 /// @dev Not implemented965 /// @dev EVM selector for this function is: 0x081812fc,966 /// or in textual repr: getApproved(uint256)967 function getApproved(uint256 tokenId) public view returns (address) {968 require(false, stub_error);969 tokenId;970 dummy;971 return 0x0000000000000000000000000000000000000000;972 }973974 /// @dev Not implemented975 /// @dev EVM selector for this function is: 0xe985e9c5,976 /// or in textual repr: isApprovedForAll(address,address)977 function isApprovedForAll(address owner, address operator) public view returns (address) {978 require(false, stub_error);979 owner;980 operator;981 dummy;982 return 0x0000000000000000000000000000000000000000;983 }984}985986contract UniqueRefungible is987 Dummy,988 ERC165,989 ERC721,990 ERC721Enumerable,991 ERC721UniqueExtensions,992 ERC721UniqueMintable,993 ERC721Burnable,994 ERC721Metadata,995 Collection,996 TokenProperties997{}tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -13,7 +13,7 @@
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x5d354410
+/// @dev the ERC-165 identifier for this interface is 0xb3152af3
interface Collection is Dummy, ERC165 {
/// Set collection property.
///
@@ -37,6 +37,13 @@
/// or in textual repr: deleteCollectionProperty(string)
function deleteCollectionProperty(string memory key) external;
+ /// Delete collection properties.
+ ///
+ /// @param keys Properties keys.
+ /// @dev EVM selector for this function is: 0xee206ee3,
+ /// or in textual repr: deleteCollectionProperties(string[])
+ function deleteCollectionProperties(string[] memory keys) external;
+
/// Get collection property.
///
/// @dev Throws error if key not found.
@@ -49,7 +56,7 @@
/// Get collection properties.
///
- /// @param keys Properties keys.
+ /// @param keys Properties keys. Empty keys for all propertyes.
/// @return Vector of properties key/value pairs.
/// @dev EVM selector for this function is: 0x285fb8e6,
/// or in textual repr: collectionProperties(string[])
tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -62,7 +62,7 @@
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x5d354410
+/// @dev the ERC-165 identifier for this interface is 0xb3152af3
interface Collection is Dummy, ERC165 {
/// Set collection property.
///
@@ -86,6 +86,13 @@
/// or in textual repr: deleteCollectionProperty(string)
function deleteCollectionProperty(string memory key) external;
+ /// Delete collection properties.
+ ///
+ /// @param keys Properties keys.
+ /// @dev EVM selector for this function is: 0xee206ee3,
+ /// or in textual repr: deleteCollectionProperties(string[])
+ function deleteCollectionProperties(string[] memory keys) external;
+
/// Get collection property.
///
/// @dev Throws error if key not found.
@@ -98,7 +105,7 @@
/// Get collection properties.
///
- /// @param keys Properties keys.
+ /// @param keys Properties keys. Empty keys for all propertyes.
/// @return Vector of properties key/value pairs.
/// @dev EVM selector for this function is: 0x285fb8e6,
/// or in textual repr: collectionProperties(string[])
tests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -62,7 +62,7 @@
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x5d354410
+/// @dev the ERC-165 identifier for this interface is 0xb3152af3
interface Collection is Dummy, ERC165 {
/// Set collection property.
///
@@ -86,6 +86,13 @@
/// or in textual repr: deleteCollectionProperty(string)
function deleteCollectionProperty(string memory key) external;
+ /// Delete collection properties.
+ ///
+ /// @param keys Properties keys.
+ /// @dev EVM selector for this function is: 0xee206ee3,
+ /// or in textual repr: deleteCollectionProperties(string[])
+ function deleteCollectionProperties(string[] memory keys) external;
+
/// Get collection property.
///
/// @dev Throws error if key not found.
@@ -98,7 +105,7 @@
/// Get collection properties.
///
- /// @param keys Properties keys.
+ /// @param keys Properties keys. Empty keys for all propertyes.
/// @return Vector of properties key/value pairs.
/// @dev EVM selector for this function is: 0x285fb8e6,
/// or in textual repr: collectionProperties(string[])
tests/src/eth/collectionProperties.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionProperties.test.ts
+++ b/tests/src/eth/collectionProperties.test.ts
@@ -16,7 +16,7 @@
import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper} from './util';
import {Pallets} from '../util';
-import {IProperty, ITokenPropertyPermission} from '../util/playgrounds/types';
+import {IProperty, ITokenPropertyPermission, TCollectionMode} from '../util/playgrounds/types';
import {IKeyringPair} from '@polkadot/types/types';
describe('EVM collection properties', () => {
@@ -163,29 +163,89 @@
});
describe('EVM collection property', () => {
- itEth('Set/read properties', async ({helper, privateKey}) => {
- const alice = await privateKey('//Alice');
- const collection = await helper.nft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
+ let alice: IKeyringPair;
+
+ before(() => {
+ usingEthPlaygrounds(async (_helper, privateKey) => {
+ alice = await privateKey('//Alice');
+ });
+ });
+
+ async function testSetReadProperties(helper: EthUniqueHelper, mode: TCollectionMode) {
+ const collection = await helper[mode].mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
const sender = await helper.eth.createAccountWithBalance(alice, 100n);
await collection.addAdmin(alice, {Ethereum: sender});
const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
- const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', sender);
+ const contract = helper.ethNativeContract.collection(collectionAddress, mode, sender);
- const key1 = 'key1';
- const value1 = Buffer.from('value1');
-
- const key2 = 'key2';
- const value2 = Buffer.from('value2');
+ const keys = ['key0', 'key1'];
const writeProperties = [
- [key1, '0x'+value1.toString('hex')],
- [key2, '0x'+value2.toString('hex')],
+ helper.ethProperty.property(keys[0], 'value0'),
+ helper.ethProperty.property(keys[1], 'value1'),
];
await contract.methods.setCollectionProperties(writeProperties).send();
- const readProperties = await contract.methods.collectionProperties([key1, key2]).call();
+ const readProperties = await contract.methods.collectionProperties([keys[0], keys[1]]).call();
expect(readProperties).to.be.like(writeProperties);
+ }
+
+ itEth('Set/read properties ft', async ({helper}) => {
+ await testSetReadProperties(helper, 'ft');
+ });
+ itEth('Set/read properties rft', async ({helper}) => {
+ await testSetReadProperties(helper, 'rft');
+ });
+ itEth('Set/read properties nft', async ({helper}) => {
+ await testSetReadProperties(helper, 'nft');
+ });
+
+ async function testDeleteProperties(helper: EthUniqueHelper, mode: TCollectionMode) {
+ const collection = await helper[mode].mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
+
+ const sender = await helper.eth.createAccountWithBalance(alice, 100n);
+ await collection.addAdmin(alice, {Ethereum: sender});
+
+ const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
+ const contract = helper.ethNativeContract.collection(collectionAddress, mode, sender);
+
+ const keys = ['key0', 'key1', 'key2', 'key3'];
+
+ {
+ const writeProperties = [
+ helper.ethProperty.property(keys[0], 'value0'),
+ helper.ethProperty.property(keys[1], 'value1'),
+ helper.ethProperty.property(keys[2], 'value2'),
+ helper.ethProperty.property(keys[3], 'value3'),
+ ];
+
+ await contract.methods.setCollectionProperties(writeProperties).send();
+ const readProperties = await contract.methods.collectionProperties([keys[0], keys[1], keys[2], keys[3]]).call();
+ expect(readProperties).to.be.like(writeProperties);
+ }
+
+ {
+ const expectProperties = [
+ helper.ethProperty.property(keys[0], 'value0'),
+ helper.ethProperty.property(keys[1], 'value1'),
+ ];
+
+ await contract.methods.deleteCollectionProperties([keys[2], keys[3]]).send();
+ const readProperties = await contract.methods.collectionProperties([]).call();
+ expect(readProperties).to.be.like(expectProperties);
+ }
+ }
+
+ itEth('Delete properties ft', async ({helper}) => {
+ await testDeleteProperties(helper, 'ft');
+ });
+ itEth('Delete properties rft', async ({helper}) => {
+ await testDeleteProperties(helper, 'rft');
});
+ itEth('Delete properties nft', async ({helper}) => {
+ await testDeleteProperties(helper, 'nft');
+ });
+
});
tests/src/eth/fungibleAbi.jsondiffbeforeafterboth--- a/tests/src/eth/fungibleAbi.json
+++ b/tests/src/eth/fungibleAbi.json
@@ -293,6 +293,15 @@
"type": "function"
},
{
+ "inputs": [
+ { "internalType": "string[]", "name": "keys", "type": "string[]" }
+ ],
+ "name": "deleteCollectionProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
"inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
"name": "deleteCollectionProperty",
"outputs": [],
tests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -316,6 +316,15 @@
"type": "function"
},
{
+ "inputs": [
+ { "internalType": "string[]", "name": "keys", "type": "string[]" }
+ ],
+ "name": "deleteCollectionProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
"inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
"name": "deleteCollectionProperty",
"outputs": [],
tests/src/eth/reFungibleAbi.jsondiffbeforeafterboth--- a/tests/src/eth/reFungibleAbi.json
+++ b/tests/src/eth/reFungibleAbi.json
@@ -298,6 +298,15 @@
"type": "function"
},
{
+ "inputs": [
+ { "internalType": "string[]", "name": "keys", "type": "string[]" }
+ ],
+ "name": "deleteCollectionProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
"inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
"name": "deleteCollectionProperty",
"outputs": [],
tests/src/eth/util/playgrounds/types.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/types.ts
+++ b/tests/src/eth/util/playgrounds/types.ts
@@ -19,3 +19,6 @@
readonly field_0: string,
readonly field_1: string | Uint8Array,
}
+
+export type EthProperty = string[];
+
tests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -18,7 +18,7 @@
import {DevUniqueHelper} from '../../../util/playgrounds/unique.dev';
-import {ContractImports, CompiledContract, TEthCrossAccount, NormalizedEvent} from './types';
+import {ContractImports, CompiledContract, TEthCrossAccount, NormalizedEvent, EthProperty} from './types';
// Native contracts ABI
import collectionHelpersAbi from '../../collectionHelpersAbi.json';
@@ -28,6 +28,7 @@
import refungibleTokenAbi from '../../reFungibleTokenAbi.json';
import contractHelpersAbi from './../contractHelpersAbi.json';
import {ICrossAccountId, TEthereumAccount} from '../../../util/playgrounds/types';
+import {TCollectionMode} from '../../../util/playgrounds/types';
class EthGroupBase {
helper: EthUniqueHelper;
@@ -107,7 +108,7 @@
return new web3.eth.Contract(collectionHelpersAbi as any, '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f', {from: caller, gas: this.helper.eth.DEFAULT_GAS});
}
- collection(address: string, mode: 'nft' | 'rft' | 'ft', caller?: string): Contract {
+ collection(address: string, mode: TCollectionMode, caller?: string): Contract {
const abi = {
'nft': nonFungibleAbi,
'rft': refungibleAbi,
@@ -336,8 +337,16 @@
normalizeAddress(address: string): string {
return '0x' + address.substring(address.length - 40);
}
-}
+}
+export class EthPropertyGroup extends EthGroupBase {
+ property(key: string, value: string): EthProperty {
+ return [
+ key,
+ '0x'+Buffer.from(value).toString('hex'),
+ ];
+ }
+}
export type EthUniqueHelperConstructor = new (...args: any[]) => EthUniqueHelper;
export class EthCrossAccountGroup extends EthGroupBase {
@@ -369,6 +378,7 @@
ethNativeContract: NativeContractGroup;
ethContract: ContractGroup;
ethCrossAccount: EthCrossAccountGroup;
+ ethProperty: EthPropertyGroup;
constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {
options.helperBase = options.helperBase ?? EthUniqueHelper;
@@ -379,6 +389,7 @@
this.ethCrossAccount = new EthCrossAccountGroup(this);
this.ethNativeContract = new NativeContractGroup(this);
this.ethContract = new ContractGroup(this);
+ this.ethProperty = new EthPropertyGroup(this);
}
getWeb3(): Web3 {
tests/src/util/playgrounds/types.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/types.ts
+++ b/tests/src/util/playgrounds/types.ts
@@ -224,3 +224,4 @@
export type TRelayNetworks = 'rococo' | 'westend';
export type TNetworks = TUniqueNetworks | TSiblingNetworkds | TRelayNetworks;
export type TSigner = IKeyringPair; // | 'string'
+export type TCollectionMode = 'nft' | 'rft' | 'ft';