git.delta.rocks / unique-network / refs/commits / 6486f2a91bb1

difftreelog

source

tests/src/eth/api/CollectionHelpers.sol8.5 KiBsourcehistory
1// 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 0x4135fff124interface CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {25	/// Create a collection26	/// @return address Address of the newly created collection27	/// @dev EVM selector for this function is: 0xa765ee5b,28	///  or in textual repr: createCollection(((address,uint256),string,string,string,uint8,uint8,(string,bytes)[],(string,(uint8,bool)[])[],(address,uint256)[],(bool,bool,address[]),(uint8,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 sponsor107	CrossAddress pending_sponsor;108	/// Collection name109	string name;110	/// Collection description111	string description;112	/// Token prefix113	string token_prefix;114	/// Token type (NFT, FT or RFT)115	CollectionMode mode;116	/// Fungible token precision117	uint8 decimals;118	/// Custom Properties119	Property[] properties;120	/// Permissions for token properties121	TokenPropertyPermission[] token_property_permissions;122	/// Collection admins123	CrossAddress[] admin_list;124	/// Nesting settings125	CollectionNestingAndPermission nesting_settings;126	/// Collection limits127	CollectionLimitValue[] limits;128	/// Extra collection flags129	CollectionFlags flags;130}131132/// Cross account struct133type CollectionFlags is uint8;134135library CollectionFlagsLib {136	/// Tokens in foreign collections can be transferred, but not burnt137	CollectionFlags constant foreignField = CollectionFlags.wrap(128);138	/// Supports ERC721Metadata139	CollectionFlags constant erc721metadataField = CollectionFlags.wrap(64);140	/// External collections can't be managed using `unique` api141	CollectionFlags constant externalField = CollectionFlags.wrap(1);142143	/// Reserved bits144	function reservedField(uint8 value) public pure returns (CollectionFlags) {145		require(value < 1 << 5, "out of bound value");146		return CollectionFlags.wrap(value << 1);147	}148}149150/// [`CollectionLimits`](up_data_structs::CollectionLimits) field representation for EVM.151struct CollectionLimitValue {152	CollectionLimitField field;153	uint256 value;154}155156/// [`CollectionLimits`](up_data_structs::CollectionLimits) fields representation for EVM.157enum CollectionLimitField {158	/// How many tokens can a user have on one account.159	AccountTokenOwnership,160	/// How many bytes of data are available for sponsorship.161	SponsoredDataSize,162	/// In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]163	SponsoredDataRateLimit,164	/// How many tokens can be mined into this collection.165	TokenLimit,166	/// Timeouts for transfer sponsoring.167	SponsorTransferTimeout,168	/// Timeout for sponsoring an approval in passed blocks.169	SponsorApproveTimeout,170	/// Whether the collection owner of the collection can send tokens (which belong to other users).171	OwnerCanTransfer,172	/// Can the collection owner burn other people's tokens.173	OwnerCanDestroy,174	/// Is it possible to send tokens from this collection between users.175	TransferEnabled176}177178/// Nested collections and permissions179struct CollectionNestingAndPermission {180	/// Owner of token can nest tokens under it.181	bool token_owner;182	/// Admin of token collection can nest tokens under token.183	bool collection_admin;184	/// If set - only tokens from specified collections can be nested.185	address[] restricted;186}187188/// Cross account struct189struct CrossAddress {190	address eth;191	uint256 sub;192}193194/// Ethereum representation of Token Property Permissions.195struct TokenPropertyPermission {196	/// Token property key.197	string key;198	/// Token property permissions.199	PropertyPermission[] permissions;200}201202/// Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) as an key and value.203struct PropertyPermission {204	/// TokenPermission field.205	TokenPermissionField code;206	/// TokenPermission value.207	bool value;208}209210/// Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.211enum TokenPermissionField {212	/// Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]213	Mutable,214	/// Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]215	TokenOwner,216	/// Permission to change the property for the owner of the token. See [`up_data_structs::PropertyPermission::collection_admin`]217	CollectionAdmin218}219220/// Ethereum representation of collection [`PropertyKey`](up_data_structs::PropertyKey) and [`PropertyValue`](up_data_structs::PropertyValue).221struct Property {222	string key;223	bytes value;224}225226/// Type of tokens in collection227enum CollectionMode {228	/// Fungible229	Fungible,230	/// Nonfungible231	Nonfungible,232	/// Refungible233	Refungible234}