difftreelog
fix reserved field 0 in collection helpers
in: master
2 files changed
js-packages/tests/eth/api/CollectionHelpers.soldiffbeforeafterboth1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56/// @dev common stubs holder7interface Dummy {89}1011interface ERC165 is Dummy {12 function supportsInterface(bytes4 interfaceID) external view returns (bool);13}1415/// @dev inlined interface16interface CollectionHelpersEvents {17 event CollectionCreated(address indexed owner, address indexed collectionId);18 event CollectionDestroyed(address indexed collectionId);19 event CollectionChanged(address indexed collectionId);20}2122/// @title Contract, which allows users to operate with collections23/// @dev the ERC-165 identifier for this interface is 0x94e5af0d24interface CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {25 /// Create a collection26 /// @return address Address of the newly created collection27 /// @dev EVM selector for this function is: 0x72b5bea7,28 /// or in textual repr: createCollection((string,string,string,uint8,uint8,(string,bytes)[],(string,(uint8,bool)[])[],(address,uint256)[],(bool,bool,address[]),(uint8,uint256)[],(address,uint256),uint8))29 function createCollection(CreateCollectionData memory data) external payable returns (address);3031 /// Create an NFT collection32 /// @param name Name of the collection33 /// @param description Informative description of the collection34 /// @param tokenPrefix Token prefix to represent the collection tokens in UI and user applications35 /// @return address Address of the newly created collection36 /// @dev EVM selector for this function is: 0x844af658,37 /// or in textual repr: createNFTCollection(string,string,string)38 function createNFTCollection(39 string memory name,40 string memory description,41 string memory tokenPrefix42 ) external payable returns (address);4344 // /// Create an NFT collection45 // /// @param name Name of the collection46 // /// @param description Informative description of the collection47 // /// @param tokenPrefix Token prefix to represent the collection tokens in UI and user applications48 // /// @return address Address of the newly created collection49 // /// @dev EVM selector for this function is: 0xe34a6844,50 // /// or in textual repr: createNonfungibleCollection(string,string,string)51 // function createNonfungibleCollection(string memory name, string memory description, string memory tokenPrefix) external payable returns (address);5253 /// @dev EVM selector for this function is: 0xab173450,54 /// or in textual repr: createRFTCollection(string,string,string)55 function createRFTCollection(56 string memory name,57 string memory description,58 string memory tokenPrefix59 ) external payable returns (address);6061 /// @dev EVM selector for this function is: 0x7335b79f,62 /// or in textual repr: createFTCollection(string,uint8,string,string)63 function createFTCollection(64 string memory name,65 uint8 decimals,66 string memory description,67 string memory tokenPrefix68 ) external payable returns (address);6970 /// @dev EVM selector for this function is: 0x85624258,71 /// or in textual repr: makeCollectionERC721MetadataCompatible(address,string)72 function makeCollectionERC721MetadataCompatible(address collection, string memory baseUri) external;7374 /// @dev EVM selector for this function is: 0x564e321f,75 /// or in textual repr: destroyCollection(address)76 function destroyCollection(address collectionAddress) external;7778 /// Check if a collection exists79 /// @param collectionAddress Address of the collection in question80 /// @return bool Does the collection exist?81 /// @dev EVM selector for this function is: 0xc3de1494,82 /// or in textual repr: isCollectionExist(address)83 function isCollectionExist(address collectionAddress) external view returns (bool);8485 /// @dev EVM selector for this function is: 0xd23a7ab1,86 /// or in textual repr: collectionCreationFee()87 function collectionCreationFee() external view returns (uint256);8889 /// Returns address of a collection.90 /// @param collectionId - CollectionId of the collection91 /// @return eth mirror address of the collection92 /// @dev EVM selector for this function is: 0x2e716683,93 /// or in textual repr: collectionAddress(uint32)94 function collectionAddress(uint32 collectionId) external view returns (address);9596 /// Returns collectionId of a collection.97 /// @param collectionAddress - Eth address of the collection98 /// @return collectionId of the collection99 /// @dev EVM selector for this function is: 0xb5cb7498,100 /// or in textual repr: collectionId(address)101 function collectionId(address collectionAddress) external view returns (uint32);102}103104/// Collection properties105struct CreateCollectionData {106 /// Collection name107 string name;108 /// Collection description109 string description;110 /// Token prefix111 string token_prefix;112 /// Token type (NFT, FT or RFT)113 CollectionMode mode;114 /// Fungible token precision115 uint8 decimals;116 /// Custom Properties117 Property[] properties;118 /// Permissions for token properties119 TokenPropertyPermission[] token_property_permissions;120 /// Collection admins121 CrossAddress[] admin_list;122 /// Nesting settings123 CollectionNestingAndPermission nesting_settings;124 /// Collection limits125 CollectionLimitValue[] limits;126 /// Collection sponsor127 CrossAddress pending_sponsor;128 /// Extra collection flags129 CollectionFlags flags;130}131132type CollectionFlags is uint8;133134library CollectionFlagsLib {135 CollectionFlags constant reservedField0 = CollectionFlags.wrap(128);136 /// Supports ERC721Metadata137 CollectionFlags constant erc721metadataField = CollectionFlags.wrap(64);138 /// External collections can't be managed using `unique` api139 CollectionFlags constant externalField = CollectionFlags.wrap(1);140141 /// Reserved flags142 function reservedField(uint8 value) public pure returns (CollectionFlags) {143 require(value < 1 << 5, "out of bound value");144 return CollectionFlags.wrap(value << 1);145 }146}147148/// Cross account struct149struct CrossAddress {150 address eth;151 uint256 sub;152}153154/// [`CollectionLimits`](up_data_structs::CollectionLimits) field representation for EVM.155struct CollectionLimitValue {156 CollectionLimitField field;157 uint256 value;158}159160/// [`CollectionLimits`](up_data_structs::CollectionLimits) fields representation for EVM.161enum CollectionLimitField {162 /// How many tokens can a user have on one account.163 AccountTokenOwnership,164 /// How many bytes of data are available for sponsorship.165 SponsoredDataSize,166 /// In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]167 SponsoredDataRateLimit,168 /// How many tokens can be mined into this collection.169 TokenLimit,170 /// Timeouts for transfer sponsoring.171 SponsorTransferTimeout,172 /// Timeout for sponsoring an approval in passed blocks.173 SponsorApproveTimeout,174 /// Whether the collection owner of the collection can send tokens (which belong to other users).175 OwnerCanTransfer,176 /// Can the collection owner burn other people's tokens.177 OwnerCanDestroy,178 /// Is it possible to send tokens from this collection between users.179 TransferEnabled180}181182/// Nested collections and permissions183struct CollectionNestingAndPermission {184 /// Owner of token can nest tokens under it.185 bool token_owner;186 /// Admin of token collection can nest tokens under token.187 bool collection_admin;188 /// If set - only tokens from specified collections can be nested.189 address[] restricted;190}191192/// Ethereum representation of Token Property Permissions.193struct TokenPropertyPermission {194 /// Token property key.195 string key;196 /// Token property permissions.197 PropertyPermission[] permissions;198}199200/// Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) as an key and value.201struct PropertyPermission {202 /// TokenPermission field.203 TokenPermissionField code;204 /// TokenPermission value.205 bool value;206}207208/// Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.209enum TokenPermissionField {210 /// Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]211 Mutable,212 /// Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]213 TokenOwner,214 /// Permission to change the property for the owner of the token. See [`up_data_structs::PropertyPermission::collection_admin`]215 CollectionAdmin216}217218/// Ethereum representation of collection [`PropertyKey`](up_data_structs::PropertyKey) and [`PropertyValue`](up_data_structs::PropertyValue).219struct Property {220 string key;221 bytes value;222}223224/// Type of tokens in collection225enum CollectionMode {226 /// Nonfungible227 Nonfungible,228 /// Fungible229 Fungible,230 /// Refungible231 Refungible232}pallets/unique/src/eth/stubs/CollectionHelpers.soldiffbeforeafterboth--- a/pallets/unique/src/eth/stubs/CollectionHelpers.sol
+++ b/pallets/unique/src/eth/stubs/CollectionHelpers.sol
@@ -199,8 +199,7 @@
type CollectionFlags is uint8;
library CollectionFlagsLib {
- /// Tokens in foreign collections can be transferred, but not burnt
- CollectionFlags constant foreignField = CollectionFlags.wrap(128);
+ CollectionFlags constant reservedField0 = CollectionFlags.wrap(128);
/// Supports ERC721Metadata
CollectionFlags constant erc721metadataField = CollectionFlags.wrap(64);
/// External collections can't be managed using `unique` api