git.delta.rocks / unique-network / refs/commits / 27ba026da63d

difftreelog

source

js-packages/tests/eth/api/UniqueFungible.sol20.6 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/// @title A contract that allows you to work with collections.16/// @dev the ERC-165 identifier for this interface is 0xb34d97e917interface Collection is Dummy, ERC165 {18	// /// Set collection property.19	// ///20	// /// @param key Property key.21	// /// @param value Propery value.22	// /// @dev EVM selector for this function is: 0x2f073f66,23	// ///  or in textual repr: setCollectionProperty(string,bytes)24	// function setCollectionProperty(string memory key, bytes memory value) external;2526	/// Set collection properties.27	///28	/// @param properties Vector of properties key/value pair.29	/// @dev EVM selector for this function is: 0x50b26b2a,30	///  or in textual repr: setCollectionProperties((string,bytes)[])31	function setCollectionProperties(Property[] memory properties) external;3233	// /// Delete collection property.34	// ///35	// /// @param key Property key.36	// /// @dev EVM selector for this function is: 0x7b7debce,37	// ///  or in textual repr: deleteCollectionProperty(string)38	// function deleteCollectionProperty(string memory key) external;3940	/// Delete collection properties.41	///42	/// @param keys Properties keys.43	/// @dev EVM selector for this function is: 0xee206ee3,44	///  or in textual repr: deleteCollectionProperties(string[])45	function deleteCollectionProperties(string[] memory keys) external;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) external view returns (bytes memory);5657	/// Get collection properties.58	///59	/// @param keys Properties keys. Empty keys for all propertyes.60	/// @return Vector of properties key/value pairs.61	/// @dev EVM selector for this function is: 0x285fb8e6,62	///  or in textual repr: collectionProperties(string[])63	function collectionProperties(string[] memory keys) external view returns (Property[] memory);6465	// /// Set the sponsor of the collection.66	// ///67	// /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.68	// ///69	// /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.70	// /// @dev EVM selector for this function is: 0x7623402e,71	// ///  or in textual repr: setCollectionSponsor(address)72	// function setCollectionSponsor(address sponsor) external;7374	/// Set the sponsor of the collection.75	///76	/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.77	///78	/// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.79	/// @dev EVM selector for this function is: 0x84a1d5a8,80	///  or in textual repr: setCollectionSponsorCross((address,uint256))81	function setCollectionSponsorCross(CrossAddress memory sponsor) external;8283	/// Whether there is a pending sponsor.84	/// @dev EVM selector for this function is: 0x058ac185,85	///  or in textual repr: hasCollectionPendingSponsor()86	function hasCollectionPendingSponsor() external view returns (bool);8788	/// Collection sponsorship confirmation.89	///90	/// @dev After setting the sponsor for the collection, it must be confirmed with this function.91	/// @dev EVM selector for this function is: 0x3c50e97a,92	///  or in textual repr: confirmCollectionSponsorship()93	function confirmCollectionSponsorship() external;9495	/// Remove collection sponsor.96	/// @dev EVM selector for this function is: 0x6e0326a3,97	///  or in textual repr: removeCollectionSponsor()98	function removeCollectionSponsor() external;99100	/// Get current sponsor.101	///102	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.103	/// @dev EVM selector for this function is: 0x6ec0a9f1,104	///  or in textual repr: collectionSponsor()105	function collectionSponsor() external view returns (CrossAddress memory);106107	/// Get current collection limits.108	///109	/// @return Array of collection limits110	/// @dev EVM selector for this function is: 0xf63bc572,111	///  or in textual repr: collectionLimits()112	function collectionLimits() external view returns (CollectionLimit[] memory);113114	/// Set limits for the collection.115	/// @dev Throws error if limit not found.116	/// @param limit Some limit.117	/// @dev EVM selector for this function is: 0x2316ee74,118	///  or in textual repr: setCollectionLimit((uint8,(bool,uint256)))119	function setCollectionLimit(CollectionLimit memory limit) external;120121	/// Get contract address.122	/// @dev EVM selector for this function is: 0xf6b4dfb4,123	///  or in textual repr: contractAddress()124	function contractAddress() external view returns (address);125126	/// Add collection admin.127	/// @param newAdmin Cross account administrator address.128	/// @dev EVM selector for this function is: 0x859aa7d6,129	///  or in textual repr: addCollectionAdminCross((address,uint256))130	function addCollectionAdminCross(CrossAddress memory newAdmin) external;131132	/// Remove collection admin.133	/// @param admin Cross account administrator address.134	/// @dev EVM selector for this function is: 0x6c0cd173,135	///  or in textual repr: removeCollectionAdminCross((address,uint256))136	function removeCollectionAdminCross(CrossAddress memory admin) external;137138	// /// Add collection admin.139	// /// @param newAdmin Address of the added administrator.140	// /// @dev EVM selector for this function is: 0x92e462c7,141	// ///  or in textual repr: addCollectionAdmin(address)142	// function addCollectionAdmin(address newAdmin) external;143144	// /// Remove collection admin.145	// ///146	// /// @param admin Address of the removed administrator.147	// /// @dev EVM selector for this function is: 0xfafd7b42,148	// ///  or in textual repr: removeCollectionAdmin(address)149	// function removeCollectionAdmin(address admin) external;150151	/// @dev EVM selector for this function is: 0x0b9f3890,152	///  or in textual repr: setCollectionNesting((bool,bool,address[]))153	function setCollectionNesting(CollectionNestingAndPermission memory collectionNestingAndPermissions) external;154155	// /// Toggle accessibility of collection nesting.156	// ///157	// /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'158	// /// @dev EVM selector for this function is: 0x112d4586,159	// ///  or in textual repr: setCollectionNesting(bool)160	// function setCollectionNesting(bool enable) external;161162	// /// Toggle accessibility of collection nesting.163	// ///164	// /// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'165	// /// @param collections Addresses of collections that will be available for nesting.166	// /// @dev EVM selector for this function is: 0x64872396,167	// ///  or in textual repr: setCollectionNesting(bool,address[])168	// function setCollectionNesting(bool enable, address[] memory collections) external;169170	/// @dev EVM selector for this function is: 0x92c660a8,171	///  or in textual repr: collectionNesting()172	function collectionNesting() external view returns (CollectionNestingAndPermission memory);173174	// /// Returns nesting for a collection175	// /// @dev EVM selector for this function is: 0x22d25bfe,176	// ///  or in textual repr: collectionNestingRestrictedCollectionIds()177	// function collectionNestingRestrictedCollectionIds() external view returns (CollectionNesting memory);178179	// /// Returns permissions for a collection180	// /// @dev EVM selector for this function is: 0x5b2eaf4b,181	// ///  or in textual repr: collectionNestingPermissions()182	// function collectionNestingPermissions() external view returns (CollectionNestingPermission[] memory);183184	/// Set the collection access method.185	/// @param mode Access mode186	/// @dev EVM selector for this function is: 0x41835d4c,187	///  or in textual repr: setCollectionAccess(uint8)188	function setCollectionAccess(AccessMode mode) external;189190	/// Checks that user allowed to operate with collection.191	///192	/// @param user User address to check.193	/// @dev EVM selector for this function is: 0x91b6df49,194	///  or in textual repr: allowlistedCross((address,uint256))195	function allowlistedCross(CrossAddress memory user) external view returns (bool);196197	// /// Add the user to the allowed list.198	// ///199	// /// @param user Address of a trusted user.200	// /// @dev EVM selector for this function is: 0x67844fe6,201	// ///  or in textual repr: addToCollectionAllowList(address)202	// function addToCollectionAllowList(address user) external;203204	/// Add user to allowed list.205	///206	/// @param user User cross account address.207	/// @dev EVM selector for this function is: 0xa0184a3a,208	///  or in textual repr: addToCollectionAllowListCross((address,uint256))209	function addToCollectionAllowListCross(CrossAddress memory user) external;210211	// /// Remove the user from the allowed list.212	// ///213	// /// @param user Address of a removed user.214	// /// @dev EVM selector for this function is: 0x85c51acb,215	// ///  or in textual repr: removeFromCollectionAllowList(address)216	// function removeFromCollectionAllowList(address user) external;217218	/// Remove user from allowed list.219	///220	/// @param user User cross account address.221	/// @dev EVM selector for this function is: 0x09ba452a,222	///  or in textual repr: removeFromCollectionAllowListCross((address,uint256))223	function removeFromCollectionAllowListCross(CrossAddress memory user) external;224225	/// Switch permission for minting.226	///227	/// @param mode Enable if "true".228	/// @dev EVM selector for this function is: 0x00018e84,229	///  or in textual repr: setCollectionMintMode(bool)230	function setCollectionMintMode(bool mode) external;231232	// /// Check that account is the owner or admin of the collection233	// ///234	// /// @param user account to verify235	// /// @return "true" if account is the owner or admin236	// /// @dev EVM selector for this function is: 0x9811b0c7,237	// ///  or in textual repr: isOwnerOrAdmin(address)238	// function isOwnerOrAdmin(address user) external view returns (bool);239240	/// Check that account is the owner or admin of the collection241	///242	/// @param user User cross account to verify243	/// @return "true" if account is the owner or admin244	/// @dev EVM selector for this function is: 0x3e75a905,245	///  or in textual repr: isOwnerOrAdminCross((address,uint256))246	function isOwnerOrAdminCross(CrossAddress memory user) external view returns (bool);247248	/// Returns collection type249	///250	/// @return `Fungible` or `NFT` or `ReFungible`251	/// @dev EVM selector for this function is: 0xd34b55b8,252	///  or in textual repr: uniqueCollectionType()253	function uniqueCollectionType() external view returns (string memory);254255	/// Get collection owner.256	///257	/// @return Tuble with sponsor address and his substrate mirror.258	/// If address is canonical then substrate mirror is zero and vice versa.259	/// @dev EVM selector for this function is: 0xdf727d3b,260	///  or in textual repr: collectionOwner()261	function collectionOwner() external view returns (CrossAddress memory);262263	// /// Changes collection owner to another account264	// ///265	// /// @dev Owner can be changed only by current owner266	// /// @param newOwner new owner account267	// /// @dev EVM selector for this function is: 0x4f53e226,268	// ///  or in textual repr: changeCollectionOwner(address)269	// function changeCollectionOwner(address newOwner) external;270271	/// Get collection administrators272	///273	/// @return Vector of tuples with admins address and his substrate mirror.274	/// If address is canonical then substrate mirror is zero and vice versa.275	/// @dev EVM selector for this function is: 0x5813216b,276	///  or in textual repr: collectionAdmins()277	function collectionAdmins() external view returns (CrossAddress[] memory);278279	/// Changes collection owner to another account280	///281	/// @dev Owner can be changed only by current owner282	/// @param newOwner new owner cross account283	/// @dev EVM selector for this function is: 0x6496c497,284	///  or in textual repr: changeCollectionOwnerCross((address,uint256))285	function changeCollectionOwnerCross(CrossAddress memory newOwner) external;286}287288/// Cross account struct289struct CrossAddress {290	address eth;291	uint256 sub;292}293294/// Ethereum representation of `AccessMode` (see [`up_data_structs::AccessMode`]).295enum AccessMode {296	/// Access grant for owner and admins. Used as default.297	Normal,298	/// Like a [`Normal`](AccessMode::Normal) but also users in allow list.299	AllowList300}301302/// Ethereum representation of `NestingPermissions` (see [`up_data_structs::NestingPermissions`]) field.303struct CollectionNestingPermission {304	CollectionPermissionField field;305	bool value;306}307308/// Ethereum representation of `NestingPermissions` (see [`up_data_structs::NestingPermissions`]) fields as an enumeration.309enum CollectionPermissionField {310	/// Owner of token can nest tokens under it.311	TokenOwner,312	/// Admin of token collection can nest tokens under token.313	CollectionAdmin314}315316/// Nested collections.317struct CollectionNesting {318	bool token_owner;319	uint256[] ids;320}321322/// Nested collections and permissions323struct CollectionNestingAndPermission {324	/// Owner of token can nest tokens under it.325	bool token_owner;326	/// Admin of token collection can nest tokens under token.327	bool collection_admin;328	/// If set - only tokens from specified collections can be nested.329	address[] restricted;330}331332/// [`CollectionLimits`](up_data_structs::CollectionLimits) field representation for EVM.333struct CollectionLimit {334	CollectionLimitField field;335	OptionUint256 value;336}337338/// Optional value339struct OptionUint256 {340	/// Shows the status of accessibility of value341	bool status;342	/// Actual value if `status` is true343	uint256 value;344}345346/// [`CollectionLimits`](up_data_structs::CollectionLimits) fields representation for EVM.347enum CollectionLimitField {348	/// How many tokens can a user have on one account.349	AccountTokenOwnership,350	/// How many bytes of data are available for sponsorship.351	SponsoredDataSize,352	/// In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]353	SponsoredDataRateLimit,354	/// How many tokens can be mined into this collection.355	TokenLimit,356	/// Timeouts for transfer sponsoring.357	SponsorTransferTimeout,358	/// Timeout for sponsoring an approval in passed blocks.359	SponsorApproveTimeout,360	/// Whether the collection owner of the collection can send tokens (which belong to other users).361	OwnerCanTransfer,362	/// Can the collection owner burn other people's tokens.363	OwnerCanDestroy,364	/// Is it possible to send tokens from this collection between users.365	TransferEnabled366}367368/// Ethereum representation of collection [`PropertyKey`](up_data_structs::PropertyKey) and [`PropertyValue`](up_data_structs::PropertyValue).369struct Property {370	string key;371	bytes value;372}373374/// @dev the ERC-165 identifier for this interface is 0x69d14d3e375interface ERC20UniqueExtensions is Dummy, ERC165 {376	/// @dev Function to check the amount of tokens that an owner allowed to a spender.377	/// @param owner crossAddress The address which owns the funds.378	/// @param spender crossAddress The address which will spend the funds.379	/// @return A uint256 specifying the amount of tokens still available for the spender.380	/// @dev EVM selector for this function is: 0xe0af4bd7,381	///  or in textual repr: allowanceCross((address,uint256),(address,uint256))382	function allowanceCross(CrossAddress memory owner, CrossAddress memory spender) external view returns (uint256);383384	/// @notice A description for the collection.385	/// @dev EVM selector for this function is: 0x7284e416,386	///  or in textual repr: description()387	function description() external view returns (string memory);388389	/// @dev EVM selector for this function is: 0x269e6158,390	///  or in textual repr: mintCross((address,uint256),uint256)391	function mintCross(CrossAddress memory to, uint256 amount) external returns (bool);392393	/// @dev EVM selector for this function is: 0x0ecd0ab0,394	///  or in textual repr: approveCross((address,uint256),uint256)395	function approveCross(CrossAddress memory spender, uint256 amount) external returns (bool);396397	// /// Burn tokens from account398	// /// @dev Function that burns an `amount` of the tokens of a given account,399	// /// deducting from the sender's allowance for said account.400	// /// @param from The account whose tokens will be burnt.401	// /// @param amount The amount that will be burnt.402	// /// @dev EVM selector for this function is: 0x79cc6790,403	// ///  or in textual repr: burnFrom(address,uint256)404	// function burnFrom(address from, uint256 amount) external returns (bool);405406	/// Burn tokens from account407	/// @dev Function that burns an `amount` of the tokens of a given account,408	/// deducting from the sender's allowance for said account.409	/// @param from The account whose tokens will be burnt.410	/// @param amount The amount that will be burnt.411	/// @dev EVM selector for this function is: 0xbb2f5a58,412	///  or in textual repr: burnFromCross((address,uint256),uint256)413	function burnFromCross(CrossAddress memory from, uint256 amount) external returns (bool);414415	/// Mint tokens for multiple accounts.416	/// @param amounts array of pairs of account address and amount417	/// @dev EVM selector for this function is: 0x1acf2d55,418	///  or in textual repr: mintBulk((address,uint256)[])419	function mintBulk(AmountForAddress[] memory amounts) external returns (bool);420421	/// @dev EVM selector for this function is: 0x2ada85ff,422	///  or in textual repr: transferCross((address,uint256),uint256)423	function transferCross(CrossAddress memory to, uint256 amount) external returns (bool);424425	/// @dev EVM selector for this function is: 0xd5cf430b,426	///  or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)427	function transferFromCross(428		CrossAddress memory from,429		CrossAddress memory to,430		uint256 amount431	) external returns (bool);432433	/// @notice Returns collection helper contract address434	/// @dev EVM selector for this function is: 0x1896cce6,435	///  or in textual repr: collectionHelperAddress()436	function collectionHelperAddress() external view returns (address);437438	/// @notice Balance of account439	/// @param owner An cross address for whom to query the balance440	/// @return The number of fingibles owned by `owner`, possibly zero441	/// @dev EVM selector for this function is: 0xec069398,442	///  or in textual repr: balanceOfCross((address,uint256))443	function balanceOfCross(CrossAddress memory owner) external view returns (uint256);444}445446struct AmountForAddress {447	address to;448	uint256 amount;449}450451/// @dev the ERC-165 identifier for this interface is 0x40c10f19452interface ERC20Mintable is Dummy, ERC165 {453	/// Mint tokens for `to` account.454	/// @param to account that will receive minted tokens455	/// @param amount amount of tokens to mint456	/// @dev EVM selector for this function is: 0x40c10f19,457	///  or in textual repr: mint(address,uint256)458	function mint(address to, uint256 amount) external returns (bool);459}460461/// @dev inlined interface462interface ERC20Events {463	event Transfer(address indexed from, address indexed to, uint256 value);464	event Approval(address indexed owner, address indexed spender, uint256 value);465}466467/// @dev the ERC-165 identifier for this interface is 0x942e8b22468interface ERC20 is Dummy, ERC165, ERC20Events {469	/// @dev EVM selector for this function is: 0x06fdde03,470	///  or in textual repr: name()471	function name() external view returns (string memory);472473	/// @dev EVM selector for this function is: 0x95d89b41,474	///  or in textual repr: symbol()475	function symbol() external view returns (string memory);476477	/// @dev EVM selector for this function is: 0x18160ddd,478	///  or in textual repr: totalSupply()479	function totalSupply() external view returns (uint256);480481	/// @dev EVM selector for this function is: 0x313ce567,482	///  or in textual repr: decimals()483	function decimals() external view returns (uint8);484485	/// @dev EVM selector for this function is: 0x70a08231,486	///  or in textual repr: balanceOf(address)487	function balanceOf(address owner) external view returns (uint256);488489	/// @dev EVM selector for this function is: 0xa9059cbb,490	///  or in textual repr: transfer(address,uint256)491	function transfer(address to, uint256 amount) external returns (bool);492493	/// @dev EVM selector for this function is: 0x23b872dd,494	///  or in textual repr: transferFrom(address,address,uint256)495	function transferFrom(496		address from,497		address to,498		uint256 amount499	) external returns (bool);500501	/// @dev EVM selector for this function is: 0x095ea7b3,502	///  or in textual repr: approve(address,uint256)503	function approve(address spender, uint256 amount) external returns (bool);504505	/// @dev EVM selector for this function is: 0xdd62ed3e,506	///  or in textual repr: allowance(address,address)507	function allowance(address owner, address spender) external view returns (uint256);508}509510interface UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}