difftreelog
chore code review requests
in: master
20 files changed
pallets/nonfungible/src/erc.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -34,15 +34,14 @@
use sp_std::vec::Vec;
use pallet_common::{
erc::{
- CommonEvmHandler, PrecompileResult, CollectionCall,
- static_property::{key, value as property_value},
+ CommonEvmHandler, PrecompileResult, CollectionCall, static_property::key,
+ static_property::value,
},
CollectionHandle, CollectionPropertyPermissions,
};
use pallet_evm::{account::CrossAccountId, PrecompileHandle};
use pallet_evm_coder_substrate::call;
use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};
-use alloc::string::ToString;
use crate::{
AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, TokenData, TokensMinted,
@@ -226,37 +225,44 @@
/// @return token's const_metadata
#[solidity(rename_selector = "tokenURI")]
fn token_uri(&self, token_id: uint256) -> Result<string> {
+ if !self.supports_metadata() {
+ return Ok("".into());
+ }
+
let token_id_u32: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
- if let Ok(url) = get_token_property(self, token_id_u32, &key::url()) {
- if !url.is_empty() {
- return Ok(url);
+ match get_token_property(self, token_id_u32, &key::url()).as_deref() {
+ Err(_) | Ok("") => (),
+ Ok(url) => {
+ return Ok(url.into());
}
- } else if !self.supports_metadata() {
- return Err("tokenURI not set".into());
- }
+ };
- if let Some(base_uri) =
+ let base_uri =
pallet_common::Pallet::<T>::get_collection_property(self.id, &key::base_uri())
- {
- if !base_uri.is_empty() {
- let base_uri = string::from_utf8(base_uri.into_inner()).map_err(|e| {
+ .map(BoundedVec::into_inner)
+ .map(string::from_utf8)
+ .transpose()
+ .map_err(|e| {
Error::Revert(alloc::format!(
"Can not convert value \"baseURI\" to string with error \"{}\"",
e
))
})?;
- if let Ok(suffix) = get_token_property(self, token_id_u32, &key::suffix()) {
- if !suffix.is_empty() {
- return Ok(base_uri + suffix.as_str());
- }
- }
- return Ok(base_uri);
+ let base_uri = match base_uri.as_deref() {
+ None | Some("") => {
+ return Ok("".into());
}
- }
+ Some(base_uri) => base_uri.into(),
+ };
- Ok("".into())
+ Ok(
+ match get_token_property(self, token_id_u32, &key::suffix()).as_deref() {
+ Err(_) | Ok("") => base_uri,
+ Ok(suffix) => base_uri + suffix,
+ },
+ )
}
}
@@ -706,17 +712,29 @@
}
}
+impl<T: Config> NonfungibleHandle<T> {
+ pub fn supports_metadata(&self) -> bool {
+ if let Some(erc721_metadata) =
+ pallet_common::Pallet::<T>::get_collection_property(self.id, &key::erc721_metadata())
+ {
+ *erc721_metadata.into_inner() == *value::ERC721_METADATA_SUPPORTED
+ } else {
+ false
+ }
+ }
+}
+
#[solidity_interface(
name = UniqueNFT,
is(
ERC721,
- ERC721Metadata(if(this.supports_metadata())),
ERC721Enumerable,
ERC721UniqueExtensions,
ERC721Mintable,
ERC721Burnable,
Collection(via(common_mut returns CollectionHandle<T>)),
TokenProperties,
+ ERC721Metadata(if(this.supports_metadata())),
)
)]
impl<T: Config> NonfungibleHandle<T> where T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]> {}
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -297,18 +297,6 @@
}
}
-impl<T: Config> NonfungibleHandle<T> {
- pub fn supports_metadata(&self) -> bool {
- if let Some(erc721_metadata) =
- pallet_common::Pallet::<T>::get_collection_property(self.id, &key::erc721_metadata())
- {
- *erc721_metadata.into_inner() == *value::ERC721_METADATA_SUPPORTED
- } else {
- false
- }
- }
-}
-
impl<T: Config> WithRecorder<T> for NonfungibleHandle<T> {
fn recorder(&self) -> &SubstrateRecorder<T> {
self.0.recorder()
pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -17,6 +17,47 @@
}
}
+/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
+/// @dev See https://eips.ethereum.org/EIPS/eip-721
+/// @dev the ERC-165 identifier for this interface is 0x5b5e139f
+contract ERC721Metadata is Dummy, ERC165 {
+ /// @notice A descriptive name for a collection of NFTs in this contract
+ /// @dev EVM selector for this function is: 0x06fdde03,
+ /// or in textual repr: name()
+ function name() public view returns (string memory) {
+ require(false, stub_error);
+ dummy;
+ return "";
+ }
+
+ /// @notice An abbreviated name for NFTs in this contract
+ /// @dev EVM selector for this function is: 0x95d89b41,
+ /// or in textual repr: symbol()
+ function symbol() public view returns (string memory) {
+ require(false, stub_error);
+ dummy;
+ return "";
+ }
+
+ /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
+ ///
+ /// @dev If the token has a `url` property and it is not empty, it is returned.
+ /// Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.
+ /// If the collection property `baseURI` is empty or absent, return "" (empty string)
+ /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix
+ /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).
+ ///
+ /// @return token's const_metadata
+ /// @dev EVM selector for this function is: 0xc87b56dd,
+ /// or in textual repr: tokenURI(uint256)
+ function tokenURI(uint256 tokenId) public view returns (string memory) {
+ require(false, stub_error);
+ tokenId;
+ dummy;
+ return "";
+ }
+}
+
/// @title A contract that allows to set and delete token properties and change token property permissions.
/// @dev the ERC-165 identifier for this interface is 0x41369377
contract TokenProperties is Dummy, ERC165 {
@@ -177,10 +218,10 @@
/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
/// @dev EVM selector for this function is: 0x6ec0a9f1,
/// or in textual repr: collectionSponsor()
- function collectionSponsor() public view returns (Tuple17 memory) {
+ function collectionSponsor() public view returns (Tuple15 memory) {
require(false, stub_error);
dummy;
- return Tuple17(0x0000000000000000000000000000000000000000, 0);
+ return Tuple15(0x0000000000000000000000000000000000000000, 0);
}
/// Set limits for the collection.
@@ -359,10 +400,10 @@
/// If address is canonical then substrate mirror is zero and vice versa.
/// @dev EVM selector for this function is: 0xdf727d3b,
/// or in textual repr: collectionOwner()
- function collectionOwner() public view returns (Tuple17 memory) {
+ function collectionOwner() public view returns (Tuple15 memory) {
require(false, stub_error);
dummy;
- return Tuple17(0x0000000000000000000000000000000000000000, 0);
+ return Tuple15(0x0000000000000000000000000000000000000000, 0);
}
/// Changes collection owner to another account
@@ -379,7 +420,7 @@
}
/// @dev anonymous struct
-struct Tuple17 {
+struct Tuple15 {
address field_0;
uint256 field_1;
}
@@ -525,7 +566,7 @@
/// @param tokens array of pairs of token ID and token URI for minted tokens
/// @dev EVM selector for this function is: 0x36543006,
/// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
- function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) public returns (bool) {
+ function mintBulkWithTokenURI(address to, Tuple6[] memory tokens) public returns (bool) {
require(false, stub_error);
to;
tokens;
@@ -535,7 +576,7 @@
}
/// @dev anonymous struct
-struct Tuple8 {
+struct Tuple6 {
uint256 field_0;
string field_1;
}
@@ -577,48 +618,7 @@
require(false, stub_error);
dummy;
return 0;
- }
-}
-
-/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
-/// @dev See https://eips.ethereum.org/EIPS/eip-721
-/// @dev the ERC-165 identifier for this interface is 0x5b5e139f
-contract ERC721Metadata is Dummy, ERC165 {
- /// @notice A descriptive name for a collection of NFTs in this contract
- /// @dev EVM selector for this function is: 0x06fdde03,
- /// or in textual repr: name()
- function name() public view returns (string memory) {
- require(false, stub_error);
- dummy;
- return "";
- }
-
- /// @notice An abbreviated name for NFTs in this contract
- /// @dev EVM selector for this function is: 0x95d89b41,
- /// or in textual repr: symbol()
- function symbol() public view returns (string memory) {
- require(false, stub_error);
- dummy;
- return "";
}
-
- /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
- ///
- /// @dev If the token has a `url` property and it is not empty, it is returned.
- /// Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.
- /// If the collection property `baseURI` is empty or absent, return "" (empty string)
- /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix
- /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).
- ///
- /// @return token's const_metadata
- /// @dev EVM selector for this function is: 0xc87b56dd,
- /// or in textual repr: tokenURI(uint256)
- function tokenURI(uint256 tokenId) public view returns (string memory) {
- require(false, stub_error);
- tokenId;
- dummy;
- return "";
- }
}
/// @dev inlined interface
@@ -766,11 +766,11 @@
Dummy,
ERC165,
ERC721,
- ERC721Metadata,
ERC721Enumerable,
ERC721UniqueExtensions,
ERC721Mintable,
ERC721Burnable,
Collection,
- TokenProperties
+ TokenProperties,
+ ERC721Metadata
{}
pallets/refungible/src/erc.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -21,19 +21,15 @@
extern crate alloc;
-use alloc::string::ToString;
use core::{
char::{REPLACEMENT_CHARACTER, decode_utf16},
convert::TryInto,
};
use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};
-use frame_support::BoundedBTreeMap;
+use frame_support::{BoundedBTreeMap, BoundedVec};
use pallet_common::{
CollectionHandle, CollectionPropertyPermissions,
- erc::{
- CommonEvmHandler, CollectionCall,
- static_property::{key, value as property_value},
- },
+ erc::{CommonEvmHandler, CollectionCall, static_property::key, static_property::value},
};
use pallet_evm::{account::CrossAccountId, PrecompileHandle};
use pallet_evm_coder_substrate::{call, dispatch_to_evm};
@@ -222,37 +218,44 @@
/// @return token's const_metadata
#[solidity(rename_selector = "tokenURI")]
fn token_uri(&self, token_id: uint256) -> Result<string> {
+ if !self.supports_metadata() {
+ return Ok("".into());
+ }
+
let token_id_u32: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
- if let Ok(url) = get_token_property(self, token_id_u32, &key::url()) {
- if !url.is_empty() {
- return Ok(url);
+ match get_token_property(self, token_id_u32, &key::url()).as_deref() {
+ Err(_) | Ok("") => (),
+ Ok(url) => {
+ return Ok(url.into());
}
- } else if !self.supports_metadata() {
- return Err("tokenURI not set".into());
- }
+ };
- if let Some(base_uri) =
+ let base_uri =
pallet_common::Pallet::<T>::get_collection_property(self.id, &key::base_uri())
- {
- if !base_uri.is_empty() {
- let base_uri = string::from_utf8(base_uri.into_inner()).map_err(|e| {
+ .map(BoundedVec::into_inner)
+ .map(string::from_utf8)
+ .transpose()
+ .map_err(|e| {
Error::Revert(alloc::format!(
"Can not convert value \"baseURI\" to string with error \"{}\"",
e
))
})?;
- if let Ok(suffix) = get_token_property(self, token_id_u32, &key::suffix()) {
- if !suffix.is_empty() {
- return Ok(base_uri + suffix.as_str());
- }
- }
- return Ok(base_uri);
+ let base_uri = match base_uri.as_deref() {
+ None | Some("") => {
+ return Ok("".into());
}
- }
+ Some(base_uri) => base_uri.into(),
+ };
- Ok("".into())
+ Ok(
+ match get_token_property(self, token_id_u32, &key::suffix()).as_deref() {
+ Err(_) | Ok("") => base_uri,
+ Ok(suffix) => base_uri + suffix,
+ },
+ )
}
}
@@ -765,17 +768,29 @@
}
}
+impl<T: Config> RefungibleHandle<T> {
+ pub fn supports_metadata(&self) -> bool {
+ if let Some(erc721_metadata) =
+ pallet_common::Pallet::<T>::get_collection_property(self.id, &key::erc721_metadata())
+ {
+ *erc721_metadata.into_inner() == *value::ERC721_METADATA_SUPPORTED
+ } else {
+ false
+ }
+ }
+}
+
#[solidity_interface(
name = UniqueRefungible,
is(
ERC721,
- ERC721Metadata(if(this.supports_metadata())),
ERC721Enumerable,
ERC721UniqueExtensions,
ERC721Mintable,
ERC721Burnable,
Collection(via(common_mut returns CollectionHandle<T>)),
TokenProperties,
+ ERC721Metadata(if(this.supports_metadata())),
)
)]
impl<T: Config> RefungibleHandle<T> where T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]> {}
pallets/refungible/src/lib.rsdiffbeforeafterboth--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -304,18 +304,6 @@
}
}
-impl<T: Config> RefungibleHandle<T> {
- pub fn supports_metadata(&self) -> bool {
- if let Some(erc721_metadata) =
- pallet_common::Pallet::<T>::get_collection_property(self.id, &key::erc721_metadata())
- {
- *erc721_metadata.into_inner() == *value::ERC721_METADATA_SUPPORTED
- } else {
- false
- }
- }
-}
-
impl<T: Config> Deref for RefungibleHandle<T> {
type Target = pallet_common::CollectionHandle<T>;
pallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth1// 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/// @title A contract that allows to set and delete token properties and change token property permissions.21/// @dev the ERC-165 identifier for this interface is 0x4136937722contract TokenProperties is Dummy, ERC165 {23 /// @notice Set permissions for token property.24 /// @dev Throws error if `msg.sender` is not admin or owner of the collection.25 /// @param key Property key.26 /// @param isMutable Permission to mutate property.27 /// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.28 /// @param tokenOwner Permission to mutate property by token owner if property is mutable.29 /// @dev EVM selector for this function is: 0x222d97fa,30 /// or in textual repr: setTokenPropertyPermission(string,bool,bool,bool)31 function setTokenPropertyPermission(32 string memory key,33 bool isMutable,34 bool collectionAdmin,35 bool tokenOwner36 ) public {37 require(false, stub_error);38 key;39 isMutable;40 collectionAdmin;41 tokenOwner;42 dummy = 0;43 }4445 /// @notice Set token property value.46 /// @dev Throws error if `msg.sender` has no permission to edit the property.47 /// @param tokenId ID of the token.48 /// @param key Property key.49 /// @param value Property value.50 /// @dev EVM selector for this function is: 0x1752d67b,51 /// or in textual repr: setProperty(uint256,string,bytes)52 function setProperty(53 uint256 tokenId,54 string memory key,55 bytes memory value56 ) public {57 require(false, stub_error);58 tokenId;59 key;60 value;61 dummy = 0;62 }6364 /// @notice Delete token property value.65 /// @dev Throws error if `msg.sender` has no permission to edit the property.66 /// @param tokenId ID of the token.67 /// @param key Property key.68 /// @dev EVM selector for this function is: 0x066111d1,69 /// or in textual repr: deleteProperty(uint256,string)70 function deleteProperty(uint256 tokenId, string memory key) public {71 require(false, stub_error);72 tokenId;73 key;74 dummy = 0;75 }7677 /// @notice Get token property value.78 /// @dev Throws error if key not found79 /// @param tokenId ID of the token.80 /// @param key Property key.81 /// @return Property value bytes82 /// @dev EVM selector for this function is: 0x7228c327,83 /// or in textual repr: property(uint256,string)84 function property(uint256 tokenId, string memory key) public view returns (bytes memory) {85 require(false, stub_error);86 tokenId;87 key;88 dummy;89 return hex"";90 }91}9293/// @title A contract that allows you to work with collections.94/// @dev the ERC-165 identifier for this interface is 0x3e1e808395contract Collection is Dummy, ERC165 {96 /// Set collection property.97 ///98 /// @param key Property key.99 /// @param value Propery value.100 /// @dev EVM selector for this function is: 0x2f073f66,101 /// or in textual repr: setCollectionProperty(string,bytes)102 function setCollectionProperty(string memory key, bytes memory value) public {103 require(false, stub_error);104 key;105 value;106 dummy = 0;107 }108109 /// Delete collection property.110 ///111 /// @param key Property key.112 /// @dev EVM selector for this function is: 0x7b7debce,113 /// or in textual repr: deleteCollectionProperty(string)114 function deleteCollectionProperty(string memory key) public {115 require(false, stub_error);116 key;117 dummy = 0;118 }119120 /// Get collection property.121 ///122 /// @dev Throws error if key not found.123 ///124 /// @param key Property key.125 /// @return bytes The property corresponding to the key.126 /// @dev EVM selector for this function is: 0xcf24fd6d,127 /// or in textual repr: collectionProperty(string)128 function collectionProperty(string memory key) public view returns (bytes memory) {129 require(false, stub_error);130 key;131 dummy;132 return hex"";133 }134135 /// Set the sponsor of the collection.136 ///137 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.138 ///139 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.140 /// @dev EVM selector for this function is: 0x7623402e,141 /// or in textual repr: setCollectionSponsor(address)142 function setCollectionSponsor(address sponsor) public {143 require(false, stub_error);144 sponsor;145 dummy = 0;146 }147148 /// Whether there is a pending sponsor.149 /// @dev EVM selector for this function is: 0x058ac185,150 /// or in textual repr: hasCollectionPendingSponsor()151 function hasCollectionPendingSponsor() public view returns (bool) {152 require(false, stub_error);153 dummy;154 return false;155 }156157 /// Collection sponsorship confirmation.158 ///159 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.160 /// @dev EVM selector for this function is: 0x3c50e97a,161 /// or in textual repr: confirmCollectionSponsorship()162 function confirmCollectionSponsorship() public {163 require(false, stub_error);164 dummy = 0;165 }166167 /// Remove collection sponsor.168 /// @dev EVM selector for this function is: 0x6e0326a3,169 /// or in textual repr: removeCollectionSponsor()170 function removeCollectionSponsor() public {171 require(false, stub_error);172 dummy = 0;173 }174175 /// Get current sponsor.176 ///177 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.178 /// @dev EVM selector for this function is: 0x6ec0a9f1,179 /// or in textual repr: collectionSponsor()180 function collectionSponsor() public view returns (Tuple17 memory) {181 require(false, stub_error);182 dummy;183 return Tuple17(0x0000000000000000000000000000000000000000, 0);184 }185186 /// Set limits for the collection.187 /// @dev Throws error if limit not found.188 /// @param limit Name of the limit. Valid names:189 /// "accountTokenOwnershipLimit",190 /// "sponsoredDataSize",191 /// "sponsoredDataRateLimit",192 /// "tokenLimit",193 /// "sponsorTransferTimeout",194 /// "sponsorApproveTimeout"195 /// @param value Value of the limit.196 /// @dev EVM selector for this function is: 0x6a3841db,197 /// or in textual repr: setCollectionLimit(string,uint32)198 function setCollectionLimit(string memory limit, uint32 value) public {199 require(false, stub_error);200 limit;201 value;202 dummy = 0;203 }204205 /// Set limits for the collection.206 /// @dev Throws error if limit not found.207 /// @param limit Name of the limit. Valid names:208 /// "ownerCanTransfer",209 /// "ownerCanDestroy",210 /// "transfersEnabled"211 /// @param value Value of the limit.212 /// @dev EVM selector for this function is: 0x993b7fba,213 /// or in textual repr: setCollectionLimit(string,bool)214 function setCollectionLimit(string memory limit, bool value) public {215 require(false, stub_error);216 limit;217 value;218 dummy = 0;219 }220221 /// Get contract address.222 /// @dev EVM selector for this function is: 0xf6b4dfb4,223 /// or in textual repr: contractAddress()224 function contractAddress() public view returns (address) {225 require(false, stub_error);226 dummy;227 return 0x0000000000000000000000000000000000000000;228 }229230 /// Add collection admin.231 /// @param newAdmin Address of the added administrator.232 /// @dev EVM selector for this function is: 0x92e462c7,233 /// or in textual repr: addCollectionAdmin(address)234 function addCollectionAdmin(address newAdmin) public {235 require(false, stub_error);236 newAdmin;237 dummy = 0;238 }239240 /// Remove collection admin.241 ///242 /// @param admin Address of the removed administrator.243 /// @dev EVM selector for this function is: 0xfafd7b42,244 /// or in textual repr: removeCollectionAdmin(address)245 function removeCollectionAdmin(address admin) public {246 require(false, stub_error);247 admin;248 dummy = 0;249 }250251 /// Toggle accessibility of collection nesting.252 ///253 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'254 /// @dev EVM selector for this function is: 0x112d4586,255 /// or in textual repr: setCollectionNesting(bool)256 function setCollectionNesting(bool enable) public {257 require(false, stub_error);258 enable;259 dummy = 0;260 }261262 /// Toggle accessibility of collection nesting.263 ///264 /// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'265 /// @param collections Addresses of collections that will be available for nesting.266 /// @dev EVM selector for this function is: 0x64872396,267 /// or in textual repr: setCollectionNesting(bool,address[])268 function setCollectionNesting(bool enable, address[] memory collections) public {269 require(false, stub_error);270 enable;271 collections;272 dummy = 0;273 }274275 /// Set the collection access method.276 /// @param mode Access mode277 /// 0 for Normal278 /// 1 for AllowList279 /// @dev EVM selector for this function is: 0x41835d4c,280 /// or in textual repr: setCollectionAccess(uint8)281 function setCollectionAccess(uint8 mode) public {282 require(false, stub_error);283 mode;284 dummy = 0;285 }286287 /// Checks that user allowed to operate with collection.288 ///289 /// @param user User address to check.290 /// @dev EVM selector for this function is: 0xd63a8e11,291 /// or in textual repr: allowed(address)292 function allowed(address user) public view returns (bool) {293 require(false, stub_error);294 user;295 dummy;296 return false;297 }298299 /// Add the user to the allowed list.300 ///301 /// @param user Address of a trusted user.302 /// @dev EVM selector for this function is: 0x67844fe6,303 /// or in textual repr: addToCollectionAllowList(address)304 function addToCollectionAllowList(address user) public {305 require(false, stub_error);306 user;307 dummy = 0;308 }309310 /// Remove the user from the allowed list.311 ///312 /// @param user Address of a removed user.313 /// @dev EVM selector for this function is: 0x85c51acb,314 /// or in textual repr: removeFromCollectionAllowList(address)315 function removeFromCollectionAllowList(address user) public {316 require(false, stub_error);317 user;318 dummy = 0;319 }320321 /// Switch permission for minting.322 ///323 /// @param mode Enable if "true".324 /// @dev EVM selector for this function is: 0x00018e84,325 /// or in textual repr: setCollectionMintMode(bool)326 function setCollectionMintMode(bool mode) public {327 require(false, stub_error);328 mode;329 dummy = 0;330 }331332 /// Check that account is the owner or admin of the collection333 ///334 /// @param user account to verify335 /// @return "true" if account is the owner or admin336 /// @dev EVM selector for this function is: 0x9811b0c7,337 /// or in textual repr: isOwnerOrAdmin(address)338 function isOwnerOrAdmin(address user) public view returns (bool) {339 require(false, stub_error);340 user;341 dummy;342 return false;343 }344345 /// Returns collection type346 ///347 /// @return `Fungible` or `NFT` or `ReFungible`348 /// @dev EVM selector for this function is: 0xd34b55b8,349 /// or in textual repr: uniqueCollectionType()350 function uniqueCollectionType() public view returns (string memory) {351 require(false, stub_error);352 dummy;353 return "";354 }355356 /// Get collection owner.357 ///358 /// @return Tuble with sponsor address and his substrate mirror.359 /// If address is canonical then substrate mirror is zero and vice versa.360 /// @dev EVM selector for this function is: 0xdf727d3b,361 /// or in textual repr: collectionOwner()362 function collectionOwner() public view returns (Tuple17 memory) {363 require(false, stub_error);364 dummy;365 return Tuple17(0x0000000000000000000000000000000000000000, 0);366 }367368 /// Changes collection owner to another account369 ///370 /// @dev Owner can be changed only by current owner371 /// @param newOwner new owner account372 /// @dev EVM selector for this function is: 0x13af4035,373 /// or in textual repr: setOwner(address)374 function setOwner(address newOwner) public {375 require(false, stub_error);376 newOwner;377 dummy = 0;378 }379}380381/// @dev anonymous struct382struct Tuple17 {383 address field_0;384 uint256 field_1;385}386387/// @title ERC721 Token that can be irreversibly burned (destroyed).388/// @dev the ERC-165 identifier for this interface is 0x42966c68389contract ERC721Burnable is Dummy, ERC165 {390 /// @notice Burns a specific ERC721 token.391 /// @dev Throws unless `msg.sender` is the current RFT owner, or an authorized392 /// operator of the current owner.393 /// @param tokenId The RFT to approve394 /// @dev EVM selector for this function is: 0x42966c68,395 /// or in textual repr: burn(uint256)396 function burn(uint256 tokenId) public {397 require(false, stub_error);398 tokenId;399 dummy = 0;400 }401}402403/// @dev inlined interface404contract ERC721MintableEvents {405 event MintingFinished();406}407408/// @title ERC721 minting logic.409/// @dev the ERC-165 identifier for this interface is 0x68ccfe89410contract ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {411 /// @dev EVM selector for this function is: 0x05d2035b,412 /// or in textual repr: mintingFinished()413 function mintingFinished() public view returns (bool) {414 require(false, stub_error);415 dummy;416 return false;417 }418419 /// @notice Function to mint token.420 /// @dev `tokenId` should be obtained with `nextTokenId` method,421 /// unlike standard, you can't specify it manually422 /// @param to The new owner423 /// @param tokenId ID of the minted RFT424 /// @dev EVM selector for this function is: 0x40c10f19,425 /// or in textual repr: mint(address,uint256)426 function mint(address to, uint256 tokenId) public returns (bool) {427 require(false, stub_error);428 to;429 tokenId;430 dummy = 0;431 return false;432 }433434 /// @notice Function to mint token with the given tokenUri.435 /// @dev `tokenId` should be obtained with `nextTokenId` method,436 /// unlike standard, you can't specify it manually437 /// @param to The new owner438 /// @param tokenId ID of the minted RFT439 /// @param tokenUri Token URI that would be stored in the RFT properties440 /// @dev EVM selector for this function is: 0x50bb4e7f,441 /// or in textual repr: mintWithTokenURI(address,uint256,string)442 function mintWithTokenURI(443 address to,444 uint256 tokenId,445 string memory tokenUri446 ) public returns (bool) {447 require(false, stub_error);448 to;449 tokenId;450 tokenUri;451 dummy = 0;452 return false;453 }454455 /// @dev Not implemented456 /// @dev EVM selector for this function is: 0x7d64bcb4,457 /// or in textual repr: finishMinting()458 function finishMinting() public returns (bool) {459 require(false, stub_error);460 dummy = 0;461 return false;462 }463}464465/// @title Unique extensions for ERC721.466/// @dev the ERC-165 identifier for this interface is 0x7c3bef89467contract ERC721UniqueExtensions is Dummy, ERC165 {468 /// @notice Transfer ownership of an RFT469 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`470 /// is the zero address. Throws if `tokenId` is not a valid RFT.471 /// Throws if RFT pieces have multiple owners.472 /// @param to The new owner473 /// @param tokenId The RFT to transfer474 /// @dev EVM selector for this function is: 0xa9059cbb,475 /// or in textual repr: transfer(address,uint256)476 function transfer(address to, uint256 tokenId) public {477 require(false, stub_error);478 to;479 tokenId;480 dummy = 0;481 }482483 /// @notice Burns a specific ERC721 token.484 /// @dev Throws unless `msg.sender` is the current owner or an authorized485 /// operator for this RFT. Throws if `from` is not the current owner. Throws486 /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.487 /// Throws if RFT pieces have multiple owners.488 /// @param from The current owner of the RFT489 /// @param tokenId The RFT to transfer490 /// @dev EVM selector for this function is: 0x79cc6790,491 /// or in textual repr: burnFrom(address,uint256)492 function burnFrom(address from, uint256 tokenId) public {493 require(false, stub_error);494 from;495 tokenId;496 dummy = 0;497 }498499 /// @notice Returns next free RFT ID.500 /// @dev EVM selector for this function is: 0x75794a3c,501 /// or in textual repr: nextTokenId()502 function nextTokenId() public view returns (uint256) {503 require(false, stub_error);504 dummy;505 return 0;506 }507508 /// @notice Function to mint multiple tokens.509 /// @dev `tokenIds` should be an array of consecutive numbers and first number510 /// should be obtained with `nextTokenId` method511 /// @param to The new owner512 /// @param tokenIds IDs of the minted RFTs513 /// @dev EVM selector for this function is: 0x44a9945e,514 /// or in textual repr: mintBulk(address,uint256[])515 function mintBulk(address to, uint256[] memory tokenIds) public returns (bool) {516 require(false, stub_error);517 to;518 tokenIds;519 dummy = 0;520 return false;521 }522523 /// @notice Function to mint multiple tokens with the given tokenUris.524 /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive525 /// numbers and first number should be obtained with `nextTokenId` method526 /// @param to The new owner527 /// @param tokens array of pairs of token ID and token URI for minted tokens528 /// @dev EVM selector for this function is: 0x36543006,529 /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])530 function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) public returns (bool) {531 require(false, stub_error);532 to;533 tokens;534 dummy = 0;535 return false;536 }537538 /// Returns EVM address for refungible token539 ///540 /// @param token ID of the token541 /// @dev EVM selector for this function is: 0xab76fac6,542 /// or in textual repr: tokenContractAddress(uint256)543 function tokenContractAddress(uint256 token) public view returns (address) {544 require(false, stub_error);545 token;546 dummy;547 return 0x0000000000000000000000000000000000000000;548 }549}550551/// @dev anonymous struct552struct Tuple8 {553 uint256 field_0;554 string field_1;555}556557/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension558/// @dev See https://eips.ethereum.org/EIPS/eip-721559/// @dev the ERC-165 identifier for this interface is 0x780e9d63560contract ERC721Enumerable is Dummy, ERC165 {561 /// @notice Enumerate valid RFTs562 /// @param index A counter less than `totalSupply()`563 /// @return The token identifier for the `index`th NFT,564 /// (sort order not specified)565 /// @dev EVM selector for this function is: 0x4f6ccce7,566 /// or in textual repr: tokenByIndex(uint256)567 function tokenByIndex(uint256 index) public view returns (uint256) {568 require(false, stub_error);569 index;570 dummy;571 return 0;572 }573574 /// Not implemented575 /// @dev EVM selector for this function is: 0x2f745c59,576 /// or in textual repr: tokenOfOwnerByIndex(address,uint256)577 function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {578 require(false, stub_error);579 owner;580 index;581 dummy;582 return 0;583 }584585 /// @notice Count RFTs tracked by this contract586 /// @return A count of valid RFTs tracked by this contract, where each one of587 /// them has an assigned and queryable owner not equal to the zero address588 /// @dev EVM selector for this function is: 0x18160ddd,589 /// or in textual repr: totalSupply()590 function totalSupply() public view returns (uint256) {591 require(false, stub_error);592 dummy;593 return 0;594 }595}596597/// @dev the ERC-165 identifier for this interface is 0x5b5e139f598contract ERC721Metadata is Dummy, ERC165 {599 /// @notice A descriptive name for a collection of RFTs in this contract600 /// @dev EVM selector for this function is: 0x06fdde03,601 /// or in textual repr: name()602 function name() public view returns (string memory) {603 require(false, stub_error);604 dummy;605 return "";606 }607608 /// @notice An abbreviated name for RFTs in this contract609 /// @dev EVM selector for this function is: 0x95d89b41,610 /// or in textual repr: symbol()611 function symbol() public view returns (string memory) {612 require(false, stub_error);613 dummy;614 return "";615 }616617 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.618 ///619 /// @dev If the token has a `url` property and it is not empty, it is returned.620 /// Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.621 /// If the collection property `baseURI` is empty or absent, return "" (empty string)622 /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix623 /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).624 ///625 /// @return token's const_metadata626 /// @dev EVM selector for this function is: 0xc87b56dd,627 /// or in textual repr: tokenURI(uint256)628 function tokenURI(uint256 tokenId) public view returns (string memory) {629 require(false, stub_error);630 tokenId;631 dummy;632 return "";633 }634}635636/// @dev inlined interface637contract ERC721Events {638 event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);639 event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);640 event ApprovalForAll(address indexed owner, address indexed operator, bool approved);641}642643/// @title ERC-721 Non-Fungible Token Standard644/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md645/// @dev the ERC-165 identifier for this interface is 0x58800161646contract ERC721 is Dummy, ERC165, ERC721Events {647 /// @notice Count all RFTs assigned to an owner648 /// @dev RFTs assigned to the zero address are considered invalid, and this649 /// function throws for queries about the zero address.650 /// @param owner An address for whom to query the balance651 /// @return The number of RFTs owned by `owner`, possibly zero652 /// @dev EVM selector for this function is: 0x70a08231,653 /// or in textual repr: balanceOf(address)654 function balanceOf(address owner) public view returns (uint256) {655 require(false, stub_error);656 owner;657 dummy;658 return 0;659 }660661 /// @notice Find the owner of an RFT662 /// @dev RFTs assigned to zero address are considered invalid, and queries663 /// about them do throw.664 /// Returns special 0xffffffffffffffffffffffffffffffffffffffff address for665 /// the tokens that are partially owned.666 /// @param tokenId The identifier for an RFT667 /// @return The address of the owner of the RFT668 /// @dev EVM selector for this function is: 0x6352211e,669 /// or in textual repr: ownerOf(uint256)670 function ownerOf(uint256 tokenId) public view returns (address) {671 require(false, stub_error);672 tokenId;673 dummy;674 return 0x0000000000000000000000000000000000000000;675 }676677 /// @dev Not implemented678 /// @dev EVM selector for this function is: 0x60a11672,679 /// or in textual repr: safeTransferFromWithData(address,address,uint256,bytes)680 function safeTransferFromWithData(681 address from,682 address to,683 uint256 tokenId,684 bytes memory data685 ) public {686 require(false, stub_error);687 from;688 to;689 tokenId;690 data;691 dummy = 0;692 }693694 /// @dev Not implemented695 /// @dev EVM selector for this function is: 0x42842e0e,696 /// or in textual repr: safeTransferFrom(address,address,uint256)697 function safeTransferFrom(698 address from,699 address to,700 uint256 tokenId701 ) public {702 require(false, stub_error);703 from;704 to;705 tokenId;706 dummy = 0;707 }708709 /// @notice Transfer ownership of an RFT -- THE CALLER IS RESPONSIBLE710 /// TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE711 /// THEY MAY BE PERMANENTLY LOST712 /// @dev Throws unless `msg.sender` is the current owner or an authorized713 /// operator for this RFT. Throws if `from` is not the current owner. Throws714 /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.715 /// Throws if RFT pieces have multiple owners.716 /// @param from The current owner of the NFT717 /// @param to The new owner718 /// @param tokenId The NFT to transfer719 /// @dev EVM selector for this function is: 0x23b872dd,720 /// or in textual repr: transferFrom(address,address,uint256)721 function transferFrom(722 address from,723 address to,724 uint256 tokenId725 ) public {726 require(false, stub_error);727 from;728 to;729 tokenId;730 dummy = 0;731 }732733 /// @dev Not implemented734 /// @dev EVM selector for this function is: 0x095ea7b3,735 /// or in textual repr: approve(address,uint256)736 function approve(address approved, uint256 tokenId) public {737 require(false, stub_error);738 approved;739 tokenId;740 dummy = 0;741 }742743 /// @dev Not implemented744 /// @dev EVM selector for this function is: 0xa22cb465,745 /// or in textual repr: setApprovalForAll(address,bool)746 function setApprovalForAll(address operator, bool approved) public {747 require(false, stub_error);748 operator;749 approved;750 dummy = 0;751 }752753 /// @dev Not implemented754 /// @dev EVM selector for this function is: 0x081812fc,755 /// or in textual repr: getApproved(uint256)756 function getApproved(uint256 tokenId) public view returns (address) {757 require(false, stub_error);758 tokenId;759 dummy;760 return 0x0000000000000000000000000000000000000000;761 }762763 /// @dev Not implemented764 /// @dev EVM selector for this function is: 0xe985e9c5,765 /// or in textual repr: isApprovedForAll(address,address)766 function isApprovedForAll(address owner, address operator) public view returns (address) {767 require(false, stub_error);768 owner;769 operator;770 dummy;771 return 0x0000000000000000000000000000000000000000;772 }773}774775contract UniqueRefungible is776 Dummy,777 ERC165,778 ERC721,779 ERC721Metadata,780 ERC721Enumerable,781 ERC721UniqueExtensions,782 ERC721Mintable,783 ERC721Burnable,784 Collection,785 TokenProperties786{}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 the ERC-165 identifier for this interface is 0x5b5e139f21contract ERC721Metadata is Dummy, ERC165 {22 /// @notice A descriptive name for a collection of RFTs in this contract23 /// @dev EVM selector for this function is: 0x06fdde03,24 /// or in textual repr: name()25 function name() public view returns (string memory) {26 require(false, stub_error);27 dummy;28 return "";29 }3031 /// @notice An abbreviated name for RFTs in this contract32 /// @dev EVM selector for this function is: 0x95d89b41,33 /// or in textual repr: symbol()34 function symbol() public view returns (string memory) {35 require(false, stub_error);36 dummy;37 return "";38 }3940 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.41 ///42 /// @dev If the token has a `url` property and it is not empty, it is returned.43 /// Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.44 /// If the collection property `baseURI` is empty or absent, return "" (empty string)45 /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix46 /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).47 ///48 /// @return token's const_metadata49 /// @dev EVM selector for this function is: 0xc87b56dd,50 /// or in textual repr: tokenURI(uint256)51 function tokenURI(uint256 tokenId) public view returns (string memory) {52 require(false, stub_error);53 tokenId;54 dummy;55 return "";56 }57}5859/// @title A contract that allows to set and delete token properties and change token property permissions.60/// @dev the ERC-165 identifier for this interface is 0x4136937761contract TokenProperties is Dummy, ERC165 {62 /// @notice Set permissions for token property.63 /// @dev Throws error if `msg.sender` is not admin or owner of the collection.64 /// @param key Property key.65 /// @param isMutable Permission to mutate property.66 /// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.67 /// @param tokenOwner Permission to mutate property by token owner if property is mutable.68 /// @dev EVM selector for this function is: 0x222d97fa,69 /// or in textual repr: setTokenPropertyPermission(string,bool,bool,bool)70 function setTokenPropertyPermission(71 string memory key,72 bool isMutable,73 bool collectionAdmin,74 bool tokenOwner75 ) public {76 require(false, stub_error);77 key;78 isMutable;79 collectionAdmin;80 tokenOwner;81 dummy = 0;82 }8384 /// @notice Set token property value.85 /// @dev Throws error if `msg.sender` has no permission to edit the property.86 /// @param tokenId ID of the token.87 /// @param key Property key.88 /// @param value Property value.89 /// @dev EVM selector for this function is: 0x1752d67b,90 /// or in textual repr: setProperty(uint256,string,bytes)91 function setProperty(92 uint256 tokenId,93 string memory key,94 bytes memory value95 ) public {96 require(false, stub_error);97 tokenId;98 key;99 value;100 dummy = 0;101 }102103 /// @notice Delete token property value.104 /// @dev Throws error if `msg.sender` has no permission to edit the property.105 /// @param tokenId ID of the token.106 /// @param key Property key.107 /// @dev EVM selector for this function is: 0x066111d1,108 /// or in textual repr: deleteProperty(uint256,string)109 function deleteProperty(uint256 tokenId, string memory key) public {110 require(false, stub_error);111 tokenId;112 key;113 dummy = 0;114 }115116 /// @notice Get token property value.117 /// @dev Throws error if key not found118 /// @param tokenId ID of the token.119 /// @param key Property key.120 /// @return Property value bytes121 /// @dev EVM selector for this function is: 0x7228c327,122 /// or in textual repr: property(uint256,string)123 function property(uint256 tokenId, string memory key) public view returns (bytes memory) {124 require(false, stub_error);125 tokenId;126 key;127 dummy;128 return hex"";129 }130}131132/// @title A contract that allows you to work with collections.133/// @dev the ERC-165 identifier for this interface is 0x3e1e8083134contract Collection is Dummy, ERC165 {135 /// Set collection property.136 ///137 /// @param key Property key.138 /// @param value Propery value.139 /// @dev EVM selector for this function is: 0x2f073f66,140 /// or in textual repr: setCollectionProperty(string,bytes)141 function setCollectionProperty(string memory key, bytes memory value) public {142 require(false, stub_error);143 key;144 value;145 dummy = 0;146 }147148 /// Delete collection property.149 ///150 /// @param key Property key.151 /// @dev EVM selector for this function is: 0x7b7debce,152 /// or in textual repr: deleteCollectionProperty(string)153 function deleteCollectionProperty(string memory key) public {154 require(false, stub_error);155 key;156 dummy = 0;157 }158159 /// Get collection property.160 ///161 /// @dev Throws error if key not found.162 ///163 /// @param key Property key.164 /// @return bytes The property corresponding to the key.165 /// @dev EVM selector for this function is: 0xcf24fd6d,166 /// or in textual repr: collectionProperty(string)167 function collectionProperty(string memory key) public view returns (bytes memory) {168 require(false, stub_error);169 key;170 dummy;171 return hex"";172 }173174 /// Set the sponsor of the collection.175 ///176 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.177 ///178 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.179 /// @dev EVM selector for this function is: 0x7623402e,180 /// or in textual repr: setCollectionSponsor(address)181 function setCollectionSponsor(address sponsor) public {182 require(false, stub_error);183 sponsor;184 dummy = 0;185 }186187 /// Whether there is a pending sponsor.188 /// @dev EVM selector for this function is: 0x058ac185,189 /// or in textual repr: hasCollectionPendingSponsor()190 function hasCollectionPendingSponsor() public view returns (bool) {191 require(false, stub_error);192 dummy;193 return false;194 }195196 /// Collection sponsorship confirmation.197 ///198 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.199 /// @dev EVM selector for this function is: 0x3c50e97a,200 /// or in textual repr: confirmCollectionSponsorship()201 function confirmCollectionSponsorship() public {202 require(false, stub_error);203 dummy = 0;204 }205206 /// Remove collection sponsor.207 /// @dev EVM selector for this function is: 0x6e0326a3,208 /// or in textual repr: removeCollectionSponsor()209 function removeCollectionSponsor() public {210 require(false, stub_error);211 dummy = 0;212 }213214 /// Get current sponsor.215 ///216 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.217 /// @dev EVM selector for this function is: 0x6ec0a9f1,218 /// or in textual repr: collectionSponsor()219 function collectionSponsor() public view returns (Tuple15 memory) {220 require(false, stub_error);221 dummy;222 return Tuple15(0x0000000000000000000000000000000000000000, 0);223 }224225 /// Set limits for the collection.226 /// @dev Throws error if limit not found.227 /// @param limit Name of the limit. Valid names:228 /// "accountTokenOwnershipLimit",229 /// "sponsoredDataSize",230 /// "sponsoredDataRateLimit",231 /// "tokenLimit",232 /// "sponsorTransferTimeout",233 /// "sponsorApproveTimeout"234 /// @param value Value of the limit.235 /// @dev EVM selector for this function is: 0x6a3841db,236 /// or in textual repr: setCollectionLimit(string,uint32)237 function setCollectionLimit(string memory limit, uint32 value) public {238 require(false, stub_error);239 limit;240 value;241 dummy = 0;242 }243244 /// Set limits for the collection.245 /// @dev Throws error if limit not found.246 /// @param limit Name of the limit. Valid names:247 /// "ownerCanTransfer",248 /// "ownerCanDestroy",249 /// "transfersEnabled"250 /// @param value Value of the limit.251 /// @dev EVM selector for this function is: 0x993b7fba,252 /// or in textual repr: setCollectionLimit(string,bool)253 function setCollectionLimit(string memory limit, bool value) public {254 require(false, stub_error);255 limit;256 value;257 dummy = 0;258 }259260 /// Get contract address.261 /// @dev EVM selector for this function is: 0xf6b4dfb4,262 /// or in textual repr: contractAddress()263 function contractAddress() public view returns (address) {264 require(false, stub_error);265 dummy;266 return 0x0000000000000000000000000000000000000000;267 }268269 /// Add collection admin.270 /// @param newAdmin Address of the added administrator.271 /// @dev EVM selector for this function is: 0x92e462c7,272 /// or in textual repr: addCollectionAdmin(address)273 function addCollectionAdmin(address newAdmin) public {274 require(false, stub_error);275 newAdmin;276 dummy = 0;277 }278279 /// Remove collection admin.280 ///281 /// @param admin Address of the removed administrator.282 /// @dev EVM selector for this function is: 0xfafd7b42,283 /// or in textual repr: removeCollectionAdmin(address)284 function removeCollectionAdmin(address admin) public {285 require(false, stub_error);286 admin;287 dummy = 0;288 }289290 /// Toggle accessibility of collection nesting.291 ///292 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'293 /// @dev EVM selector for this function is: 0x112d4586,294 /// or in textual repr: setCollectionNesting(bool)295 function setCollectionNesting(bool enable) public {296 require(false, stub_error);297 enable;298 dummy = 0;299 }300301 /// Toggle accessibility of collection nesting.302 ///303 /// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'304 /// @param collections Addresses of collections that will be available for nesting.305 /// @dev EVM selector for this function is: 0x64872396,306 /// or in textual repr: setCollectionNesting(bool,address[])307 function setCollectionNesting(bool enable, address[] memory collections) public {308 require(false, stub_error);309 enable;310 collections;311 dummy = 0;312 }313314 /// Set the collection access method.315 /// @param mode Access mode316 /// 0 for Normal317 /// 1 for AllowList318 /// @dev EVM selector for this function is: 0x41835d4c,319 /// or in textual repr: setCollectionAccess(uint8)320 function setCollectionAccess(uint8 mode) public {321 require(false, stub_error);322 mode;323 dummy = 0;324 }325326 /// Checks that user allowed to operate with collection.327 ///328 /// @param user User address to check.329 /// @dev EVM selector for this function is: 0xd63a8e11,330 /// or in textual repr: allowed(address)331 function allowed(address user) public view returns (bool) {332 require(false, stub_error);333 user;334 dummy;335 return false;336 }337338 /// Add the user to the allowed list.339 ///340 /// @param user Address of a trusted user.341 /// @dev EVM selector for this function is: 0x67844fe6,342 /// or in textual repr: addToCollectionAllowList(address)343 function addToCollectionAllowList(address user) public {344 require(false, stub_error);345 user;346 dummy = 0;347 }348349 /// Remove the user from the allowed list.350 ///351 /// @param user Address of a removed user.352 /// @dev EVM selector for this function is: 0x85c51acb,353 /// or in textual repr: removeFromCollectionAllowList(address)354 function removeFromCollectionAllowList(address user) public {355 require(false, stub_error);356 user;357 dummy = 0;358 }359360 /// Switch permission for minting.361 ///362 /// @param mode Enable if "true".363 /// @dev EVM selector for this function is: 0x00018e84,364 /// or in textual repr: setCollectionMintMode(bool)365 function setCollectionMintMode(bool mode) public {366 require(false, stub_error);367 mode;368 dummy = 0;369 }370371 /// Check that account is the owner or admin of the collection372 ///373 /// @param user account to verify374 /// @return "true" if account is the owner or admin375 /// @dev EVM selector for this function is: 0x9811b0c7,376 /// or in textual repr: isOwnerOrAdmin(address)377 function isOwnerOrAdmin(address user) public view returns (bool) {378 require(false, stub_error);379 user;380 dummy;381 return false;382 }383384 /// Returns collection type385 ///386 /// @return `Fungible` or `NFT` or `ReFungible`387 /// @dev EVM selector for this function is: 0xd34b55b8,388 /// or in textual repr: uniqueCollectionType()389 function uniqueCollectionType() public view returns (string memory) {390 require(false, stub_error);391 dummy;392 return "";393 }394395 /// Get collection owner.396 ///397 /// @return Tuble with sponsor address and his substrate mirror.398 /// If address is canonical then substrate mirror is zero and vice versa.399 /// @dev EVM selector for this function is: 0xdf727d3b,400 /// or in textual repr: collectionOwner()401 function collectionOwner() public view returns (Tuple15 memory) {402 require(false, stub_error);403 dummy;404 return Tuple15(0x0000000000000000000000000000000000000000, 0);405 }406407 /// Changes collection owner to another account408 ///409 /// @dev Owner can be changed only by current owner410 /// @param newOwner new owner account411 /// @dev EVM selector for this function is: 0x13af4035,412 /// or in textual repr: setOwner(address)413 function setOwner(address newOwner) public {414 require(false, stub_error);415 newOwner;416 dummy = 0;417 }418}419420/// @dev anonymous struct421struct Tuple15 {422 address field_0;423 uint256 field_1;424}425426/// @title ERC721 Token that can be irreversibly burned (destroyed).427/// @dev the ERC-165 identifier for this interface is 0x42966c68428contract ERC721Burnable is Dummy, ERC165 {429 /// @notice Burns a specific ERC721 token.430 /// @dev Throws unless `msg.sender` is the current RFT owner, or an authorized431 /// operator of the current owner.432 /// @param tokenId The RFT to approve433 /// @dev EVM selector for this function is: 0x42966c68,434 /// or in textual repr: burn(uint256)435 function burn(uint256 tokenId) public {436 require(false, stub_error);437 tokenId;438 dummy = 0;439 }440}441442/// @dev inlined interface443contract ERC721MintableEvents {444 event MintingFinished();445}446447/// @title ERC721 minting logic.448/// @dev the ERC-165 identifier for this interface is 0x68ccfe89449contract ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {450 /// @dev EVM selector for this function is: 0x05d2035b,451 /// or in textual repr: mintingFinished()452 function mintingFinished() public view returns (bool) {453 require(false, stub_error);454 dummy;455 return false;456 }457458 /// @notice Function to mint token.459 /// @dev `tokenId` should be obtained with `nextTokenId` method,460 /// unlike standard, you can't specify it manually461 /// @param to The new owner462 /// @param tokenId ID of the minted RFT463 /// @dev EVM selector for this function is: 0x40c10f19,464 /// or in textual repr: mint(address,uint256)465 function mint(address to, uint256 tokenId) public returns (bool) {466 require(false, stub_error);467 to;468 tokenId;469 dummy = 0;470 return false;471 }472473 /// @notice Function to mint token with the given tokenUri.474 /// @dev `tokenId` should be obtained with `nextTokenId` method,475 /// unlike standard, you can't specify it manually476 /// @param to The new owner477 /// @param tokenId ID of the minted RFT478 /// @param tokenUri Token URI that would be stored in the RFT properties479 /// @dev EVM selector for this function is: 0x50bb4e7f,480 /// or in textual repr: mintWithTokenURI(address,uint256,string)481 function mintWithTokenURI(482 address to,483 uint256 tokenId,484 string memory tokenUri485 ) public returns (bool) {486 require(false, stub_error);487 to;488 tokenId;489 tokenUri;490 dummy = 0;491 return false;492 }493494 /// @dev Not implemented495 /// @dev EVM selector for this function is: 0x7d64bcb4,496 /// or in textual repr: finishMinting()497 function finishMinting() public returns (bool) {498 require(false, stub_error);499 dummy = 0;500 return false;501 }502}503504/// @title Unique extensions for ERC721.505/// @dev the ERC-165 identifier for this interface is 0x7c3bef89506contract ERC721UniqueExtensions is Dummy, ERC165 {507 /// @notice Transfer ownership of an RFT508 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`509 /// is the zero address. Throws if `tokenId` is not a valid RFT.510 /// Throws if RFT pieces have multiple owners.511 /// @param to The new owner512 /// @param tokenId The RFT to transfer513 /// @dev EVM selector for this function is: 0xa9059cbb,514 /// or in textual repr: transfer(address,uint256)515 function transfer(address to, uint256 tokenId) public {516 require(false, stub_error);517 to;518 tokenId;519 dummy = 0;520 }521522 /// @notice Burns a specific ERC721 token.523 /// @dev Throws unless `msg.sender` is the current owner or an authorized524 /// operator for this RFT. Throws if `from` is not the current owner. Throws525 /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.526 /// Throws if RFT pieces have multiple owners.527 /// @param from The current owner of the RFT528 /// @param tokenId The RFT to transfer529 /// @dev EVM selector for this function is: 0x79cc6790,530 /// or in textual repr: burnFrom(address,uint256)531 function burnFrom(address from, uint256 tokenId) public {532 require(false, stub_error);533 from;534 tokenId;535 dummy = 0;536 }537538 /// @notice Returns next free RFT ID.539 /// @dev EVM selector for this function is: 0x75794a3c,540 /// or in textual repr: nextTokenId()541 function nextTokenId() public view returns (uint256) {542 require(false, stub_error);543 dummy;544 return 0;545 }546547 /// @notice Function to mint multiple tokens.548 /// @dev `tokenIds` should be an array of consecutive numbers and first number549 /// should be obtained with `nextTokenId` method550 /// @param to The new owner551 /// @param tokenIds IDs of the minted RFTs552 /// @dev EVM selector for this function is: 0x44a9945e,553 /// or in textual repr: mintBulk(address,uint256[])554 function mintBulk(address to, uint256[] memory tokenIds) public returns (bool) {555 require(false, stub_error);556 to;557 tokenIds;558 dummy = 0;559 return false;560 }561562 /// @notice Function to mint multiple tokens with the given tokenUris.563 /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive564 /// numbers and first number should be obtained with `nextTokenId` method565 /// @param to The new owner566 /// @param tokens array of pairs of token ID and token URI for minted tokens567 /// @dev EVM selector for this function is: 0x36543006,568 /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])569 function mintBulkWithTokenURI(address to, Tuple6[] memory tokens) public returns (bool) {570 require(false, stub_error);571 to;572 tokens;573 dummy = 0;574 return false;575 }576577 /// Returns EVM address for refungible token578 ///579 /// @param token ID of the token580 /// @dev EVM selector for this function is: 0xab76fac6,581 /// or in textual repr: tokenContractAddress(uint256)582 function tokenContractAddress(uint256 token) public view returns (address) {583 require(false, stub_error);584 token;585 dummy;586 return 0x0000000000000000000000000000000000000000;587 }588}589590/// @dev anonymous struct591struct Tuple6 {592 uint256 field_0;593 string field_1;594}595596/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension597/// @dev See https://eips.ethereum.org/EIPS/eip-721598/// @dev the ERC-165 identifier for this interface is 0x780e9d63599contract ERC721Enumerable is Dummy, ERC165 {600 /// @notice Enumerate valid RFTs601 /// @param index A counter less than `totalSupply()`602 /// @return The token identifier for the `index`th NFT,603 /// (sort order not specified)604 /// @dev EVM selector for this function is: 0x4f6ccce7,605 /// or in textual repr: tokenByIndex(uint256)606 function tokenByIndex(uint256 index) public view returns (uint256) {607 require(false, stub_error);608 index;609 dummy;610 return 0;611 }612613 /// Not implemented614 /// @dev EVM selector for this function is: 0x2f745c59,615 /// or in textual repr: tokenOfOwnerByIndex(address,uint256)616 function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {617 require(false, stub_error);618 owner;619 index;620 dummy;621 return 0;622 }623624 /// @notice Count RFTs tracked by this contract625 /// @return A count of valid RFTs tracked by this contract, where each one of626 /// them has an assigned and queryable owner not equal to the zero address627 /// @dev EVM selector for this function is: 0x18160ddd,628 /// or in textual repr: totalSupply()629 function totalSupply() public view returns (uint256) {630 require(false, stub_error);631 dummy;632 return 0;633 }634}635636/// @dev inlined interface637contract ERC721Events {638 event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);639 event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);640 event ApprovalForAll(address indexed owner, address indexed operator, bool approved);641}642643/// @title ERC-721 Non-Fungible Token Standard644/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md645/// @dev the ERC-165 identifier for this interface is 0x58800161646contract ERC721 is Dummy, ERC165, ERC721Events {647 /// @notice Count all RFTs assigned to an owner648 /// @dev RFTs assigned to the zero address are considered invalid, and this649 /// function throws for queries about the zero address.650 /// @param owner An address for whom to query the balance651 /// @return The number of RFTs owned by `owner`, possibly zero652 /// @dev EVM selector for this function is: 0x70a08231,653 /// or in textual repr: balanceOf(address)654 function balanceOf(address owner) public view returns (uint256) {655 require(false, stub_error);656 owner;657 dummy;658 return 0;659 }660661 /// @notice Find the owner of an RFT662 /// @dev RFTs assigned to zero address are considered invalid, and queries663 /// about them do throw.664 /// Returns special 0xffffffffffffffffffffffffffffffffffffffff address for665 /// the tokens that are partially owned.666 /// @param tokenId The identifier for an RFT667 /// @return The address of the owner of the RFT668 /// @dev EVM selector for this function is: 0x6352211e,669 /// or in textual repr: ownerOf(uint256)670 function ownerOf(uint256 tokenId) public view returns (address) {671 require(false, stub_error);672 tokenId;673 dummy;674 return 0x0000000000000000000000000000000000000000;675 }676677 /// @dev Not implemented678 /// @dev EVM selector for this function is: 0x60a11672,679 /// or in textual repr: safeTransferFromWithData(address,address,uint256,bytes)680 function safeTransferFromWithData(681 address from,682 address to,683 uint256 tokenId,684 bytes memory data685 ) public {686 require(false, stub_error);687 from;688 to;689 tokenId;690 data;691 dummy = 0;692 }693694 /// @dev Not implemented695 /// @dev EVM selector for this function is: 0x42842e0e,696 /// or in textual repr: safeTransferFrom(address,address,uint256)697 function safeTransferFrom(698 address from,699 address to,700 uint256 tokenId701 ) public {702 require(false, stub_error);703 from;704 to;705 tokenId;706 dummy = 0;707 }708709 /// @notice Transfer ownership of an RFT -- THE CALLER IS RESPONSIBLE710 /// TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE711 /// THEY MAY BE PERMANENTLY LOST712 /// @dev Throws unless `msg.sender` is the current owner or an authorized713 /// operator for this RFT. Throws if `from` is not the current owner. Throws714 /// if `to` is the zero address. Throws if `tokenId` is not a valid RFT.715 /// Throws if RFT pieces have multiple owners.716 /// @param from The current owner of the NFT717 /// @param to The new owner718 /// @param tokenId The NFT to transfer719 /// @dev EVM selector for this function is: 0x23b872dd,720 /// or in textual repr: transferFrom(address,address,uint256)721 function transferFrom(722 address from,723 address to,724 uint256 tokenId725 ) public {726 require(false, stub_error);727 from;728 to;729 tokenId;730 dummy = 0;731 }732733 /// @dev Not implemented734 /// @dev EVM selector for this function is: 0x095ea7b3,735 /// or in textual repr: approve(address,uint256)736 function approve(address approved, uint256 tokenId) public {737 require(false, stub_error);738 approved;739 tokenId;740 dummy = 0;741 }742743 /// @dev Not implemented744 /// @dev EVM selector for this function is: 0xa22cb465,745 /// or in textual repr: setApprovalForAll(address,bool)746 function setApprovalForAll(address operator, bool approved) public {747 require(false, stub_error);748 operator;749 approved;750 dummy = 0;751 }752753 /// @dev Not implemented754 /// @dev EVM selector for this function is: 0x081812fc,755 /// or in textual repr: getApproved(uint256)756 function getApproved(uint256 tokenId) public view returns (address) {757 require(false, stub_error);758 tokenId;759 dummy;760 return 0x0000000000000000000000000000000000000000;761 }762763 /// @dev Not implemented764 /// @dev EVM selector for this function is: 0xe985e9c5,765 /// or in textual repr: isApprovedForAll(address,address)766 function isApprovedForAll(address owner, address operator) public view returns (address) {767 require(false, stub_error);768 owner;769 operator;770 dummy;771 return 0x0000000000000000000000000000000000000000;772 }773}774775contract UniqueRefungible is776 Dummy,777 ERC165,778 ERC721,779 ERC721Enumerable,780 ERC721UniqueExtensions,781 ERC721Mintable,782 ERC721Burnable,783 Collection,784 TokenProperties,785 ERC721Metadata786{}pallets/unique/src/eth/mod.rsdiffbeforeafterboth--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -336,27 +336,6 @@
}
#[weight(<SelfWeightOf<T>>::create_collection())]
- #[deprecated(note = "mathod was renamed to `create_rft_collection`, prefer it instead")]
- fn create_refungible_collection(
- &mut self,
- caller: caller,
- value: value,
- name: string,
- description: string,
- token_prefix: string,
- ) -> Result<address> {
- create_refungible_collection_internal::<T>(
- caller,
- value,
- name,
- description,
- token_prefix,
- Default::default(),
- false,
- )
- }
-
- #[weight(<SelfWeightOf<T>>::create_collection())]
#[solidity(rename_selector = "createERC721MetadataCompatibleRFTCollection")]
fn create_refungible_collection_with_properties(
&mut self,
pallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterbothbinary blob — no preview
pallets/unique/src/eth/stubs/CollectionHelpers.soldiffbeforeafterboth--- a/pallets/unique/src/eth/stubs/CollectionHelpers.sol
+++ b/pallets/unique/src/eth/stubs/CollectionHelpers.sol
@@ -23,7 +23,7 @@
}
/// @title Contract, which allows users to operate with collections
-/// @dev the ERC-165 identifier for this interface is 0x95eb98f4
+/// @dev the ERC-165 identifier for this interface is 0xd14d1221
contract CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {
/// Create an NFT collection
/// @param name Name of the collection
@@ -85,21 +85,6 @@
/// @dev EVM selector for this function is: 0xab173450,
/// or in textual repr: createRFTCollection(string,string,string)
function createRFTCollection(
- string memory name,
- string memory description,
- string memory tokenPrefix
- ) public payable returns (address) {
- require(false, stub_error);
- name;
- description;
- tokenPrefix;
- dummy = 0;
- return 0x0000000000000000000000000000000000000000;
- }
-
- /// @dev EVM selector for this function is: 0x44a68ad5,
- /// or in textual repr: createRefungibleCollection(string,string,string)
- function createRefungibleCollection(
string memory name,
string memory description,
string memory tokenPrefix
tests/src/eth/api/CollectionHelpers.soldiffbeforeafterboth--- a/tests/src/eth/api/CollectionHelpers.sol
+++ b/tests/src/eth/api/CollectionHelpers.sol
@@ -18,7 +18,7 @@
}
/// @title Contract, which allows users to operate with collections
-/// @dev the ERC-165 identifier for this interface is 0x95eb98f4
+/// @dev the ERC-165 identifier for this interface is 0xd14d1221
interface CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {
/// Create an NFT collection
/// @param name Name of the collection
@@ -58,14 +58,6 @@
/// @dev EVM selector for this function is: 0xab173450,
/// or in textual repr: createRFTCollection(string,string,string)
function createRFTCollection(
- string memory name,
- string memory description,
- string memory tokenPrefix
- ) external payable returns (address);
-
- /// @dev EVM selector for this function is: 0x44a68ad5,
- /// or in textual repr: createRefungibleCollection(string,string,string)
- function createRefungibleCollection(
string memory name,
string memory description,
string memory tokenPrefix
tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -12,6 +12,34 @@
function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
+/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
+/// @dev See https://eips.ethereum.org/EIPS/eip-721
+/// @dev the ERC-165 identifier for this interface is 0x5b5e139f
+interface ERC721Metadata is Dummy, ERC165 {
+ /// @notice A descriptive name for a collection of NFTs in this contract
+ /// @dev EVM selector for this function is: 0x06fdde03,
+ /// or in textual repr: name()
+ function name() external view returns (string memory);
+
+ /// @notice An abbreviated name for NFTs in this contract
+ /// @dev EVM selector for this function is: 0x95d89b41,
+ /// or in textual repr: symbol()
+ function symbol() external view returns (string memory);
+
+ /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
+ ///
+ /// @dev If the token has a `url` property and it is not empty, it is returned.
+ /// Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.
+ /// If the collection property `baseURI` is empty or absent, return "" (empty string)
+ /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix
+ /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).
+ ///
+ /// @return token's const_metadata
+ /// @dev EVM selector for this function is: 0xc87b56dd,
+ /// or in textual repr: tokenURI(uint256)
+ function tokenURI(uint256 tokenId) external view returns (string memory);
+}
+
/// @title A contract that allows to set and delete token properties and change token property permissions.
/// @dev the ERC-165 identifier for this interface is 0x41369377
interface TokenProperties is Dummy, ERC165 {
@@ -120,7 +148,7 @@
/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
/// @dev EVM selector for this function is: 0x6ec0a9f1,
/// or in textual repr: collectionSponsor()
- function collectionSponsor() external view returns (Tuple17 memory);
+ function collectionSponsor() external view returns (Tuple15 memory);
/// Set limits for the collection.
/// @dev Throws error if limit not found.
@@ -237,7 +265,7 @@
/// If address is canonical then substrate mirror is zero and vice versa.
/// @dev EVM selector for this function is: 0xdf727d3b,
/// or in textual repr: collectionOwner()
- function collectionOwner() external view returns (Tuple17 memory);
+ function collectionOwner() external view returns (Tuple15 memory);
/// Changes collection owner to another account
///
@@ -249,7 +277,7 @@
}
/// @dev anonymous struct
-struct Tuple17 {
+struct Tuple15 {
address field_0;
uint256 field_1;
}
@@ -350,11 +378,11 @@
/// @param tokens array of pairs of token ID and token URI for minted tokens
/// @dev EVM selector for this function is: 0x36543006,
/// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
- function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) external returns (bool);
+ function mintBulkWithTokenURI(address to, Tuple6[] memory tokens) external returns (bool);
}
/// @dev anonymous struct
-struct Tuple8 {
+struct Tuple6 {
uint256 field_0;
string field_1;
}
@@ -383,35 +411,7 @@
/// or in textual repr: totalSupply()
function totalSupply() external view returns (uint256);
}
-
-/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
-/// @dev See https://eips.ethereum.org/EIPS/eip-721
-/// @dev the ERC-165 identifier for this interface is 0x5b5e139f
-interface ERC721Metadata is Dummy, ERC165 {
- /// @notice A descriptive name for a collection of NFTs in this contract
- /// @dev EVM selector for this function is: 0x06fdde03,
- /// or in textual repr: name()
- function name() external view returns (string memory);
- /// @notice An abbreviated name for NFTs in this contract
- /// @dev EVM selector for this function is: 0x95d89b41,
- /// or in textual repr: symbol()
- function symbol() external view returns (string memory);
-
- /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
- ///
- /// @dev If the token has a `url` property and it is not empty, it is returned.
- /// Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.
- /// If the collection property `baseURI` is empty or absent, return "" (empty string)
- /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix
- /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).
- ///
- /// @return token's const_metadata
- /// @dev EVM selector for this function is: 0xc87b56dd,
- /// or in textual repr: tokenURI(uint256)
- function tokenURI(uint256 tokenId) external view returns (string memory);
-}
-
/// @dev inlined interface
interface ERC721Events {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
@@ -507,11 +507,11 @@
Dummy,
ERC165,
ERC721,
- ERC721Metadata,
ERC721Enumerable,
ERC721UniqueExtensions,
ERC721Mintable,
ERC721Burnable,
Collection,
- TokenProperties
+ TokenProperties,
+ ERC721Metadata
{}
tests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -12,6 +12,32 @@
function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
+/// @dev the ERC-165 identifier for this interface is 0x5b5e139f
+interface ERC721Metadata is Dummy, ERC165 {
+ /// @notice A descriptive name for a collection of RFTs in this contract
+ /// @dev EVM selector for this function is: 0x06fdde03,
+ /// or in textual repr: name()
+ function name() external view returns (string memory);
+
+ /// @notice An abbreviated name for RFTs in this contract
+ /// @dev EVM selector for this function is: 0x95d89b41,
+ /// or in textual repr: symbol()
+ function symbol() external view returns (string memory);
+
+ /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
+ ///
+ /// @dev If the token has a `url` property and it is not empty, it is returned.
+ /// Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.
+ /// If the collection property `baseURI` is empty or absent, return "" (empty string)
+ /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix
+ /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).
+ ///
+ /// @return token's const_metadata
+ /// @dev EVM selector for this function is: 0xc87b56dd,
+ /// or in textual repr: tokenURI(uint256)
+ function tokenURI(uint256 tokenId) external view returns (string memory);
+}
+
/// @title A contract that allows to set and delete token properties and change token property permissions.
/// @dev the ERC-165 identifier for this interface is 0x41369377
interface TokenProperties is Dummy, ERC165 {
@@ -120,7 +146,7 @@
/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
/// @dev EVM selector for this function is: 0x6ec0a9f1,
/// or in textual repr: collectionSponsor()
- function collectionSponsor() external view returns (Tuple17 memory);
+ function collectionSponsor() external view returns (Tuple15 memory);
/// Set limits for the collection.
/// @dev Throws error if limit not found.
@@ -237,7 +263,7 @@
/// If address is canonical then substrate mirror is zero and vice versa.
/// @dev EVM selector for this function is: 0xdf727d3b,
/// or in textual repr: collectionOwner()
- function collectionOwner() external view returns (Tuple17 memory);
+ function collectionOwner() external view returns (Tuple15 memory);
/// Changes collection owner to another account
///
@@ -249,7 +275,7 @@
}
/// @dev anonymous struct
-struct Tuple17 {
+struct Tuple15 {
address field_0;
uint256 field_1;
}
@@ -352,7 +378,7 @@
/// @param tokens array of pairs of token ID and token URI for minted tokens
/// @dev EVM selector for this function is: 0x36543006,
/// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
- function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) external returns (bool);
+ function mintBulkWithTokenURI(address to, Tuple6[] memory tokens) external returns (bool);
/// Returns EVM address for refungible token
///
@@ -363,7 +389,7 @@
}
/// @dev anonymous struct
-struct Tuple8 {
+struct Tuple6 {
uint256 field_0;
string field_1;
}
@@ -393,32 +419,6 @@
function totalSupply() external view returns (uint256);
}
-/// @dev the ERC-165 identifier for this interface is 0x5b5e139f
-interface ERC721Metadata is Dummy, ERC165 {
- /// @notice A descriptive name for a collection of RFTs in this contract
- /// @dev EVM selector for this function is: 0x06fdde03,
- /// or in textual repr: name()
- function name() external view returns (string memory);
-
- /// @notice An abbreviated name for RFTs in this contract
- /// @dev EVM selector for this function is: 0x95d89b41,
- /// or in textual repr: symbol()
- function symbol() external view returns (string memory);
-
- /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
- ///
- /// @dev If the token has a `url` property and it is not empty, it is returned.
- /// Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.
- /// If the collection property `baseURI` is empty or absent, return "" (empty string)
- /// otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix
- /// otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).
- ///
- /// @return token's const_metadata
- /// @dev EVM selector for this function is: 0xc87b56dd,
- /// or in textual repr: tokenURI(uint256)
- function tokenURI(uint256 tokenId) external view returns (string memory);
-}
-
/// @dev inlined interface
interface ERC721Events {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
@@ -512,11 +512,11 @@
Dummy,
ERC165,
ERC721,
- ERC721Metadata,
ERC721Enumerable,
ERC721UniqueExtensions,
ERC721Mintable,
ERC721Burnable,
Collection,
- TokenProperties
+ TokenProperties,
+ ERC721Metadata
{}
tests/src/eth/collectionHelpersAbi.jsondiffbeforeafterboth--- a/tests/src/eth/collectionHelpersAbi.json
+++ b/tests/src/eth/collectionHelpersAbi.json
@@ -84,17 +84,6 @@
},
{
"inputs": [
- { "internalType": "string", "name": "name", "type": "string" },
- { "internalType": "string", "name": "description", "type": "string" },
- { "internalType": "string", "name": "tokenPrefix", "type": "string" }
- ],
- "name": "createRefungibleCollection",
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
- "stateMutability": "payable",
- "type": "function"
- },
- {
- "inputs": [
{
"internalType": "address",
"name": "collectionAddress",
tests/src/eth/collectionProperties.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionProperties.test.ts
+++ b/tests/src/eth/collectionProperties.test.ts
@@ -1,5 +1,6 @@
import {itEth, usingEthPlaygrounds, expect} from './util/playgrounds';
import {IKeyringPair} from '@polkadot/types/types';
+import {Pallets} from '../util/playgrounds';
describe('EVM collection properties', () => {
let donor: IKeyringPair;
@@ -80,7 +81,7 @@
expect(await contract.methods.supportsInterface('0x5b5e139f').call()).to.be.false;
});
- itEth('ERC721Metadata property can be set for RFT collection', async({helper}) => {
+ itEth.ifWithPallets('ERC721Metadata property can be set for RFT collection', [Pallets.ReFungible], async({helper}) => {
const caller = await helper.eth.createAccountWithBalance(donor);
const collection = await helper.rft.mintCollection(donor, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
tests/src/eth/nonFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -79,11 +79,11 @@
});
});
- async function setup(helper: EthUniqueHelper, tokenPrefix: string, propertyKey?: string, propertyValue?: string): Promise<{contract: Contract, nextTokenId: string}> {
+ async function setup(helper: EthUniqueHelper, baseUri: string, propertyKey?: string, propertyValue?: string): Promise<{contract: Contract, nextTokenId: string}> {
const owner = await helper.eth.createAccountWithBalance(donor);
const receiver = helper.eth.createAccount();
- const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'Mint collection', 'a', 'b', tokenPrefix);
+ const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'Mint collection', 'a', 'b', baseUri);
const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
const nextTokenId = await contract.methods.nextTokenId().call();
tests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -154,7 +154,7 @@
{ "internalType": "address", "name": "field_0", "type": "address" },
{ "internalType": "uint256", "name": "field_1", "type": "uint256" }
],
- "internalType": "struct Tuple17",
+ "internalType": "struct Tuple15",
"name": "",
"type": "tuple"
}
@@ -178,7 +178,7 @@
{ "internalType": "address", "name": "field_0", "type": "address" },
{ "internalType": "uint256", "name": "field_1", "type": "uint256" }
],
- "internalType": "struct Tuple17",
+ "internalType": "struct Tuple15",
"name": "",
"type": "tuple"
}
@@ -287,7 +287,7 @@
{ "internalType": "uint256", "name": "field_0", "type": "uint256" },
{ "internalType": "string", "name": "field_1", "type": "string" }
],
- "internalType": "struct Tuple8[]",
+ "internalType": "struct Tuple6[]",
"name": "tokens",
"type": "tuple[]"
}
tests/src/eth/reFungibleAbi.jsondiffbeforeafterboth--- a/tests/src/eth/reFungibleAbi.json
+++ b/tests/src/eth/reFungibleAbi.json
@@ -154,7 +154,7 @@
{ "internalType": "address", "name": "field_0", "type": "address" },
{ "internalType": "uint256", "name": "field_1", "type": "uint256" }
],
- "internalType": "struct Tuple17",
+ "internalType": "struct Tuple15",
"name": "",
"type": "tuple"
}
@@ -178,7 +178,7 @@
{ "internalType": "address", "name": "field_0", "type": "address" },
{ "internalType": "uint256", "name": "field_1", "type": "uint256" }
],
- "internalType": "struct Tuple17",
+ "internalType": "struct Tuple15",
"name": "",
"type": "tuple"
}
@@ -287,7 +287,7 @@
{ "internalType": "uint256", "name": "field_0", "type": "uint256" },
{ "internalType": "string", "name": "field_1", "type": "string" }
],
- "internalType": "struct Tuple8[]",
+ "internalType": "struct Tuple6[]",
"name": "tokens",
"type": "tuple[]"
}
tests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth--- a/tests/src/eth/reFungibleToken.test.ts
+++ b/tests/src/eth/reFungibleToken.test.ts
@@ -76,11 +76,11 @@
});
});
- async function setup(helper: EthUniqueHelper, tokenPrefix: string, propertyKey?: string, propertyValue?: string): Promise<{contract: Contract, nextTokenId: string}> {
+ async function setup(helper: EthUniqueHelper, baseUri: string, propertyKey?: string, propertyValue?: string): Promise<{contract: Contract, nextTokenId: string}> {
const owner = await helper.eth.createAccountWithBalance(donor);
const receiver = helper.eth.createAccount();
- const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, 'Mint collection', 'a', 'b', tokenPrefix);
+ const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, 'Mint collection', 'a', 'b', baseUri);
const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);
const nextTokenId = await contract.methods.nextTokenId().call();