difftreelog
feat add eth methots for bulk properties
in: master
14 files changed
pallets/common/src/erc.rsdiffbeforeafterboth--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -27,7 +27,7 @@
use sp_std::vec::Vec;
use up_data_structs::{
AccessMode, CollectionMode, CollectionPermissions, OwnerRestrictedSet, Property,
- SponsoringRateLimit, SponsorshipState,
+ SponsoringRateLimit, SponsorshipState, PropertyKey,
};
use alloc::format;
@@ -97,6 +97,21 @@
.map_err(dispatch_to_evm::<T>)
}
+ /// Set collection properties.
+ ///
+ /// @param properties Vector of properties key/value pair.
+ #[weight(<SelfWeightOf<T>>::set_collection_properties(properties.len() as u32))]
+ fn set_collection_properties(
+ &mut self,
+ caller: caller,
+ properties: Vec<(string, bytes)>,
+ ) -> Result<void> {
+ for (key, value) in properties.into_iter() {
+ self.set_collection_property(caller, key, value)?;
+ }
+ Ok(())
+ }
+
/// Delete collection property.
///
/// @param key Property key.
@@ -123,12 +138,38 @@
.try_into()
.map_err(|_| "key too large")?;
- let props = <CollectionProperties<T>>::get(self.id);
+ let props = CollectionProperties::<T>::get(self.id);
let prop = props.get(&key).ok_or("key not found")?;
Ok(bytes(prop.to_vec()))
}
+ /// Get collection properties.
+ ///
+ /// @param keys Properties keys.
+ /// @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(
+ <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>)?;
+
+ 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_)
+ }
+
/// Set the sponsor of the collection.
///
/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
pallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/stubs/UniqueFungible.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 you to work with collections.21/// @dev the ERC-165 identifier for this interface is 0x25d897dc22contract Collection is Dummy, ERC165 {23 /// Set collection property.24 ///25 /// @param key Property key.26 /// @param value Propery value.27 /// @dev EVM selector for this function is: 0x2f073f66,28 /// or in textual repr: setCollectionProperty(string,bytes)29 function setCollectionProperty(string memory key, bytes memory value) public {30 require(false, stub_error);31 key;32 value;33 dummy = 0;34 }3536 /// Delete collection property.37 ///38 /// @param key Property key.39 /// @dev EVM selector for this function is: 0x7b7debce,40 /// or in textual repr: deleteCollectionProperty(string)41 function deleteCollectionProperty(string memory key) public {42 require(false, stub_error);43 key;44 dummy = 0;45 }4647 /// Get collection property.48 ///49 /// @dev Throws error if key not found.50 ///51 /// @param key Property key.52 /// @return bytes The property corresponding to the key.53 /// @dev EVM selector for this function is: 0xcf24fd6d,54 /// or in textual repr: collectionProperty(string)55 function collectionProperty(string memory key) public view returns (bytes memory) {56 require(false, stub_error);57 key;58 dummy;59 return hex"";60 }6162 /// Set the sponsor of the collection.63 ///64 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.65 ///66 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.67 /// @dev EVM selector for this function is: 0x7623402e,68 /// or in textual repr: setCollectionSponsor(address)69 function setCollectionSponsor(address sponsor) public {70 require(false, stub_error);71 sponsor;72 dummy = 0;73 }7475 /// Set the sponsor of the collection.76 ///77 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.78 ///79 /// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.80 /// @dev EVM selector for this function is: 0x84a1d5a8,81 /// or in textual repr: setCollectionSponsorCross((address,uint256))82 function setCollectionSponsorCross(Tuple6 memory sponsor) public {83 require(false, stub_error);84 sponsor;85 dummy = 0;86 }8788 /// Whether there is a pending sponsor.89 /// @dev EVM selector for this function is: 0x058ac185,90 /// or in textual repr: hasCollectionPendingSponsor()91 function hasCollectionPendingSponsor() public view returns (bool) {92 require(false, stub_error);93 dummy;94 return false;95 }9697 /// Collection sponsorship confirmation.98 ///99 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.100 /// @dev EVM selector for this function is: 0x3c50e97a,101 /// or in textual repr: confirmCollectionSponsorship()102 function confirmCollectionSponsorship() public {103 require(false, stub_error);104 dummy = 0;105 }106107 /// Remove collection sponsor.108 /// @dev EVM selector for this function is: 0x6e0326a3,109 /// or in textual repr: removeCollectionSponsor()110 function removeCollectionSponsor() public {111 require(false, stub_error);112 dummy = 0;113 }114115 /// Get current sponsor.116 ///117 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.118 /// @dev EVM selector for this function is: 0x6ec0a9f1,119 /// or in textual repr: collectionSponsor()120 function collectionSponsor() public view returns (Tuple6 memory) {121 require(false, stub_error);122 dummy;123 return Tuple6(0x0000000000000000000000000000000000000000, 0);124 }125126 /// Set limits for the collection.127 /// @dev Throws error if limit not found.128 /// @param limit Name of the limit. Valid names:129 /// "accountTokenOwnershipLimit",130 /// "sponsoredDataSize",131 /// "sponsoredDataRateLimit",132 /// "tokenLimit",133 /// "sponsorTransferTimeout",134 /// "sponsorApproveTimeout"135 /// @param value Value of the limit.136 /// @dev EVM selector for this function is: 0x6a3841db,137 /// or in textual repr: setCollectionLimit(string,uint32)138 function setCollectionLimit(string memory limit, uint32 value) public {139 require(false, stub_error);140 limit;141 value;142 dummy = 0;143 }144145 /// Set limits for the collection.146 /// @dev Throws error if limit not found.147 /// @param limit Name of the limit. Valid names:148 /// "ownerCanTransfer",149 /// "ownerCanDestroy",150 /// "transfersEnabled"151 /// @param value Value of the limit.152 /// @dev EVM selector for this function is: 0x993b7fba,153 /// or in textual repr: setCollectionLimit(string,bool)154 function setCollectionLimit(string memory limit, bool value) public {155 require(false, stub_error);156 limit;157 value;158 dummy = 0;159 }160161 /// Get contract address.162 /// @dev EVM selector for this function is: 0xf6b4dfb4,163 /// or in textual repr: contractAddress()164 function contractAddress() public view returns (address) {165 require(false, stub_error);166 dummy;167 return 0x0000000000000000000000000000000000000000;168 }169170 /// Add collection admin.171 /// @param newAdmin Cross account administrator address.172 /// @dev EVM selector for this function is: 0x859aa7d6,173 /// or in textual repr: addCollectionAdminCross((address,uint256))174 function addCollectionAdminCross(Tuple6 memory newAdmin) public {175 require(false, stub_error);176 newAdmin;177 dummy = 0;178 }179180 /// Remove collection admin.181 /// @param admin Cross account administrator address.182 /// @dev EVM selector for this function is: 0x6c0cd173,183 /// or in textual repr: removeCollectionAdminCross((address,uint256))184 function removeCollectionAdminCross(Tuple6 memory admin) public {185 require(false, stub_error);186 admin;187 dummy = 0;188 }189190 /// Add collection admin.191 /// @param newAdmin Address of the added administrator.192 /// @dev EVM selector for this function is: 0x92e462c7,193 /// or in textual repr: addCollectionAdmin(address)194 function addCollectionAdmin(address newAdmin) public {195 require(false, stub_error);196 newAdmin;197 dummy = 0;198 }199200 /// Remove collection admin.201 ///202 /// @param admin Address of the removed administrator.203 /// @dev EVM selector for this function is: 0xfafd7b42,204 /// or in textual repr: removeCollectionAdmin(address)205 function removeCollectionAdmin(address admin) public {206 require(false, stub_error);207 admin;208 dummy = 0;209 }210211 /// Toggle accessibility of collection nesting.212 ///213 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'214 /// @dev EVM selector for this function is: 0x112d4586,215 /// or in textual repr: setCollectionNesting(bool)216 function setCollectionNesting(bool enable) public {217 require(false, stub_error);218 enable;219 dummy = 0;220 }221222 /// Toggle accessibility of collection nesting.223 ///224 /// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'225 /// @param collections Addresses of collections that will be available for nesting.226 /// @dev EVM selector for this function is: 0x64872396,227 /// or in textual repr: setCollectionNesting(bool,address[])228 function setCollectionNesting(bool enable, address[] memory collections) public {229 require(false, stub_error);230 enable;231 collections;232 dummy = 0;233 }234235 /// Set the collection access method.236 /// @param mode Access mode237 /// 0 for Normal238 /// 1 for AllowList239 /// @dev EVM selector for this function is: 0x41835d4c,240 /// or in textual repr: setCollectionAccess(uint8)241 function setCollectionAccess(uint8 mode) public {242 require(false, stub_error);243 mode;244 dummy = 0;245 }246247 /// Checks that user allowed to operate with collection.248 ///249 /// @param user User address to check.250 /// @dev EVM selector for this function is: 0xd63a8e11,251 /// or in textual repr: allowed(address)252 function allowed(address user) public view returns (bool) {253 require(false, stub_error);254 user;255 dummy;256 return false;257 }258259 /// Add the user to the allowed list.260 ///261 /// @param user Address of a trusted user.262 /// @dev EVM selector for this function is: 0x67844fe6,263 /// or in textual repr: addToCollectionAllowList(address)264 function addToCollectionAllowList(address user) public {265 require(false, stub_error);266 user;267 dummy = 0;268 }269270 /// Add user to allowed list.271 ///272 /// @param user User cross account address.273 /// @dev EVM selector for this function is: 0xa0184a3a,274 /// or in textual repr: addToCollectionAllowListCross((address,uint256))275 function addToCollectionAllowListCross(Tuple6 memory user) public {276 require(false, stub_error);277 user;278 dummy = 0;279 }280281 /// Remove the user from the allowed list.282 ///283 /// @param user Address of a removed user.284 /// @dev EVM selector for this function is: 0x85c51acb,285 /// or in textual repr: removeFromCollectionAllowList(address)286 function removeFromCollectionAllowList(address user) public {287 require(false, stub_error);288 user;289 dummy = 0;290 }291292 /// Remove user from allowed list.293 ///294 /// @param user User cross account address.295 /// @dev EVM selector for this function is: 0x09ba452a,296 /// or in textual repr: removeFromCollectionAllowListCross((address,uint256))297 function removeFromCollectionAllowListCross(Tuple6 memory user) public {298 require(false, stub_error);299 user;300 dummy = 0;301 }302303 /// Switch permission for minting.304 ///305 /// @param mode Enable if "true".306 /// @dev EVM selector for this function is: 0x00018e84,307 /// or in textual repr: setCollectionMintMode(bool)308 function setCollectionMintMode(bool mode) public {309 require(false, stub_error);310 mode;311 dummy = 0;312 }313314 /// Check that account is the owner or admin of the collection315 ///316 /// @param user account to verify317 /// @return "true" if account is the owner or admin318 /// @dev EVM selector for this function is: 0x9811b0c7,319 /// or in textual repr: isOwnerOrAdmin(address)320 function isOwnerOrAdmin(address user) public view returns (bool) {321 require(false, stub_error);322 user;323 dummy;324 return false;325 }326327 /// Check that account is the owner or admin of the collection328 ///329 /// @param user User cross account to verify330 /// @return "true" if account is the owner or admin331 /// @dev EVM selector for this function is: 0x3e75a905,332 /// or in textual repr: isOwnerOrAdminCross((address,uint256))333 function isOwnerOrAdminCross(Tuple6 memory user) public view returns (bool) {334 require(false, stub_error);335 user;336 dummy;337 return false;338 }339340 /// Returns collection type341 ///342 /// @return `Fungible` or `NFT` or `ReFungible`343 /// @dev EVM selector for this function is: 0xd34b55b8,344 /// or in textual repr: uniqueCollectionType()345 function uniqueCollectionType() public view returns (string memory) {346 require(false, stub_error);347 dummy;348 return "";349 }350351 /// Get collection owner.352 ///353 /// @return Tuble with sponsor address and his substrate mirror.354 /// If address is canonical then substrate mirror is zero and vice versa.355 /// @dev EVM selector for this function is: 0xdf727d3b,356 /// or in textual repr: collectionOwner()357 function collectionOwner() public view returns (Tuple6 memory) {358 require(false, stub_error);359 dummy;360 return Tuple6(0x0000000000000000000000000000000000000000, 0);361 }362363 /// Changes collection owner to another account364 ///365 /// @dev Owner can be changed only by current owner366 /// @param newOwner new owner account367 /// @dev EVM selector for this function is: 0x4f53e226,368 /// or in textual repr: changeCollectionOwner(address)369 function changeCollectionOwner(address newOwner) public {370 require(false, stub_error);371 newOwner;372 dummy = 0;373 }374375 /// Get collection administrators376 ///377 /// @return Vector of tuples with admins address and his substrate mirror.378 /// If address is canonical then substrate mirror is zero and vice versa.379 /// @dev EVM selector for this function is: 0x5813216b,380 /// or in textual repr: collectionAdmins()381 function collectionAdmins() public view returns (Tuple6[] memory) {382 require(false, stub_error);383 dummy;384 return new Tuple6[](0);385 }386387 /// Changes collection owner to another account388 ///389 /// @dev Owner can be changed only by current owner390 /// @param newOwner new owner cross account391 /// @dev EVM selector for this function is: 0xe5c9913f,392 /// or in textual repr: setOwnerCross((address,uint256))393 function setOwnerCross(Tuple6 memory newOwner) public {394 require(false, stub_error);395 newOwner;396 dummy = 0;397 }398}399400/// @dev the ERC-165 identifier for this interface is 0x032e5926401contract ERC20UniqueExtensions is Dummy, ERC165 {402 /// @dev EVM selector for this function is: 0x0ecd0ab0,403 /// or in textual repr: approveCross((address,uint256),uint256)404 function approveCross(Tuple6 memory spender, uint256 amount) public returns (bool) {405 require(false, stub_error);406 spender;407 amount;408 dummy = 0;409 return false;410 }411412 /// Burn tokens from account413 /// @dev Function that burns an `amount` of the tokens of a given account,414 /// deducting from the sender's allowance for said account.415 /// @param from The account whose tokens will be burnt.416 /// @param amount The amount that will be burnt.417 /// @dev EVM selector for this function is: 0x79cc6790,418 /// or in textual repr: burnFrom(address,uint256)419 function burnFrom(address from, uint256 amount) public returns (bool) {420 require(false, stub_error);421 from;422 amount;423 dummy = 0;424 return false;425 }426427 /// Burn tokens from account428 /// @dev Function that burns an `amount` of the tokens of a given account,429 /// deducting from the sender's allowance for said account.430 /// @param from The account whose tokens will be burnt.431 /// @param amount The amount that will be burnt.432 /// @dev EVM selector for this function is: 0xbb2f5a58,433 /// or in textual repr: burnFromCross((address,uint256),uint256)434 function burnFromCross(Tuple6 memory from, uint256 amount) public returns (bool) {435 require(false, stub_error);436 from;437 amount;438 dummy = 0;439 return false;440 }441442 /// Mint tokens for multiple accounts.443 /// @param amounts array of pairs of account address and amount444 /// @dev EVM selector for this function is: 0x1acf2d55,445 /// or in textual repr: mintBulk((address,uint256)[])446 function mintBulk(Tuple6[] memory amounts) public returns (bool) {447 require(false, stub_error);448 amounts;449 dummy = 0;450 return false;451 }452453 /// @dev EVM selector for this function is: 0xd5cf430b,454 /// or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)455 function transferFromCross(456 Tuple6 memory from,457 Tuple6 memory to,458 uint256 amount459 ) public returns (bool) {460 require(false, stub_error);461 from;462 to;463 amount;464 dummy = 0;465 return false;466 }467}468469/// @dev anonymous struct470struct Tuple6 {471 address field_0;472 uint256 field_1;473}474475/// @dev the ERC-165 identifier for this interface is 0x40c10f19476contract ERC20Mintable is Dummy, ERC165 {477 /// Mint tokens for `to` account.478 /// @param to account that will receive minted tokens479 /// @param amount amount of tokens to mint480 /// @dev EVM selector for this function is: 0x40c10f19,481 /// or in textual repr: mint(address,uint256)482 function mint(address to, uint256 amount) public returns (bool) {483 require(false, stub_error);484 to;485 amount;486 dummy = 0;487 return false;488 }489}490491/// @dev inlined interface492contract ERC20Events {493 event Transfer(address indexed from, address indexed to, uint256 value);494 event Approval(address indexed owner, address indexed spender, uint256 value);495}496497/// @dev the ERC-165 identifier for this interface is 0x942e8b22498contract ERC20 is Dummy, ERC165, ERC20Events {499 /// @dev EVM selector for this function is: 0x06fdde03,500 /// or in textual repr: name()501 function name() public view returns (string memory) {502 require(false, stub_error);503 dummy;504 return "";505 }506507 /// @dev EVM selector for this function is: 0x95d89b41,508 /// or in textual repr: symbol()509 function symbol() public view returns (string memory) {510 require(false, stub_error);511 dummy;512 return "";513 }514515 /// @dev EVM selector for this function is: 0x18160ddd,516 /// or in textual repr: totalSupply()517 function totalSupply() public view returns (uint256) {518 require(false, stub_error);519 dummy;520 return 0;521 }522523 /// @dev EVM selector for this function is: 0x313ce567,524 /// or in textual repr: decimals()525 function decimals() public view returns (uint8) {526 require(false, stub_error);527 dummy;528 return 0;529 }530531 /// @dev EVM selector for this function is: 0x70a08231,532 /// or in textual repr: balanceOf(address)533 function balanceOf(address owner) public view returns (uint256) {534 require(false, stub_error);535 owner;536 dummy;537 return 0;538 }539540 /// @dev EVM selector for this function is: 0xa9059cbb,541 /// or in textual repr: transfer(address,uint256)542 function transfer(address to, uint256 amount) public returns (bool) {543 require(false, stub_error);544 to;545 amount;546 dummy = 0;547 return false;548 }549550 /// @dev EVM selector for this function is: 0x23b872dd,551 /// or in textual repr: transferFrom(address,address,uint256)552 function transferFrom(553 address from,554 address to,555 uint256 amount556 ) public returns (bool) {557 require(false, stub_error);558 from;559 to;560 amount;561 dummy = 0;562 return false;563 }564565 /// @dev EVM selector for this function is: 0x095ea7b3,566 /// or in textual repr: approve(address,uint256)567 function approve(address spender, uint256 amount) public returns (bool) {568 require(false, stub_error);569 spender;570 amount;571 dummy = 0;572 return false;573 }574575 /// @dev EVM selector for this function is: 0xdd62ed3e,576 /// or in textual repr: allowance(address,address)577 function allowance(address owner, address spender) public view returns (uint256) {578 require(false, stub_error);579 owner;580 spender;581 dummy;582 return 0;583 }584}585586contract UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}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 you to work with collections.21/// @dev the ERC-165 identifier for this interface is 0x5d35441022contract Collection is Dummy, ERC165 {23 /// Set collection property.24 ///25 /// @param key Property key.26 /// @param value Propery value.27 /// @dev EVM selector for this function is: 0x2f073f66,28 /// or in textual repr: setCollectionProperty(string,bytes)29 function setCollectionProperty(string memory key, bytes memory value) public {30 require(false, stub_error);31 key;32 value;33 dummy = 0;34 }3536 /// Set collection properties.37 ///38 /// @param properties Vector of properties key/value pair.39 /// @dev EVM selector for this function is: 0x50b26b2a,40 /// or in textual repr: setCollectionProperties((string,bytes)[])41 function setCollectionProperties(Tuple10[] memory properties) public {42 require(false, stub_error);43 properties;44 dummy = 0;45 }4647 /// Delete collection property.48 ///49 /// @param key Property key.50 /// @dev EVM selector for this function is: 0x7b7debce,51 /// or in textual repr: deleteCollectionProperty(string)52 function deleteCollectionProperty(string memory key) public {53 require(false, stub_error);54 key;55 dummy = 0;56 }5758 /// Get collection property.59 ///60 /// @dev Throws error if key not found.61 ///62 /// @param key Property key.63 /// @return bytes The property corresponding to the key.64 /// @dev EVM selector for this function is: 0xcf24fd6d,65 /// or in textual repr: collectionProperty(string)66 function collectionProperty(string memory key) public view returns (bytes memory) {67 require(false, stub_error);68 key;69 dummy;70 return hex"";71 }7273 /// Get collection properties.74 ///75 /// @param keys Properties keys.76 /// @return Vector of properties key/value pairs.77 /// @dev EVM selector for this function is: 0x285fb8e6,78 /// or in textual repr: collectionProperties(string[])79 function collectionProperties(string[] memory keys) public view returns (Tuple10[] memory) {80 require(false, stub_error);81 keys;82 dummy;83 return new Tuple10[](0);84 }8586 /// Set the sponsor of the collection.87 ///88 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.89 ///90 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.91 /// @dev EVM selector for this function is: 0x7623402e,92 /// or in textual repr: setCollectionSponsor(address)93 function setCollectionSponsor(address sponsor) public {94 require(false, stub_error);95 sponsor;96 dummy = 0;97 }9899 /// Set the sponsor of the collection.100 ///101 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.102 ///103 /// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.104 /// @dev EVM selector for this function is: 0x84a1d5a8,105 /// or in textual repr: setCollectionSponsorCross((address,uint256))106 function setCollectionSponsorCross(Tuple6 memory sponsor) public {107 require(false, stub_error);108 sponsor;109 dummy = 0;110 }111112 /// Whether there is a pending sponsor.113 /// @dev EVM selector for this function is: 0x058ac185,114 /// or in textual repr: hasCollectionPendingSponsor()115 function hasCollectionPendingSponsor() public view returns (bool) {116 require(false, stub_error);117 dummy;118 return false;119 }120121 /// Collection sponsorship confirmation.122 ///123 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.124 /// @dev EVM selector for this function is: 0x3c50e97a,125 /// or in textual repr: confirmCollectionSponsorship()126 function confirmCollectionSponsorship() public {127 require(false, stub_error);128 dummy = 0;129 }130131 /// Remove collection sponsor.132 /// @dev EVM selector for this function is: 0x6e0326a3,133 /// or in textual repr: removeCollectionSponsor()134 function removeCollectionSponsor() public {135 require(false, stub_error);136 dummy = 0;137 }138139 /// Get current sponsor.140 ///141 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.142 /// @dev EVM selector for this function is: 0x6ec0a9f1,143 /// or in textual repr: collectionSponsor()144 function collectionSponsor() public view returns (Tuple6 memory) {145 require(false, stub_error);146 dummy;147 return Tuple6(0x0000000000000000000000000000000000000000, 0);148 }149150 /// Set limits for the collection.151 /// @dev Throws error if limit not found.152 /// @param limit Name of the limit. Valid names:153 /// "accountTokenOwnershipLimit",154 /// "sponsoredDataSize",155 /// "sponsoredDataRateLimit",156 /// "tokenLimit",157 /// "sponsorTransferTimeout",158 /// "sponsorApproveTimeout"159 /// @param value Value of the limit.160 /// @dev EVM selector for this function is: 0x6a3841db,161 /// or in textual repr: setCollectionLimit(string,uint32)162 function setCollectionLimit(string memory limit, uint32 value) public {163 require(false, stub_error);164 limit;165 value;166 dummy = 0;167 }168169 /// Set limits for the collection.170 /// @dev Throws error if limit not found.171 /// @param limit Name of the limit. Valid names:172 /// "ownerCanTransfer",173 /// "ownerCanDestroy",174 /// "transfersEnabled"175 /// @param value Value of the limit.176 /// @dev EVM selector for this function is: 0x993b7fba,177 /// or in textual repr: setCollectionLimit(string,bool)178 function setCollectionLimit(string memory limit, bool value) public {179 require(false, stub_error);180 limit;181 value;182 dummy = 0;183 }184185 /// Get contract address.186 /// @dev EVM selector for this function is: 0xf6b4dfb4,187 /// or in textual repr: contractAddress()188 function contractAddress() public view returns (address) {189 require(false, stub_error);190 dummy;191 return 0x0000000000000000000000000000000000000000;192 }193194 /// Add collection admin.195 /// @param newAdmin Cross account administrator address.196 /// @dev EVM selector for this function is: 0x859aa7d6,197 /// or in textual repr: addCollectionAdminCross((address,uint256))198 function addCollectionAdminCross(Tuple6 memory newAdmin) public {199 require(false, stub_error);200 newAdmin;201 dummy = 0;202 }203204 /// Remove collection admin.205 /// @param admin Cross account administrator address.206 /// @dev EVM selector for this function is: 0x6c0cd173,207 /// or in textual repr: removeCollectionAdminCross((address,uint256))208 function removeCollectionAdminCross(Tuple6 memory admin) public {209 require(false, stub_error);210 admin;211 dummy = 0;212 }213214 /// Add collection admin.215 /// @param newAdmin Address of the added administrator.216 /// @dev EVM selector for this function is: 0x92e462c7,217 /// or in textual repr: addCollectionAdmin(address)218 function addCollectionAdmin(address newAdmin) public {219 require(false, stub_error);220 newAdmin;221 dummy = 0;222 }223224 /// Remove collection admin.225 ///226 /// @param admin Address of the removed administrator.227 /// @dev EVM selector for this function is: 0xfafd7b42,228 /// or in textual repr: removeCollectionAdmin(address)229 function removeCollectionAdmin(address admin) public {230 require(false, stub_error);231 admin;232 dummy = 0;233 }234235 /// Toggle accessibility of collection nesting.236 ///237 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'238 /// @dev EVM selector for this function is: 0x112d4586,239 /// or in textual repr: setCollectionNesting(bool)240 function setCollectionNesting(bool enable) public {241 require(false, stub_error);242 enable;243 dummy = 0;244 }245246 /// Toggle accessibility of collection nesting.247 ///248 /// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'249 /// @param collections Addresses of collections that will be available for nesting.250 /// @dev EVM selector for this function is: 0x64872396,251 /// or in textual repr: setCollectionNesting(bool,address[])252 function setCollectionNesting(bool enable, address[] memory collections) public {253 require(false, stub_error);254 enable;255 collections;256 dummy = 0;257 }258259 /// Set the collection access method.260 /// @param mode Access mode261 /// 0 for Normal262 /// 1 for AllowList263 /// @dev EVM selector for this function is: 0x41835d4c,264 /// or in textual repr: setCollectionAccess(uint8)265 function setCollectionAccess(uint8 mode) public {266 require(false, stub_error);267 mode;268 dummy = 0;269 }270271 /// Checks that user allowed to operate with collection.272 ///273 /// @param user User address to check.274 /// @dev EVM selector for this function is: 0xd63a8e11,275 /// or in textual repr: allowed(address)276 function allowed(address user) public view returns (bool) {277 require(false, stub_error);278 user;279 dummy;280 return false;281 }282283 /// Add the user to the allowed list.284 ///285 /// @param user Address of a trusted user.286 /// @dev EVM selector for this function is: 0x67844fe6,287 /// or in textual repr: addToCollectionAllowList(address)288 function addToCollectionAllowList(address user) public {289 require(false, stub_error);290 user;291 dummy = 0;292 }293294 /// Add user to allowed list.295 ///296 /// @param user User cross account address.297 /// @dev EVM selector for this function is: 0xa0184a3a,298 /// or in textual repr: addToCollectionAllowListCross((address,uint256))299 function addToCollectionAllowListCross(Tuple6 memory user) public {300 require(false, stub_error);301 user;302 dummy = 0;303 }304305 /// Remove the user from the allowed list.306 ///307 /// @param user Address of a removed user.308 /// @dev EVM selector for this function is: 0x85c51acb,309 /// or in textual repr: removeFromCollectionAllowList(address)310 function removeFromCollectionAllowList(address user) public {311 require(false, stub_error);312 user;313 dummy = 0;314 }315316 /// Remove user from allowed list.317 ///318 /// @param user User cross account address.319 /// @dev EVM selector for this function is: 0x09ba452a,320 /// or in textual repr: removeFromCollectionAllowListCross((address,uint256))321 function removeFromCollectionAllowListCross(Tuple6 memory user) public {322 require(false, stub_error);323 user;324 dummy = 0;325 }326327 /// Switch permission for minting.328 ///329 /// @param mode Enable if "true".330 /// @dev EVM selector for this function is: 0x00018e84,331 /// or in textual repr: setCollectionMintMode(bool)332 function setCollectionMintMode(bool mode) public {333 require(false, stub_error);334 mode;335 dummy = 0;336 }337338 /// Check that account is the owner or admin of the collection339 ///340 /// @param user account to verify341 /// @return "true" if account is the owner or admin342 /// @dev EVM selector for this function is: 0x9811b0c7,343 /// or in textual repr: isOwnerOrAdmin(address)344 function isOwnerOrAdmin(address user) public view returns (bool) {345 require(false, stub_error);346 user;347 dummy;348 return false;349 }350351 /// Check that account is the owner or admin of the collection352 ///353 /// @param user User cross account to verify354 /// @return "true" if account is the owner or admin355 /// @dev EVM selector for this function is: 0x3e75a905,356 /// or in textual repr: isOwnerOrAdminCross((address,uint256))357 function isOwnerOrAdminCross(Tuple6 memory user) public view returns (bool) {358 require(false, stub_error);359 user;360 dummy;361 return false;362 }363364 /// Returns collection type365 ///366 /// @return `Fungible` or `NFT` or `ReFungible`367 /// @dev EVM selector for this function is: 0xd34b55b8,368 /// or in textual repr: uniqueCollectionType()369 function uniqueCollectionType() public view returns (string memory) {370 require(false, stub_error);371 dummy;372 return "";373 }374375 /// Get collection owner.376 ///377 /// @return Tuble with sponsor address and his substrate mirror.378 /// If address is canonical then substrate mirror is zero and vice versa.379 /// @dev EVM selector for this function is: 0xdf727d3b,380 /// or in textual repr: collectionOwner()381 function collectionOwner() public view returns (Tuple6 memory) {382 require(false, stub_error);383 dummy;384 return Tuple6(0x0000000000000000000000000000000000000000, 0);385 }386387 /// Changes collection owner to another account388 ///389 /// @dev Owner can be changed only by current owner390 /// @param newOwner new owner account391 /// @dev EVM selector for this function is: 0x4f53e226,392 /// or in textual repr: changeCollectionOwner(address)393 function changeCollectionOwner(address newOwner) public {394 require(false, stub_error);395 newOwner;396 dummy = 0;397 }398399 /// Get collection administrators400 ///401 /// @return Vector of tuples with admins address and his substrate mirror.402 /// If address is canonical then substrate mirror is zero and vice versa.403 /// @dev EVM selector for this function is: 0x5813216b,404 /// or in textual repr: collectionAdmins()405 function collectionAdmins() public view returns (Tuple6[] memory) {406 require(false, stub_error);407 dummy;408 return new Tuple6[](0);409 }410411 /// Changes collection owner to another account412 ///413 /// @dev Owner can be changed only by current owner414 /// @param newOwner new owner cross account415 /// @dev EVM selector for this function is: 0xe5c9913f,416 /// or in textual repr: setOwnerCross((address,uint256))417 function setOwnerCross(Tuple6 memory newOwner) public {418 require(false, stub_error);419 newOwner;420 dummy = 0;421 }422}423424/// @dev anonymous struct425struct Tuple10 {426 string field_0;427 bytes field_1;428}429430/// @dev the ERC-165 identifier for this interface is 0x032e5926431contract ERC20UniqueExtensions is Dummy, ERC165 {432 /// @dev EVM selector for this function is: 0x0ecd0ab0,433 /// or in textual repr: approveCross((address,uint256),uint256)434 function approveCross(Tuple6 memory spender, uint256 amount) public returns (bool) {435 require(false, stub_error);436 spender;437 amount;438 dummy = 0;439 return false;440 }441442 /// Burn tokens from account443 /// @dev Function that burns an `amount` of the tokens of a given account,444 /// deducting from the sender's allowance for said account.445 /// @param from The account whose tokens will be burnt.446 /// @param amount The amount that will be burnt.447 /// @dev EVM selector for this function is: 0x79cc6790,448 /// or in textual repr: burnFrom(address,uint256)449 function burnFrom(address from, uint256 amount) public returns (bool) {450 require(false, stub_error);451 from;452 amount;453 dummy = 0;454 return false;455 }456457 /// Burn tokens from account458 /// @dev Function that burns an `amount` of the tokens of a given account,459 /// deducting from the sender's allowance for said account.460 /// @param from The account whose tokens will be burnt.461 /// @param amount The amount that will be burnt.462 /// @dev EVM selector for this function is: 0xbb2f5a58,463 /// or in textual repr: burnFromCross((address,uint256),uint256)464 function burnFromCross(Tuple6 memory from, uint256 amount) public returns (bool) {465 require(false, stub_error);466 from;467 amount;468 dummy = 0;469 return false;470 }471472 /// Mint tokens for multiple accounts.473 /// @param amounts array of pairs of account address and amount474 /// @dev EVM selector for this function is: 0x1acf2d55,475 /// or in textual repr: mintBulk((address,uint256)[])476 function mintBulk(Tuple6[] memory amounts) public returns (bool) {477 require(false, stub_error);478 amounts;479 dummy = 0;480 return false;481 }482483 /// @dev EVM selector for this function is: 0xd5cf430b,484 /// or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)485 function transferFromCross(486 Tuple6 memory from,487 Tuple6 memory to,488 uint256 amount489 ) public returns (bool) {490 require(false, stub_error);491 from;492 to;493 amount;494 dummy = 0;495 return false;496 }497}498499/// @dev anonymous struct500struct Tuple6 {501 address field_0;502 uint256 field_1;503}504505/// @dev the ERC-165 identifier for this interface is 0x40c10f19506contract ERC20Mintable is Dummy, ERC165 {507 /// Mint tokens for `to` account.508 /// @param to account that will receive minted tokens509 /// @param amount amount of tokens to mint510 /// @dev EVM selector for this function is: 0x40c10f19,511 /// or in textual repr: mint(address,uint256)512 function mint(address to, uint256 amount) public returns (bool) {513 require(false, stub_error);514 to;515 amount;516 dummy = 0;517 return false;518 }519}520521/// @dev inlined interface522contract ERC20Events {523 event Transfer(address indexed from, address indexed to, uint256 value);524 event Approval(address indexed owner, address indexed spender, uint256 value);525}526527/// @dev the ERC-165 identifier for this interface is 0x942e8b22528contract ERC20 is Dummy, ERC165, ERC20Events {529 /// @dev EVM selector for this function is: 0x06fdde03,530 /// or in textual repr: name()531 function name() public view returns (string memory) {532 require(false, stub_error);533 dummy;534 return "";535 }536537 /// @dev EVM selector for this function is: 0x95d89b41,538 /// or in textual repr: symbol()539 function symbol() public view returns (string memory) {540 require(false, stub_error);541 dummy;542 return "";543 }544545 /// @dev EVM selector for this function is: 0x18160ddd,546 /// or in textual repr: totalSupply()547 function totalSupply() public view returns (uint256) {548 require(false, stub_error);549 dummy;550 return 0;551 }552553 /// @dev EVM selector for this function is: 0x313ce567,554 /// or in textual repr: decimals()555 function decimals() public view returns (uint8) {556 require(false, stub_error);557 dummy;558 return 0;559 }560561 /// @dev EVM selector for this function is: 0x70a08231,562 /// or in textual repr: balanceOf(address)563 function balanceOf(address owner) public view returns (uint256) {564 require(false, stub_error);565 owner;566 dummy;567 return 0;568 }569570 /// @dev EVM selector for this function is: 0xa9059cbb,571 /// or in textual repr: transfer(address,uint256)572 function transfer(address to, uint256 amount) public returns (bool) {573 require(false, stub_error);574 to;575 amount;576 dummy = 0;577 return false;578 }579580 /// @dev EVM selector for this function is: 0x23b872dd,581 /// or in textual repr: transferFrom(address,address,uint256)582 function transferFrom(583 address from,584 address to,585 uint256 amount586 ) public returns (bool) {587 require(false, stub_error);588 from;589 to;590 amount;591 dummy = 0;592 return false;593 }594595 /// @dev EVM selector for this function is: 0x095ea7b3,596 /// or in textual repr: approve(address,uint256)597 function approve(address spender, uint256 amount) public returns (bool) {598 require(false, stub_error);599 spender;600 amount;601 dummy = 0;602 return false;603 }604605 /// @dev EVM selector for this function is: 0xdd62ed3e,606 /// or in textual repr: allowance(address,address)607 function allowance(address owner, address spender) public view returns (uint256) {608 require(false, stub_error);609 owner;610 spender;611 dummy;612 return 0;613 }614}615616contract UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}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 0x25d897dc
+/// @dev the ERC-165 identifier for this interface is 0x5d354410
contract Collection is Dummy, ERC165 {
/// Set collection property.
///
@@ -106,6 +106,17 @@
dummy = 0;
}
+ /// Set collection properties.
+ ///
+ /// @param properties Vector of properties key/value pair.
+ /// @dev EVM selector for this function is: 0x50b26b2a,
+ /// or in textual repr: setCollectionProperties((string,bytes)[])
+ function setCollectionProperties(Tuple19[] memory properties) public {
+ require(false, stub_error);
+ properties;
+ dummy = 0;
+ }
+
/// Delete collection property.
///
/// @param key Property key.
@@ -132,6 +143,19 @@
return hex"";
}
+ /// Get collection properties.
+ ///
+ /// @param keys Properties keys.
+ /// @return Vector of properties key/value pairs.
+ /// @dev EVM selector for this function is: 0x285fb8e6,
+ /// or in textual repr: collectionProperties(string[])
+ function collectionProperties(string[] memory keys) public view returns (Tuple19[] memory) {
+ require(false, stub_error);
+ keys;
+ dummy;
+ return new Tuple19[](0);
+ }
+
/// Set the sponsor of the collection.
///
/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
@@ -470,6 +494,12 @@
}
}
+/// @dev anonymous struct
+struct Tuple19 {
+ string field_0;
+ bytes field_1;
+}
+
/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
/// @dev See https://eips.ethereum.org/EIPS/eip-721
/// @dev the ERC-165 identifier for this interface is 0x5b5e139f
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
@@ -91,7 +91,7 @@
}
/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x25d897dc
+/// @dev the ERC-165 identifier for this interface is 0x5d354410
contract Collection is Dummy, ERC165 {
/// Set collection property.
///
@@ -106,6 +106,17 @@
dummy = 0;
}
+ /// Set collection properties.
+ ///
+ /// @param properties Vector of properties key/value pair.
+ /// @dev EVM selector for this function is: 0x50b26b2a,
+ /// or in textual repr: setCollectionProperties((string,bytes)[])
+ function setCollectionProperties(Tuple19[] memory properties) public {
+ require(false, stub_error);
+ properties;
+ dummy = 0;
+ }
+
/// Delete collection property.
///
/// @param key Property key.
@@ -132,6 +143,19 @@
return hex"";
}
+ /// Get collection properties.
+ ///
+ /// @param keys Properties keys.
+ /// @return Vector of properties key/value pairs.
+ /// @dev EVM selector for this function is: 0x285fb8e6,
+ /// or in textual repr: collectionProperties(string[])
+ function collectionProperties(string[] memory keys) public view returns (Tuple19[] memory) {
+ require(false, stub_error);
+ keys;
+ dummy;
+ return new Tuple19[](0);
+ }
+
/// Set the sponsor of the collection.
///
/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
@@ -470,6 +494,12 @@
}
}
+/// @dev anonymous struct
+struct Tuple19 {
+ string field_0;
+ bytes field_1;
+}
+
/// @dev the ERC-165 identifier for this interface is 0x5b5e139f
contract ERC721Metadata is Dummy, ERC165 {
// /// @notice A descriptive name for a collection of NFTs in this contract
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 0x25d897dc
+/// @dev the ERC-165 identifier for this interface is 0x5d354410
interface Collection is Dummy, ERC165 {
/// Set collection property.
///
@@ -23,6 +23,13 @@
/// or in textual repr: setCollectionProperty(string,bytes)
function setCollectionProperty(string memory key, bytes memory value) external;
+ /// Set collection properties.
+ ///
+ /// @param properties Vector of properties key/value pair.
+ /// @dev EVM selector for this function is: 0x50b26b2a,
+ /// or in textual repr: setCollectionProperties((string,bytes)[])
+ function setCollectionProperties(Tuple10[] memory properties) external;
+
/// Delete collection property.
///
/// @param key Property key.
@@ -40,6 +47,14 @@
/// or in textual repr: collectionProperty(string)
function collectionProperty(string memory key) external view returns (bytes memory);
+ /// Get collection properties.
+ ///
+ /// @param keys Properties keys.
+ /// @return Vector of properties key/value pairs.
+ /// @dev EVM selector for this function is: 0x285fb8e6,
+ /// or in textual repr: collectionProperties(string[])
+ function collectionProperties(string[] memory keys) external view returns (Tuple10[] memory);
+
/// Set the sponsor of the collection.
///
/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
@@ -258,6 +273,12 @@
function setOwnerCross(Tuple6 memory newOwner) external;
}
+/// @dev anonymous struct
+struct Tuple10 {
+ string field_0;
+ bytes field_1;
+}
+
/// @dev the ERC-165 identifier for this interface is 0x032e5926
interface ERC20UniqueExtensions is Dummy, ERC165 {
/// @dev EVM selector for this function is: 0x0ecd0ab0,
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 0x25d897dc
+/// @dev the ERC-165 identifier for this interface is 0x5d354410
interface Collection is Dummy, ERC165 {
/// Set collection property.
///
@@ -72,6 +72,13 @@
/// or in textual repr: setCollectionProperty(string,bytes)
function setCollectionProperty(string memory key, bytes memory value) external;
+ /// Set collection properties.
+ ///
+ /// @param properties Vector of properties key/value pair.
+ /// @dev EVM selector for this function is: 0x50b26b2a,
+ /// or in textual repr: setCollectionProperties((string,bytes)[])
+ function setCollectionProperties(Tuple19[] memory properties) external;
+
/// Delete collection property.
///
/// @param key Property key.
@@ -89,6 +96,14 @@
/// or in textual repr: collectionProperty(string)
function collectionProperty(string memory key) external view returns (bytes memory);
+ /// Get collection properties.
+ ///
+ /// @param keys Properties keys.
+ /// @return Vector of properties key/value pairs.
+ /// @dev EVM selector for this function is: 0x285fb8e6,
+ /// or in textual repr: collectionProperties(string[])
+ function collectionProperties(string[] memory keys) external view returns (Tuple19[] memory);
+
/// Set the sponsor of the collection.
///
/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
@@ -307,6 +322,12 @@
function setOwnerCross(Tuple6 memory newOwner) external;
}
+/// @dev anonymous struct
+struct Tuple19 {
+ string field_0;
+ bytes field_1;
+}
+
/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
/// @dev See https://eips.ethereum.org/EIPS/eip-721
/// @dev the ERC-165 identifier for this interface is 0x5b5e139f
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 0x25d897dc
+/// @dev the ERC-165 identifier for this interface is 0x5d354410
interface Collection is Dummy, ERC165 {
/// Set collection property.
///
@@ -72,6 +72,13 @@
/// or in textual repr: setCollectionProperty(string,bytes)
function setCollectionProperty(string memory key, bytes memory value) external;
+ /// Set collection properties.
+ ///
+ /// @param properties Vector of properties key/value pair.
+ /// @dev EVM selector for this function is: 0x50b26b2a,
+ /// or in textual repr: setCollectionProperties((string,bytes)[])
+ function setCollectionProperties(Tuple19[] memory properties) external;
+
/// Delete collection property.
///
/// @param key Property key.
@@ -89,6 +96,14 @@
/// or in textual repr: collectionProperty(string)
function collectionProperty(string memory key) external view returns (bytes memory);
+ /// Get collection properties.
+ ///
+ /// @param keys Properties keys.
+ /// @return Vector of properties key/value pairs.
+ /// @dev EVM selector for this function is: 0x285fb8e6,
+ /// or in textual repr: collectionProperties(string[])
+ function collectionProperties(string[] memory keys) external view returns (Tuple19[] memory);
+
/// Set the sponsor of the collection.
///
/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
@@ -307,6 +322,12 @@
function setOwnerCross(Tuple6 memory newOwner) external;
}
+/// @dev anonymous struct
+struct Tuple19 {
+ string field_0;
+ bytes field_1;
+}
+
/// @dev the ERC-165 identifier for this interface is 0x5b5e139f
interface ERC721Metadata is Dummy, ERC165 {
// /// @notice A descriptive name for a collection of NFTs in this contract
tests/src/eth/collectionProperties.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionProperties.test.ts
+++ b/tests/src/eth/collectionProperties.test.ts
@@ -161,3 +161,31 @@
await checkERC721Metadata(helper, 'rft');
});
});
+
+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'});
+
+ 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 key1 = 'key1';
+ const value1 = Buffer.from('value1');
+
+ const key2 = 'key2';
+ const value2 = Buffer.from('value2');
+
+ const writeProperties = [
+ [key1, '0x'+value1.toString('hex')],
+ [key2, '0x'+value2.toString('hex')],
+ ];
+
+ await contract.methods.setCollectionProperties(writeProperties).send();
+ const readProperties = await contract.methods.collectionProperties([key1, key2]).call();
+ expect(readProperties).to.be.like(writeProperties);
+ });
+});
tests/src/eth/fungibleAbi.jsondiffbeforeafterboth--- a/tests/src/eth/fungibleAbi.json
+++ b/tests/src/eth/fungibleAbi.json
@@ -229,6 +229,25 @@
"type": "function"
},
{
+ "inputs": [
+ { "internalType": "string[]", "name": "keys", "type": "string[]" }
+ ],
+ "name": "collectionProperties",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "string", "name": "field_0", "type": "string" },
+ { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+ ],
+ "internalType": "struct Tuple10[]",
+ "name": "",
+ "type": "tuple[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
"inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
"name": "collectionProperty",
"outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
@@ -463,6 +482,23 @@
},
{
"inputs": [
+ {
+ "components": [
+ { "internalType": "string", "name": "field_0", "type": "string" },
+ { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+ ],
+ "internalType": "struct Tuple10[]",
+ "name": "properties",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "setCollectionProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
{ "internalType": "string", "name": "key", "type": "string" },
{ "internalType": "bytes", "name": "value", "type": "bytes" }
],
tests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -259,6 +259,25 @@
"type": "function"
},
{
+ "inputs": [
+ { "internalType": "string[]", "name": "keys", "type": "string[]" }
+ ],
+ "name": "collectionProperties",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "string", "name": "field_0", "type": "string" },
+ { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+ ],
+ "internalType": "struct Tuple19[]",
+ "name": "",
+ "type": "tuple[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
"inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
"name": "collectionProperty",
"outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
@@ -578,6 +597,23 @@
},
{
"inputs": [
+ {
+ "components": [
+ { "internalType": "string", "name": "field_0", "type": "string" },
+ { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+ ],
+ "internalType": "struct Tuple19[]",
+ "name": "properties",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "setCollectionProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
{ "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
@@ -241,6 +241,25 @@
"type": "function"
},
{
+ "inputs": [
+ { "internalType": "string[]", "name": "keys", "type": "string[]" }
+ ],
+ "name": "collectionProperties",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "string", "name": "field_0", "type": "string" },
+ { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+ ],
+ "internalType": "struct Tuple19[]",
+ "name": "",
+ "type": "tuple[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
"inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
"name": "collectionProperty",
"outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
@@ -560,6 +579,23 @@
},
{
"inputs": [
+ {
+ "components": [
+ { "internalType": "string", "name": "field_0", "type": "string" },
+ { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+ ],
+ "internalType": "struct Tuple19[]",
+ "name": "properties",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "setCollectionProperties",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
{ "internalType": "string", "name": "key", "type": "string" },
{ "internalType": "bytes", "name": "value", "type": "bytes" }
],