git.delta.rocks / unique-network / refs/commits / 6edd3f1acfd3

difftreelog

feat implement evm property manipulation

Yaroslav Bolyukin2022-05-17parent: #6020bb0.patch.diff
in: master

12 files changed

modified.maintain/scripts/generate_api.shdiffbeforeafterboth
--- a/.maintain/scripts/generate_api.sh
+++ b/.maintain/scripts/generate_api.sh
@@ -7,6 +7,5 @@
 sed -n '/=== SNIP START ===/, /=== SNIP END ===/{ /=== SNIP START ===/! { /=== SNIP END ===/! p } }' $tmp > $raw
 formatted=$(mktemp)
 prettier --use-tabs $raw > $formatted
-solhint --fix $formatted
 
 mv $formatted $OUTPUT
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -21,7 +21,7 @@
 use sp_std::vec::Vec;
 use up_data_structs::Property;
 
-use crate::{Pallet, CollectionHandle, Config};
+use crate::{Pallet, CollectionHandle, Config, CollectionProperties};
 
 /// Does not always represent a full collection, for RFT it is either
 /// collection (Implementing ERC721), or specific collection token (Implementing ERC20)
@@ -33,24 +33,35 @@
 
 #[solidity_interface(name = "CollectionProperties")]
 impl<T: Config> CollectionHandle<T> {
-	fn set_property(&mut self, caller: caller, key: string, value: string) -> Result<()> {
-		<Pallet<T>>::set_collection_property(
-			self,
-			&T::CrossAccountId::from_eth(caller),
-			Property {
-				key: <Vec<u8>>::from(key)
-					.try_into()
-					.map_err(|_| "key too large")?,
-				value: <Vec<u8>>::from(value)
-					.try_into()
-					.map_err(|_| "value too large")?,
-			},
-		)
-		.map_err(dispatch_to_evm::<T>)?;
-		Ok(())
+	fn set_collection_property(&mut self, caller: caller, key: string, value: bytes) -> Result<()> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let key = <Vec<u8>>::from(key)
+			.try_into()
+			.map_err(|_| "key too large")?;
+		let value = value.try_into().map_err(|_| "value too large")?;
+
+		<Pallet<T>>::set_collection_property(self, &caller, Property { key, value })
+			.map_err(dispatch_to_evm::<T>)
 	}
 
-	fn delete_property(&mut self, caller: caller, key: string) -> Result<()> {
-		self.set_property(caller, key, string::new())
+	fn delete_collection_property(&mut self, caller: caller, key: string) -> Result<()> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let key = <Vec<u8>>::from(key)
+			.try_into()
+			.map_err(|_| "key too large")?;
+
+		<Pallet<T>>::delete_collection_property(self, &caller, key).map_err(dispatch_to_evm::<T>)
+	}
+
+	/// Throws error if key not found
+	fn collection_property(&self, key: string) -> Result<bytes> {
+		let key = <Vec<u8>>::from(key)
+			.try_into()
+			.map_err(|_| "key too large")?;
+
+		let props = <CollectionProperties<T>>::get(self.id);
+		let prop = props.get(&key).ok_or("key not found")?;
+
+		Ok(prop.to_vec())
 	}
 }
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -31,12 +31,12 @@
 use pallet_evm::GasWeightMapping;
 use up_data_structs::{
 	COLLECTION_NUMBER_LIMIT, Collection, RpcCollection, CollectionId, CreateItemData,
-	MAX_TOKEN_PREFIX_LENGTH, COLLECTION_ADMINS_LIMIT, TokenId,
-	CollectionStats, MAX_TOKEN_OWNERSHIP, CollectionMode, NFT_SPONSOR_TRANSFER_TIMEOUT,
+	MAX_TOKEN_PREFIX_LENGTH, COLLECTION_ADMINS_LIMIT, TokenId, CollectionStats,
+	MAX_TOKEN_OWNERSHIP, CollectionMode, NFT_SPONSOR_TRANSFER_TIMEOUT,
 	FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MAX_SPONSOR_TIMEOUT,
-	CUSTOM_DATA_LIMIT, CollectionLimits, CreateCollectionData, SponsorshipState,
-	CreateItemExData, SponsoringRateLimit, budget::Budget, COLLECTION_FIELD_LIMIT, CollectionField,
-	PhantomType, Property, Properties, PropertiesPermissionMap, PropertyKey, PropertyPermission,
+	CUSTOM_DATA_LIMIT, CollectionLimits, CreateCollectionData, SponsorshipState, CreateItemExData,
+	SponsoringRateLimit, budget::Budget, COLLECTION_FIELD_LIMIT, CollectionField, PhantomType,
+	Property, Properties, PropertiesPermissionMap, PropertyKey, PropertyPermission,
 	PropertiesError, PropertyKeyPermission, TokenData, TrySet,
 };
 pub use pallet::*;
modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
--- a/pallets/fungible/src/stubs/UniqueFungible.sol
+++ b/pallets/fungible/src/stubs/UniqueFungible.sol
@@ -8,8 +8,13 @@
 	uint8 dummy;
 	string stub_error = "this contract is implemented in native";
 }
+
 contract ERC165 is Dummy {
-	function supportsInterface(bytes4 interfaceID) external view returns (bool) {
+	function supportsInterface(bytes4 interfaceID)
+		external
+		view
+		returns (bool)
+	{
 		require(false, stub_error);
 		interfaceID;
 		return true;
@@ -19,24 +24,11 @@
 // Inline
 contract ERC20Events {
 	event Transfer(address indexed from, address indexed to, uint256 value);
-	event Approval(address indexed owner, address indexed spender, uint256 value);
-}
-
-// Selector: 56fd500b
-contract CollectionProperties is Dummy, ERC165 {
-	// Selector: setProperty(string,string) 62d9491f
-	function setProperty(string memory key, string memory value) public {
-		require(false, stub_error);
-		key;
-		value;
-		dummy = 0;
-	}
-	// Selector: deleteProperty(string) 34241914
-	function deleteProperty(string memory key) public {
-		require(false, stub_error);
-		key;
-		dummy = 0;
-	}
+	event Approval(
+		address indexed owner,
+		address indexed spender,
+		uint256 value
+	);
 }
 
 // Selector: 79cc6790
@@ -59,24 +51,28 @@
 		dummy;
 		return "";
 	}
+
 	// Selector: symbol() 95d89b41
 	function symbol() public view returns (string memory) {
 		require(false, stub_error);
 		dummy;
 		return "";
 	}
+
 	// Selector: totalSupply() 18160ddd
 	function totalSupply() public view returns (uint256) {
 		require(false, stub_error);
 		dummy;
 		return 0;
 	}
+
 	// Selector: decimals() 313ce567
 	function decimals() public view returns (uint8) {
 		require(false, stub_error);
 		dummy;
 		return 0;
 	}
+
 	// Selector: balanceOf(address) 70a08231
 	function balanceOf(address owner) public view returns (uint256) {
 		require(false, stub_error);
@@ -84,6 +80,7 @@
 		dummy;
 		return 0;
 	}
+
 	// Selector: transfer(address,uint256) a9059cbb
 	function transfer(address to, uint256 amount) public returns (bool) {
 		require(false, stub_error);
@@ -92,8 +89,13 @@
 		dummy = 0;
 		return false;
 	}
+
 	// Selector: transferFrom(address,address,uint256) 23b872dd
-	function transferFrom(address from, address to, uint256 amount) public returns (bool) {
+	function transferFrom(
+		address from,
+		address to,
+		uint256 amount
+	) public returns (bool) {
 		require(false, stub_error);
 		from;
 		to;
@@ -101,6 +103,7 @@
 		dummy = 0;
 		return false;
 	}
+
 	// Selector: approve(address,uint256) 095ea7b3
 	function approve(address spender, uint256 amount) public returns (bool) {
 		require(false, stub_error);
@@ -109,8 +112,13 @@
 		dummy = 0;
 		return false;
 	}
+
 	// Selector: allowance(address,address) dd62ed3e
-	function allowance(address owner, address spender) public view returns (uint256) {
+	function allowance(address owner, address spender)
+		public
+		view
+		returns (uint256)
+	{
 		require(false, stub_error);
 		owner;
 		spender;
@@ -119,6 +127,44 @@
 	}
 }
 
-contract UniqueFungible is Dummy, ERC165, ERC20, ERC20UniqueExtensions, CollectionProperties {
+// Selector: 9b5e29c5
+contract CollectionProperties is Dummy, ERC165 {
+	// Selector: setCollectionProperty(string,bytes) 2f073f66
+	function setCollectionProperty(string memory key, bytes memory value)
+		public
+	{
+		require(false, stub_error);
+		key;
+		value;
+		dummy = 0;
+	}
+
+	// Selector: deleteCollectionProperty(string) 7b7debce
+	function deleteCollectionProperty(string memory key) public {
+		require(false, stub_error);
+		key;
+		dummy = 0;
+	}
+
+	// Throws error if key not found
+	//
+	// Selector: collectionProperty(string) cf24fd6d
+	function collectionProperty(string memory key)
+		public
+		view
+		returns (bytes memory)
+	{
+		require(false, stub_error);
+		key;
+		dummy;
+		return hex"";
+	}
 }
 
+contract UniqueFungible is
+	Dummy,
+	ERC165,
+	ERC20,
+	ERC20UniqueExtensions,
+	CollectionProperties
+{}
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -21,7 +21,7 @@
 };
 use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};
 use frame_support::BoundedVec;
-use up_data_structs::{TokenId, SchemaVersion};
+use up_data_structs::{TokenId, SchemaVersion, PropertyPermission, PropertyKeyPermission, Property};
 use pallet_evm_coder_substrate::dispatch_to_evm;
 use sp_core::{H160, U256};
 use sp_std::vec::Vec;
@@ -35,9 +35,80 @@
 
 use crate::{
 	AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, TokenData, TokensMinted,
-	SelfWeightOf, weights::WeightInfo,
+	SelfWeightOf, weights::WeightInfo, TokenProperties,
 };
 
+#[solidity_interface(name = "TokenProperties")]
+impl<T: Config> NonfungibleHandle<T> {
+	fn set_token_property_permission(
+		&mut self,
+		caller: caller,
+		key: string,
+		is_mutable: bool,
+		collection_admin: bool,
+		token_owner: bool,
+	) -> Result<()> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		<Pallet<T>>::set_property_permission(
+			self,
+			&caller,
+			PropertyKeyPermission {
+				key: <Vec<u8>>::from(key)
+					.try_into()
+					.map_err(|_| "too long key")?,
+				permission: PropertyPermission {
+					mutable: is_mutable,
+					collection_admin,
+					token_owner,
+				},
+			},
+		)
+		.map_err(dispatch_to_evm::<T>)
+	}
+
+	fn set_property(
+		&mut self,
+		caller: caller,
+		token_id: uint256,
+		key: string,
+		value: bytes,
+	) -> Result<()> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
+		let key = <Vec<u8>>::from(key)
+			.try_into()
+			.map_err(|_| "key too long")?;
+		let value = value.try_into().map_err(|_| "value too long")?;
+
+		<Pallet<T>>::set_token_property(self, &caller, TokenId(token_id), Property { key, value })
+			.map_err(dispatch_to_evm::<T>)
+	}
+
+	fn delete_property(&mut self, token_id: uint256, caller: caller, key: string) -> Result<()> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
+		let key = <Vec<u8>>::from(key)
+			.try_into()
+			.map_err(|_| "key too long")?;
+
+		<Pallet<T>>::delete_token_property(self, &caller, TokenId(token_id), key)
+			.map_err(dispatch_to_evm::<T>)
+	}
+
+	/// Throws error if key not found
+	fn property(&self, token_id: uint256, key: string) -> Result<bytes> {
+		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
+		let key = <Vec<u8>>::from(key)
+			.try_into()
+			.map_err(|_| "key too long")?;
+
+		let props = <TokenProperties<T>>::get((self.id, token_id));
+		let prop = props.get(&key).ok_or("key not found")?;
+
+		Ok(prop.to_vec())
+	}
+}
+
 fn error_unsupported_schema_version() -> Error {
 	alloc::format!(
 		"Unsupported schema version! Support only {:?}",
@@ -470,7 +541,8 @@
 		ERC721UniqueExtensions,
 		ERC721Mintable,
 		ERC721Burnable,
-		via("CollectionHandle<T>", common_mut, CollectionProperties)
+		via("CollectionHandle<T>", common_mut, CollectionProperties),
+		TokenProperties,
 	)
 )]
 impl<T: Config> NonfungibleHandle<T> {}
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -63,7 +63,9 @@
 #[frame_support::pallet]
 pub mod pallet {
 	use super::*;
-	use frame_support::{Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key, traits::StorageVersion};
+	use frame_support::{
+		Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key, traits::StorageVersion,
+	};
 	use frame_system::pallet_prelude::*;
 	use up_data_structs::{CollectionId, TokenId};
 	use super::weights::WeightInfo;
@@ -429,6 +431,14 @@
 		<PalletCommon<T>>::set_property_permissions(collection, sender, property_permissions)
 	}
 
+	pub fn set_property_permission(
+		collection: &CollectionHandle<T>,
+		sender: &T::CrossAccountId,
+		permission: PropertyKeyPermission,
+	) -> DispatchResult {
+		<PalletCommon<T>>::set_property_permission(collection, sender, permission)
+	}
+
 	pub fn transfer(
 		collection: &NonfungibleHandle<T>,
 		from: &T::CrossAccountId,
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -51,32 +51,68 @@
 	event MintingFinished();
 }
 
-// Selector: 42966c68
-contract ERC721Burnable is Dummy, ERC165 {
-	// Selector: burn(uint256) 42966c68
-	function burn(uint256 tokenId) public {
+// Selector: 41369377
+contract TokenProperties is Dummy, ERC165 {
+	// Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa
+	function setTokenPropertyPermission(
+		string memory key,
+		bool isMutable,
+		bool collectionAdmin,
+		bool tokenOwner
+	) public {
 		require(false, stub_error);
-		tokenId;
+		key;
+		isMutable;
+		collectionAdmin;
+		tokenOwner;
 		dummy = 0;
 	}
-}
 
-// Selector: 56fd500b
-contract CollectionProperties is Dummy, ERC165 {
-	// Selector: setProperty(string,string) 62d9491f
-	function setProperty(string memory key, string memory value) public {
+	// Selector: setProperty(uint256,string,bytes) 1752d67b
+	function setProperty(
+		uint256 tokenId,
+		string memory key,
+		bytes memory value
+	) public {
 		require(false, stub_error);
+		tokenId;
 		key;
 		value;
 		dummy = 0;
 	}
 
-	// Selector: deleteProperty(string) 34241914
-	function deleteProperty(string memory key) public {
+	// Selector: deleteProperty(uint256,string) 066111d1
+	function deleteProperty(uint256 tokenId, string memory key) public {
 		require(false, stub_error);
+		tokenId;
 		key;
 		dummy = 0;
 	}
+
+	// Throws error if key not found
+	//
+	// Selector: property(uint256,string) 7228c327
+	function property(uint256 tokenId, string memory key)
+		public
+		view
+		returns (bytes memory)
+	{
+		require(false, stub_error);
+		tokenId;
+		key;
+		dummy;
+		return hex"";
+	}
+}
+
+// Selector: 42966c68
+contract ERC721Burnable is Dummy, ERC165 {
+	// Selector: burn(uint256) 42966c68
+	function burn(uint256 tokenId) public {
+		require(false, stub_error);
+		tokenId;
+		dummy = 0;
+	}
 }
 
 // Selector: 58800161
@@ -294,6 +330,40 @@
 	}
 }
 
+// Selector: 9b5e29c5
+contract CollectionProperties is Dummy, ERC165 {
+	// Selector: setCollectionProperty(string,bytes) 2f073f66
+	function setCollectionProperty(string memory key, bytes memory value)
+		public
+	{
+		require(false, stub_error);
+		key;
+		value;
+		dummy = 0;
+	}
+
+	// Selector: deleteCollectionProperty(string) 7b7debce
+	function deleteCollectionProperty(string memory key) public {
+		require(false, stub_error);
+		key;
+		dummy = 0;
+	}
+
+	// Throws error if key not found
+	//
+	// Selector: collectionProperty(string) cf24fd6d
+	function collectionProperty(string memory key)
+		public
+		view
+		returns (bytes memory)
+	{
+		require(false, stub_error);
+		key;
+		dummy;
+		return hex"";
+	}
+}
+
 // Selector: d74d154f
 contract ERC721UniqueExtensions is Dummy, ERC165 {
 	// Selector: transfer(address,uint256) a9059cbb
@@ -353,5 +423,6 @@
 	ERC721UniqueExtensions,
 	ERC721Mintable,
 	ERC721Burnable,
-	CollectionProperties
+	CollectionProperties,
+	TokenProperties
 {}
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -22,15 +22,6 @@
 	);
 }
 
-// Selector: 56fd500b
-interface CollectionProperties is Dummy, ERC165 {
-	// Selector: setProperty(string,string) 62d9491f
-	function setProperty(string memory key, string memory value) external;
-
-	// Selector: deleteProperty(string) 34241914
-	function deleteProperty(string memory key) external;
-}
-
 // Selector: 79cc6790
 interface ERC20UniqueExtensions is Dummy, ERC165 {
 	// Selector: burnFrom(address,uint256) 79cc6790
@@ -74,6 +65,24 @@
 		returns (uint256);
 }
 
+// Selector: 9b5e29c5
+interface CollectionProperties is Dummy, ERC165 {
+	// Selector: setCollectionProperty(string,bytes) 2f073f66
+	function setCollectionProperty(string memory key, bytes memory value)
+		external;
+
+	// Selector: deleteCollectionProperty(string) 7b7debce
+	function deleteCollectionProperty(string memory key) external;
+
+	// Throws error if key not found
+	//
+	// Selector: collectionProperty(string) cf24fd6d
+	function collectionProperty(string memory key)
+		external
+		view
+		returns (bytes memory);
+}
+
 interface UniqueFungible is
 	Dummy,
 	ERC165,
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
before · tests/src/eth/api/UniqueNFT.sol
1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56// Anonymous struct7struct Tuple0 {8	uint256 field_0;9	string field_1;10}1112// Common stubs holder13interface Dummy {1415}1617interface ERC165 is Dummy {18	function supportsInterface(bytes4 interfaceID) external view returns (bool);19}2021// Inline22interface ERC721Events {23	event Transfer(24		address indexed from,25		address indexed to,26		uint256 indexed tokenId27	);28	event Approval(29		address indexed owner,30		address indexed approved,31		uint256 indexed tokenId32	);33	event ApprovalForAll(34		address indexed owner,35		address indexed operator,36		bool approved37	);38}3940// Inline41interface ERC721MintableEvents {42	event MintingFinished();43}4445// Selector: 42966c6846interface ERC721Burnable is Dummy, ERC165 {47	// Selector: burn(uint256) 42966c6848	function burn(uint256 tokenId) external;49}5051// Selector: 56fd500b52interface CollectionProperties is Dummy, ERC165 {53	// Selector: setProperty(string,string) 62d9491f54	function setProperty(string memory key, string memory value) external;5556	// Selector: deleteProperty(string) 3424191457	function deleteProperty(string memory key) external;58}5960// Selector: 5880016161interface ERC721 is Dummy, ERC165, ERC721Events {62	// Selector: balanceOf(address) 70a0823163	function balanceOf(address owner) external view returns (uint256);6465	// Selector: ownerOf(uint256) 6352211e66	function ownerOf(uint256 tokenId) external view returns (address);6768	// Not implemented69	//70	// Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a1167271	function safeTransferFromWithData(72		address from,73		address to,74		uint256 tokenId,75		bytes memory data76	) external;7778	// Not implemented79	//80	// Selector: safeTransferFrom(address,address,uint256) 42842e0e81	function safeTransferFrom(82		address from,83		address to,84		uint256 tokenId85	) external;8687	// Selector: transferFrom(address,address,uint256) 23b872dd88	function transferFrom(89		address from,90		address to,91		uint256 tokenId92	) external;9394	// Selector: approve(address,uint256) 095ea7b395	function approve(address approved, uint256 tokenId) external;9697	// Not implemented98	//99	// Selector: setApprovalForAll(address,bool) a22cb465100	function setApprovalForAll(address operator, bool approved) external;101102	// Not implemented103	//104	// Selector: getApproved(uint256) 081812fc105	function getApproved(uint256 tokenId) external view returns (address);106107	// Not implemented108	//109	// Selector: isApprovedForAll(address,address) e985e9c5110	function isApprovedForAll(address owner, address operator)111		external112		view113		returns (address);114}115116// Selector: 5b5e139f117interface ERC721Metadata is Dummy, ERC165 {118	// Selector: name() 06fdde03119	function name() external view returns (string memory);120121	// Selector: symbol() 95d89b41122	function symbol() external view returns (string memory);123124	// Returns token's const_metadata125	//126	// Selector: tokenURI(uint256) c87b56dd127	function tokenURI(uint256 tokenId) external view returns (string memory);128}129130// Selector: 68ccfe89131interface ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {132	// Selector: mintingFinished() 05d2035b133	function mintingFinished() external view returns (bool);134135	// `token_id` should be obtained with `next_token_id` method,136	// unlike standard, you can't specify it manually137	//138	// Selector: mint(address,uint256) 40c10f19139	function mint(address to, uint256 tokenId) external returns (bool);140141	// `token_id` should be obtained with `next_token_id` method,142	// unlike standard, you can't specify it manually143	//144	// Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f145	function mintWithTokenURI(146		address to,147		uint256 tokenId,148		string memory tokenUri149	) external returns (bool);150151	// Not implemented152	//153	// Selector: finishMinting() 7d64bcb4154	function finishMinting() external returns (bool);155}156157// Selector: 780e9d63158interface ERC721Enumerable is Dummy, ERC165 {159	// Selector: tokenByIndex(uint256) 4f6ccce7160	function tokenByIndex(uint256 index) external view returns (uint256);161162	// Not implemented163	//164	// Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59165	function tokenOfOwnerByIndex(address owner, uint256 index)166		external167		view168		returns (uint256);169170	// Selector: totalSupply() 18160ddd171	function totalSupply() external view returns (uint256);172}173174// Selector: d74d154f175interface ERC721UniqueExtensions is Dummy, ERC165 {176	// Selector: transfer(address,uint256) a9059cbb177	function transfer(address to, uint256 tokenId) external;178179	// Selector: burnFrom(address,uint256) 79cc6790180	function burnFrom(address from, uint256 tokenId) external;181182	// Selector: nextTokenId() 75794a3c183	function nextTokenId() external view returns (uint256);184185	// Selector: mintBulk(address,uint256[]) 44a9945e186	function mintBulk(address to, uint256[] memory tokenIds)187		external188		returns (bool);189190	// Selector: mintBulkWithTokenURI(address,(uint256,string)[]) 36543006191	function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)192		external193		returns (bool);194}195196interface UniqueNFT is197	Dummy,198	ERC165,199	ERC721,200	ERC721Metadata,201	ERC721Enumerable,202	ERC721UniqueExtensions,203	ERC721Mintable,204	ERC721Burnable,205	CollectionProperties206{}
after · tests/src/eth/api/UniqueNFT.sol
1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56// Anonymous struct7struct Tuple0 {8	uint256 field_0;9	string field_1;10}1112// Common stubs holder13interface Dummy {1415}1617interface ERC165 is Dummy {18	function supportsInterface(bytes4 interfaceID) external view returns (bool);19}2021// Inline22interface ERC721Events {23	event Transfer(24		address indexed from,25		address indexed to,26		uint256 indexed tokenId27	);28	event Approval(29		address indexed owner,30		address indexed approved,31		uint256 indexed tokenId32	);33	event ApprovalForAll(34		address indexed owner,35		address indexed operator,36		bool approved37	);38}3940// Inline41interface ERC721MintableEvents {42	event MintingFinished();43}4445// Selector: 4136937746interface TokenProperties is Dummy, ERC165 {47	// Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa48	function setTokenPropertyPermission(49		string memory key,50		bool isMutable,51		bool collectionAdmin,52		bool tokenOwner53	) external;5455	// Selector: setProperty(uint256,string,bytes) 1752d67b56	function setProperty(57		uint256 tokenId,58		string memory key,59		bytes memory value60	) external;6162	// Selector: deleteProperty(uint256,string) 066111d163	function deleteProperty(uint256 tokenId, string memory key) external;6465	// Throws error if key not found66	//67	// Selector: property(uint256,string) 7228c32768	function property(uint256 tokenId, string memory key)69		external70		view71		returns (bytes memory);72}7374// Selector: 42966c6875interface ERC721Burnable is Dummy, ERC165 {76	// Selector: burn(uint256) 42966c6877	function burn(uint256 tokenId) external;78}7980// Selector: 5880016181interface ERC721 is Dummy, ERC165, ERC721Events {82	// Selector: balanceOf(address) 70a0823183	function balanceOf(address owner) external view returns (uint256);8485	// Selector: ownerOf(uint256) 6352211e86	function ownerOf(uint256 tokenId) external view returns (address);8788	// Not implemented89	//90	// Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a1167291	function safeTransferFromWithData(92		address from,93		address to,94		uint256 tokenId,95		bytes memory data96	) external;9798	// Not implemented99	//100	// Selector: safeTransferFrom(address,address,uint256) 42842e0e101	function safeTransferFrom(102		address from,103		address to,104		uint256 tokenId105	) external;106107	// Selector: transferFrom(address,address,uint256) 23b872dd108	function transferFrom(109		address from,110		address to,111		uint256 tokenId112	) external;113114	// Selector: approve(address,uint256) 095ea7b3115	function approve(address approved, uint256 tokenId) external;116117	// Not implemented118	//119	// Selector: setApprovalForAll(address,bool) a22cb465120	function setApprovalForAll(address operator, bool approved) external;121122	// Not implemented123	//124	// Selector: getApproved(uint256) 081812fc125	function getApproved(uint256 tokenId) external view returns (address);126127	// Not implemented128	//129	// Selector: isApprovedForAll(address,address) e985e9c5130	function isApprovedForAll(address owner, address operator)131		external132		view133		returns (address);134}135136// Selector: 5b5e139f137interface ERC721Metadata is Dummy, ERC165 {138	// Selector: name() 06fdde03139	function name() external view returns (string memory);140141	// Selector: symbol() 95d89b41142	function symbol() external view returns (string memory);143144	// Returns token's const_metadata145	//146	// Selector: tokenURI(uint256) c87b56dd147	function tokenURI(uint256 tokenId) external view returns (string memory);148}149150// Selector: 68ccfe89151interface ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {152	// Selector: mintingFinished() 05d2035b153	function mintingFinished() external view returns (bool);154155	// `token_id` should be obtained with `next_token_id` method,156	// unlike standard, you can't specify it manually157	//158	// Selector: mint(address,uint256) 40c10f19159	function mint(address to, uint256 tokenId) external returns (bool);160161	// `token_id` should be obtained with `next_token_id` method,162	// unlike standard, you can't specify it manually163	//164	// Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f165	function mintWithTokenURI(166		address to,167		uint256 tokenId,168		string memory tokenUri169	) external returns (bool);170171	// Not implemented172	//173	// Selector: finishMinting() 7d64bcb4174	function finishMinting() external returns (bool);175}176177// Selector: 780e9d63178interface ERC721Enumerable is Dummy, ERC165 {179	// Selector: tokenByIndex(uint256) 4f6ccce7180	function tokenByIndex(uint256 index) external view returns (uint256);181182	// Not implemented183	//184	// Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59185	function tokenOfOwnerByIndex(address owner, uint256 index)186		external187		view188		returns (uint256);189190	// Selector: totalSupply() 18160ddd191	function totalSupply() external view returns (uint256);192}193194// Selector: 9b5e29c5195interface CollectionProperties is Dummy, ERC165 {196	// Selector: setCollectionProperty(string,bytes) 2f073f66197	function setCollectionProperty(string memory key, bytes memory value)198		external;199200	// Selector: deleteCollectionProperty(string) 7b7debce201	function deleteCollectionProperty(string memory key) external;202203	// Throws error if key not found204	//205	// Selector: collectionProperty(string) cf24fd6d206	function collectionProperty(string memory key)207		external208		view209		returns (bytes memory);210}211212// Selector: d74d154f213interface ERC721UniqueExtensions is Dummy, ERC165 {214	// Selector: transfer(address,uint256) a9059cbb215	function transfer(address to, uint256 tokenId) external;216217	// Selector: burnFrom(address,uint256) 79cc6790218	function burnFrom(address from, uint256 tokenId) external;219220	// Selector: nextTokenId() 75794a3c221	function nextTokenId() external view returns (uint256);222223	// Selector: mintBulk(address,uint256[]) 44a9945e224	function mintBulk(address to, uint256[] memory tokenIds)225		external226		returns (bool);227228	// Selector: mintBulkWithTokenURI(address,(uint256,string)[]) 36543006229	function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)230		external231		returns (bool);232}233234interface UniqueNFT is235	Dummy,236	ERC165,237	ERC721,238	ERC721Metadata,239	ERC721Enumerable,240	ERC721UniqueExtensions,241	ERC721Mintable,242	ERC721Burnable,243	CollectionProperties,244	TokenProperties245{}