git.delta.rocks / unique-network / refs/commits / 1a4aa2d6346d

difftreelog

source

pallets/unique/src/eth/stubs/CollectionHelpers.sol9.7 KiBsourcehistory
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/// @dev inlined interface21contract CollectionHelpersEvents {22	event CollectionCreated(address indexed owner, address indexed collectionId);23	event CollectionDestroyed(address indexed collectionId);24	event CollectionChanged(address indexed collectionId);25}2627/// @title Contract, which allows users to operate with collections28/// @dev the ERC-165 identifier for this interface is 0x4135fff129contract CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {30	/// Create a collection31	/// @return address Address of the newly created collection32	/// @dev EVM selector for this function is: 0xa765ee5b,33	///  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))34	function createCollection(CreateCollectionData memory data) public payable returns (address) {35		require(false, stub_error);36		data;37		dummy = 0;38		return 0x0000000000000000000000000000000000000000;39	}4041	/// Create an NFT collection42	/// @param name Name of the collection43	/// @param description Informative description of the collection44	/// @param tokenPrefix Token prefix to represent the collection tokens in UI and user applications45	/// @return address Address of the newly created collection46	/// @dev EVM selector for this function is: 0x844af658,47	///  or in textual repr: createNFTCollection(string,string,string)48	function createNFTCollection(49		string memory name,50		string memory description,51		string memory tokenPrefix52	) public payable returns (address) {53		require(false, stub_error);54		name;55		description;56		tokenPrefix;57		dummy = 0;58		return 0x0000000000000000000000000000000000000000;59	}6061	// /// Create an NFT collection62	// /// @param name Name of the collection63	// /// @param description Informative description of the collection64	// /// @param tokenPrefix Token prefix to represent the collection tokens in UI and user applications65	// /// @return address Address of the newly created collection66	// /// @dev EVM selector for this function is: 0xe34a6844,67	// ///  or in textual repr: createNonfungibleCollection(string,string,string)68	// function createNonfungibleCollection(string memory name, string memory description, string memory tokenPrefix) public payable returns (address) {69	// 	require(false, stub_error);70	// 	name;71	// 	description;72	// 	tokenPrefix;73	// 	dummy = 0;74	// 	return 0x0000000000000000000000000000000000000000;75	// }7677	/// @dev EVM selector for this function is: 0xab173450,78	///  or in textual repr: createRFTCollection(string,string,string)79	function createRFTCollection(80		string memory name,81		string memory description,82		string memory tokenPrefix83	) public payable returns (address) {84		require(false, stub_error);85		name;86		description;87		tokenPrefix;88		dummy = 0;89		return 0x0000000000000000000000000000000000000000;90	}9192	/// @dev EVM selector for this function is: 0x7335b79f,93	///  or in textual repr: createFTCollection(string,uint8,string,string)94	function createFTCollection(95		string memory name,96		uint8 decimals,97		string memory description,98		string memory tokenPrefix99	) public payable returns (address) {100		require(false, stub_error);101		name;102		decimals;103		description;104		tokenPrefix;105		dummy = 0;106		return 0x0000000000000000000000000000000000000000;107	}108109	/// @dev EVM selector for this function is: 0x85624258,110	///  or in textual repr: makeCollectionERC721MetadataCompatible(address,string)111	function makeCollectionERC721MetadataCompatible(address collection, string memory baseUri) public {112		require(false, stub_error);113		collection;114		baseUri;115		dummy = 0;116	}117118	/// @dev EVM selector for this function is: 0x564e321f,119	///  or in textual repr: destroyCollection(address)120	function destroyCollection(address collectionAddress) public {121		require(false, stub_error);122		collectionAddress;123		dummy = 0;124	}125126	/// Check if a collection exists127	/// @param collectionAddress Address of the collection in question128	/// @return bool Does the collection exist?129	/// @dev EVM selector for this function is: 0xc3de1494,130	///  or in textual repr: isCollectionExist(address)131	function isCollectionExist(address collectionAddress) public view returns (bool) {132		require(false, stub_error);133		collectionAddress;134		dummy;135		return false;136	}137138	/// @dev EVM selector for this function is: 0xd23a7ab1,139	///  or in textual repr: collectionCreationFee()140	function collectionCreationFee() public view returns (uint256) {141		require(false, stub_error);142		dummy;143		return 0;144	}145146	/// Returns address of a collection.147	/// @param collectionId  - CollectionId  of the collection148	/// @return eth mirror address of the collection149	/// @dev EVM selector for this function is: 0x2e716683,150	///  or in textual repr: collectionAddress(uint32)151	function collectionAddress(uint32 collectionId) public view returns (address) {152		require(false, stub_error);153		collectionId;154		dummy;155		return 0x0000000000000000000000000000000000000000;156	}157158	/// Returns collectionId of a collection.159	/// @param collectionAddress  - Eth address of the collection160	/// @return collectionId of the collection161	/// @dev EVM selector for this function is: 0xb5cb7498,162	///  or in textual repr: collectionId(address)163	function collectionId(address collectionAddress) public view returns (uint32) {164		require(false, stub_error);165		collectionAddress;166		dummy;167		return 0;168	}169}170171/// Collection properties172struct CreateCollectionData {173	/// Collection sponsor174	CrossAddress pending_sponsor;175	/// Collection name176	string name;177	/// Collection description178	string description;179	/// Token prefix180	string token_prefix;181	/// Token type (NFT, FT or RFT)182	CollectionMode mode;183	/// Fungible token precision184	uint8 decimals;185	/// Custom Properties186	Property[] properties;187	/// Permissions for token properties188	TokenPropertyPermission[] token_property_permissions;189	/// Collection admins190	CrossAddress[] admin_list;191	/// Nesting settings192	CollectionNestingAndPermission nesting_settings;193	/// Collection limits194	CollectionLimitValue[] limits;195	/// Extra collection flags196	CollectionFlags flags;197}198199/// Cross account struct200type CollectionFlags is uint8;201202library CollectionFlagsLib {203	/// Tokens in foreign collections can be transferred, but not burnt204	CollectionFlags constant foreignField = CollectionFlags.wrap(128);205	/// Supports ERC721Metadata206	CollectionFlags constant erc721metadataField = CollectionFlags.wrap(64);207	/// External collections can't be managed using `unique` api208	CollectionFlags constant externalField = CollectionFlags.wrap(1);209210	/// Reserved bits211	function reservedField(uint8 value) public pure returns (CollectionFlags) {212		require(value < 1 << 5, "out of bound value");213		return CollectionFlags.wrap(value << 1);214	}215}216217/// [`CollectionLimits`](up_data_structs::CollectionLimits) field representation for EVM.218struct CollectionLimitValue {219	CollectionLimitField field;220	uint256 value;221}222223/// [`CollectionLimits`](up_data_structs::CollectionLimits) fields representation for EVM.224enum CollectionLimitField {225	/// How many tokens can a user have on one account.226	AccountTokenOwnership,227	/// How many bytes of data are available for sponsorship.228	SponsoredDataSize,229	/// In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]230	SponsoredDataRateLimit,231	/// How many tokens can be mined into this collection.232	TokenLimit,233	/// Timeouts for transfer sponsoring.234	SponsorTransferTimeout,235	/// Timeout for sponsoring an approval in passed blocks.236	SponsorApproveTimeout,237	/// Whether the collection owner of the collection can send tokens (which belong to other users).238	OwnerCanTransfer,239	/// Can the collection owner burn other people's tokens.240	OwnerCanDestroy,241	/// Is it possible to send tokens from this collection between users.242	TransferEnabled243}244245/// Nested collections and permissions246struct CollectionNestingAndPermission {247	/// Owner of token can nest tokens under it.248	bool token_owner;249	/// Admin of token collection can nest tokens under token.250	bool collection_admin;251	/// If set - only tokens from specified collections can be nested.252	address[] restricted;253}254255/// Cross account struct256struct CrossAddress {257	address eth;258	uint256 sub;259}260261/// Ethereum representation of Token Property Permissions.262struct TokenPropertyPermission {263	/// Token property key.264	string key;265	/// Token property permissions.266	PropertyPermission[] permissions;267}268269/// Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) as an key and value.270struct PropertyPermission {271	/// TokenPermission field.272	TokenPermissionField code;273	/// TokenPermission value.274	bool value;275}276277/// Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.278enum TokenPermissionField {279	/// Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]280	Mutable,281	/// Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]282	TokenOwner,283	/// Permission to change the property for the owner of the token. See [`up_data_structs::PropertyPermission::collection_admin`]284	CollectionAdmin285}286287/// Ethereum representation of collection [`PropertyKey`](up_data_structs::PropertyKey) and [`PropertyValue`](up_data_structs::PropertyValue).288struct Property {289	string key;290	bytes value;291}292293/// Type of tokens in collection294enum CollectionMode {295	/// Fungible296	Fungible,297	/// Nonfungible298	Nonfungible,299	/// Refungible300	Refungible301}