git.delta.rocks / unique-network / refs/commits / c4af3bbf1360

difftreelog

Merge pull request #442 from UniqueNetwork/doc/nonfungible-pallet

Yaroslav Bolyukin2022-07-21parents: #3750ef0 #4bd95ca.patch.diff
in: master

6 files changed

modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
133 }133 }
134}134}
135135
136/// Implementation of `CommonCollectionOperations` for `NonfungibleHandle`. It wraps Nonfungible Pallete
137/// methods and adds weight info.
136impl<T: Config> CommonCollectionOperations<T> for NonfungibleHandle<T> {138impl<T: Config> CommonCollectionOperations<T> for NonfungibleHandle<T> {
137 fn create_item(139 fn create_item(
138 &self,140 &self,
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
16
17//! # Nonfungible Pallet EVM API
18//!
19//! Provides ERC-721 standart support implementation and EVM API for unique extensions for Nonfungible Pallet.
20//! Method implementations are mostly doing parameter conversion and calling Nonfungible Pallet methods.
1621
17extern crate alloc;22extern crate alloc;
18use core::{23use core::{
40 SelfWeightOf, weights::WeightInfo, TokenProperties,45 SelfWeightOf, weights::WeightInfo, TokenProperties,
41};46};
4247
48/// @title A contract that allows to set and delete token properties and change token property permissions.
43#[solidity_interface(name = "TokenProperties")]49#[solidity_interface(name = "TokenProperties")]
44impl<T: Config> NonfungibleHandle<T> {50impl<T: Config> NonfungibleHandle<T> {
51 /// @notice Set permissions for token property.
52 /// @dev Throws error if `msg.sender` is not admin or owner of the collection.
53 /// @param key Property key.
54 /// @param is_mutable Permission to mutate property.
55 /// @param collection_admin Permission to mutate property by collection admin if property is mutable.
56 /// @param token_owner Permission to mutate property by token owner if property is mutable.
45 fn set_token_property_permission(57 fn set_token_property_permission(
46 &mut self,58 &mut self,
47 caller: caller,59 caller: caller,
68 .map_err(dispatch_to_evm::<T>)80 .map_err(dispatch_to_evm::<T>)
69 }81 }
7082
83 /// @notice Set token property value.
84 /// @dev Throws error if `msg.sender` has no permission to edit the property.
85 /// @param tokenId ID of the token.
86 /// @param key Property key.
87 /// @param value Property value.
71 fn set_property(88 fn set_property(
72 &mut self,89 &mut self,
73 caller: caller,90 caller: caller,
96 .map_err(dispatch_to_evm::<T>)113 .map_err(dispatch_to_evm::<T>)
97 }114 }
98115
116 /// @notice Delete token property value.
117 /// @dev Throws error if `msg.sender` has no permission to edit the property.
118 /// @param tokenId ID of the token.
119 /// @param key Property key.
99 fn delete_property(&mut self, token_id: uint256, caller: caller, key: string) -> Result<()> {120 fn delete_property(&mut self, token_id: uint256, caller: caller, key: string) -> Result<()> {
100 let caller = T::CrossAccountId::from_eth(caller);121 let caller = T::CrossAccountId::from_eth(caller);
101 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;122 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
111 .map_err(dispatch_to_evm::<T>)132 .map_err(dispatch_to_evm::<T>)
112 }133 }
113134
135 /// @notice Get token property value.
114 /// Throws error if key not found136 /// @dev Throws error if key not found
137 /// @param tokenId ID of the token.
138 /// @param key Property key.
139 /// @return Property value bytes
115 fn property(&self, token_id: uint256, key: string) -> Result<bytes> {140 fn property(&self, token_id: uint256, key: string) -> Result<bytes> {
116 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;141 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
117 let key = <Vec<u8>>::from(key)142 let key = <Vec<u8>>::from(key)
127152
128#[derive(ToLog)]153#[derive(ToLog)]
129pub enum ERC721Events {154pub enum ERC721Events {
155 /// @dev This emits when ownership of any NFT changes by any mechanism.
156 /// This event emits when NFTs are created (`from` == 0) and destroyed
157 /// (`to` == 0). Exception: during contract creation, any number of NFTs
158 /// may be created and assigned without emitting Transfer. At the time of
159 /// any transfer, the approved address for that NFT (if any) is reset to none.
130 Transfer {160 Transfer {
131 #[indexed]161 #[indexed]
132 from: address,162 from: address,
135 #[indexed]165 #[indexed]
136 token_id: uint256,166 token_id: uint256,
137 },167 },
168 /// @dev This emits when the approved address for an NFT is changed or
169 /// reaffirmed. The zero address indicates there is no approved address.
170 /// When a Transfer event emits, this also indicates that the approved
171 /// address for that NFT (if any) is reset to none.
138 Approval {172 Approval {
139 #[indexed]173 #[indexed]
140 owner: address,174 owner: address,
143 #[indexed]177 #[indexed]
144 token_id: uint256,178 token_id: uint256,
145 },179 },
180 /// @dev This emits when an operator is enabled or disabled for an owner.
181 /// The operator can manage all NFTs of the owner.
146 #[allow(dead_code)]182 #[allow(dead_code)]
147 ApprovalForAll {183 ApprovalForAll {
148 #[indexed]184 #[indexed]
159 MintingFinished {},195 MintingFinished {},
160}196}
161197
198/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
199/// @dev See https://eips.ethereum.org/EIPS/eip-721
162#[solidity_interface(name = "ERC721Metadata")]200#[solidity_interface(name = "ERC721Metadata")]
163impl<T: Config> NonfungibleHandle<T> {201impl<T: Config> NonfungibleHandle<T> {
202 /// @notice A descriptive name for a collection of NFTs in this contract
164 fn name(&self) -> Result<string> {203 fn name(&self) -> Result<string> {
165 Ok(decode_utf16(self.name.iter().copied())204 Ok(decode_utf16(self.name.iter().copied())
166 .map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))205 .map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))
167 .collect::<string>())206 .collect::<string>())
168 }207 }
169208
209 /// @notice An abbreviated name for NFTs in this contract
170 fn symbol(&self) -> Result<string> {210 fn symbol(&self) -> Result<string> {
171 Ok(string::from_utf8_lossy(&self.token_prefix).into())211 Ok(string::from_utf8_lossy(&self.token_prefix).into())
172 }212 }
173213
214 /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
215 /// @dev Throws if `tokenId` is not a valid NFT. URIs are defined in RFC
216 /// 3986. The URI may point to a JSON file that conforms to the "ERC721
217 /// Metadata JSON Schema".
174 /// Returns token's const_metadata218 /// @return token's const_metadata
175 #[solidity(rename_selector = "tokenURI")]219 #[solidity(rename_selector = "tokenURI")]
176 fn token_uri(&self, token_id: uint256) -> Result<string> {220 fn token_uri(&self, token_id: uint256) -> Result<string> {
177 let key = token_uri_key();221 let key = token_uri_key();
192 }236 }
193}237}
194238
239/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
240/// @dev See https://eips.ethereum.org/EIPS/eip-721
195#[solidity_interface(name = "ERC721Enumerable")]241#[solidity_interface(name = "ERC721Enumerable")]
196impl<T: Config> NonfungibleHandle<T> {242impl<T: Config> NonfungibleHandle<T> {
243 /// @notice Enumerate valid NFTs
244 /// @param index A counter less than `totalSupply()`
245 /// @return The token identifier for the `index`th NFT,
246 /// (sort order not specified)
197 fn token_by_index(&self, index: uint256) -> Result<uint256> {247 fn token_by_index(&self, index: uint256) -> Result<uint256> {
198 Ok(index)248 Ok(index)
199 }249 }
200250
201 /// Not implemented251 /// @dev Not implemented
202 fn token_of_owner_by_index(&self, _owner: address, _index: uint256) -> Result<uint256> {252 fn token_of_owner_by_index(&self, _owner: address, _index: uint256) -> Result<uint256> {
203 // TODO: Not implemetable253 // TODO: Not implemetable
204 Err("not implemented".into())254 Err("not implemented".into())
205 }255 }
206256
257 /// @notice Count NFTs tracked by this contract
258 /// @return A count of valid NFTs tracked by this contract, where each one of
259 /// them has an assigned and queryable owner not equal to the zero address
207 fn total_supply(&self) -> Result<uint256> {260 fn total_supply(&self) -> Result<uint256> {
208 self.consume_store_reads(1)?;261 self.consume_store_reads(1)?;
209 Ok(<Pallet<T>>::total_supply(self).into())262 Ok(<Pallet<T>>::total_supply(self).into())
210 }263 }
211}264}
212265
266/// @title ERC-721 Non-Fungible Token Standard
267/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
213#[solidity_interface(name = "ERC721", events(ERC721Events))]268#[solidity_interface(name = "ERC721", events(ERC721Events))]
214impl<T: Config> NonfungibleHandle<T> {269impl<T: Config> NonfungibleHandle<T> {
270 /// @notice Count all NFTs assigned to an owner
271 /// @dev NFTs assigned to the zero address are considered invalid, and this
272 /// function throws for queries about the zero address.
273 /// @param owner An address for whom to query the balance
274 /// @return The number of NFTs owned by `owner`, possibly zero
215 fn balance_of(&self, owner: address) -> Result<uint256> {275 fn balance_of(&self, owner: address) -> Result<uint256> {
216 self.consume_store_reads(1)?;276 self.consume_store_reads(1)?;
217 let owner = T::CrossAccountId::from_eth(owner);277 let owner = T::CrossAccountId::from_eth(owner);
218 let balance = <AccountBalance<T>>::get((self.id, owner));278 let balance = <AccountBalance<T>>::get((self.id, owner));
219 Ok(balance.into())279 Ok(balance.into())
220 }280 }
281 /// @notice Find the owner of an NFT
282 /// @dev NFTs assigned to zero address are considered invalid, and queries
283 /// about them do throw.
284 /// @param tokenId The identifier for an NFT
285 /// @return The address of the owner of the NFT
221 fn owner_of(&self, token_id: uint256) -> Result<address> {286 fn owner_of(&self, token_id: uint256) -> Result<address> {
222 self.consume_store_reads(1)?;287 self.consume_store_reads(1)?;
223 let token: TokenId = token_id.try_into()?;288 let token: TokenId = token_id.try_into()?;
226 .owner291 .owner
227 .as_eth())292 .as_eth())
228 }293 }
229 /// Not implemented294 /// @dev Not implemented
230 fn safe_transfer_from_with_data(295 fn safe_transfer_from_with_data(
231 &mut self,296 &mut self,
232 _from: address,297 _from: address,
238 // TODO: Not implemetable303 // TODO: Not implemetable
239 Err("not implemented".into())304 Err("not implemented".into())
240 }305 }
241 /// Not implemented306 /// @dev Not implemented
242 fn safe_transfer_from(307 fn safe_transfer_from(
243 &mut self,308 &mut self,
244 _from: address,309 _from: address,
250 Err("not implemented".into())315 Err("not implemented".into())
251 }316 }
252317
318 /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
319 /// TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE
320 /// THEY MAY BE PERMANENTLY LOST
321 /// @dev Throws unless `msg.sender` is the current owner or an authorized
322 /// operator for this NFT. Throws if `from` is not the current owner. Throws
323 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.
324 /// @param from The current owner of the NFT
325 /// @param to The new owner
326 /// @param tokenId The NFT to transfer
327 /// @param _value Not used for an NFT
253 #[weight(<SelfWeightOf<T>>::transfer_from())]328 #[weight(<SelfWeightOf<T>>::transfer_from())]
254 fn transfer_from(329 fn transfer_from(
255 &mut self,330 &mut self,
272 Ok(())347 Ok(())
273 }348 }
274349
350 /// @notice Set or reaffirm the approved address for an NFT
351 /// @dev The zero address indicates there is no approved address.
352 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized
353 /// operator of the current owner.
354 /// @param approved The new approved NFT controller
355 /// @param tokenId The NFT to approve
275 #[weight(<SelfWeightOf<T>>::approve())]356 #[weight(<SelfWeightOf<T>>::approve())]
276 fn approve(357 fn approve(
277 &mut self,358 &mut self,
289 Ok(())370 Ok(())
290 }371 }
291372
292 /// Not implemented373 /// @dev Not implemented
293 fn set_approval_for_all(374 fn set_approval_for_all(
294 &mut self,375 &mut self,
295 _caller: caller,376 _caller: caller,
300 Err("not implemented".into())381 Err("not implemented".into())
301 }382 }
302383
303 /// Not implemented384 /// @dev Not implemented
304 fn get_approved(&self, _token_id: uint256) -> Result<address> {385 fn get_approved(&self, _token_id: uint256) -> Result<address> {
305 // TODO: Not implemetable386 // TODO: Not implemetable
306 Err("not implemented".into())387 Err("not implemented".into())
307 }388 }
308389
309 /// Not implemented390 /// @dev Not implemented
310 fn is_approved_for_all(&self, _owner: address, _operator: address) -> Result<address> {391 fn is_approved_for_all(&self, _owner: address, _operator: address) -> Result<address> {
311 // TODO: Not implemetable392 // TODO: Not implemetable
312 Err("not implemented".into())393 Err("not implemented".into())
313 }394 }
314}395}
315396
397/// @title ERC721 Token that can be irreversibly burned (destroyed).
316#[solidity_interface(name = "ERC721Burnable")]398#[solidity_interface(name = "ERC721Burnable")]
317impl<T: Config> NonfungibleHandle<T> {399impl<T: Config> NonfungibleHandle<T> {
400 /// @notice Burns a specific ERC721 token.
401 /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized
402 /// operator of the current owner.
403 /// @param tokenId The NFT to approve
318 #[weight(<SelfWeightOf<T>>::burn_item())]404 #[weight(<SelfWeightOf<T>>::burn_item())]
319 fn burn(&mut self, caller: caller, token_id: uint256) -> Result<void> {405 fn burn(&mut self, caller: caller, token_id: uint256) -> Result<void> {
320 let caller = T::CrossAccountId::from_eth(caller);406 let caller = T::CrossAccountId::from_eth(caller);
325 }411 }
326}412}
327413
414/// @title ERC721 minting logic.
328#[solidity_interface(name = "ERC721Mintable", events(ERC721MintableEvents))]415#[solidity_interface(name = "ERC721Mintable", events(ERC721MintableEvents))]
329impl<T: Config> NonfungibleHandle<T> {416impl<T: Config> NonfungibleHandle<T> {
330 fn minting_finished(&self) -> Result<bool> {417 fn minting_finished(&self) -> Result<bool> {
331 Ok(false)418 Ok(false)
332 }419 }
333420
421 /// @notice Function to mint token.
334 /// `token_id` should be obtained with `next_token_id` method,422 /// @dev `tokenId` should be obtained with `nextTokenId` method,
335 /// unlike standard, you can't specify it manually423 /// unlike standard, you can't specify it manually
424 /// @param to The new owner
425 /// @param tokenId ID of the minted NFT
336 #[weight(<SelfWeightOf<T>>::create_item())]426 #[weight(<SelfWeightOf<T>>::create_item())]
337 fn mint(&mut self, caller: caller, to: address, token_id: uint256) -> Result<bool> {427 fn mint(&mut self, caller: caller, to: address, token_id: uint256) -> Result<bool> {
338 let caller = T::CrossAccountId::from_eth(caller);428 let caller = T::CrossAccountId::from_eth(caller);
364 Ok(true)454 Ok(true)
365 }455 }
366456
457 /// @notice Function to mint token with the given tokenUri.
367 /// `token_id` should be obtained with `next_token_id` method,458 /// @dev `tokenId` should be obtained with `nextTokenId` method,
368 /// unlike standard, you can't specify it manually459 /// unlike standard, you can't specify it manually
460 /// @param to The new owner
461 /// @param tokenId ID of the minted NFT
462 /// @param tokenUri Token URI that would be stored in the NFT properties
369 #[solidity(rename_selector = "mintWithTokenURI")]463 #[solidity(rename_selector = "mintWithTokenURI")]
370 #[weight(<SelfWeightOf<T>>::create_item())]464 #[weight(<SelfWeightOf<T>>::create_item())]
371 fn mint_with_token_uri(465 fn mint_with_token_uri(
420 Ok(true)514 Ok(true)
421 }515 }
422516
423 /// Not implemented517 /// @dev Not implemented
424 fn finish_minting(&mut self, _caller: caller) -> Result<bool> {518 fn finish_minting(&mut self, _caller: caller) -> Result<bool> {
425 Err("not implementable".into())519 Err("not implementable".into())
426 }520 }
449 false543 false
450}544}
451545
546/// @title Unique extensions for ERC721.
452#[solidity_interface(name = "ERC721UniqueExtensions")]547#[solidity_interface(name = "ERC721UniqueExtensions")]
453impl<T: Config> NonfungibleHandle<T> {548impl<T: Config> NonfungibleHandle<T> {
549 /// @notice Transfer ownership of an NFT
550 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
551 /// is the zero address. Throws if `tokenId` is not a valid NFT.
552 /// @param to The new owner
553 /// @param tokenId The NFT to transfer
554 /// @param _value Not used for an NFT
454 #[weight(<SelfWeightOf<T>>::transfer())]555 #[weight(<SelfWeightOf<T>>::transfer())]
455 fn transfer(556 fn transfer(
456 &mut self,557 &mut self,
470 Ok(())571 Ok(())
471 }572 }
472573
574 /// @notice Burns a specific ERC721 token.
575 /// @dev Throws unless `msg.sender` is the current owner or an authorized
576 /// operator for this NFT. Throws if `from` is not the current owner. Throws
577 /// if `to` is the zero address. Throws if `tokenId` is not a valid NFT.
578 /// @param from The current owner of the NFT
579 /// @param tokenId The NFT to transfer
580 /// @param _value Not used for an NFT
473 #[weight(<SelfWeightOf<T>>::burn_from())]581 #[weight(<SelfWeightOf<T>>::burn_from())]
474 fn burn_from(582 fn burn_from(
475 &mut self,583 &mut self,
490 Ok(())598 Ok(())
491 }599 }
492600
601 /// @notice Returns next free NFT ID.
493 fn next_token_id(&self) -> Result<uint256> {602 fn next_token_id(&self) -> Result<uint256> {
494 self.consume_store_reads(1)?;603 self.consume_store_reads(1)?;
495 Ok(<TokensMinted<T>>::get(self.id)604 Ok(<TokensMinted<T>>::get(self.id)
498 .into())607 .into())
499 }608 }
500609
610 /// @notice Function to mint multiple tokens.
611 /// @dev `tokenIds` should be an array of consecutive numbers and first number
612 /// should be obtained with `nextTokenId` method
613 /// @param to The new owner
614 /// @param tokenIds IDs of the minted NFTs
501 #[weight(<SelfWeightOf<T>>::create_multiple_items(token_ids.len() as u32))]615 #[weight(<SelfWeightOf<T>>::create_multiple_items(token_ids.len() as u32))]
502 fn mint_bulk(&mut self, caller: caller, to: address, token_ids: Vec<uint256>) -> Result<bool> {616 fn mint_bulk(&mut self, caller: caller, to: address, token_ids: Vec<uint256>) -> Result<bool> {
503 let caller = T::CrossAccountId::from_eth(caller);617 let caller = T::CrossAccountId::from_eth(caller);
529 Ok(true)643 Ok(true)
530 }644 }
531645
646 /// @notice Function to mint multiple tokens with the given tokenUris.
647 /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive
648 /// numbers and first number should be obtained with `nextTokenId` method
649 /// @param to The new owner
650 /// @param tokens array of pairs of token ID and token URI for minted tokens
532 #[solidity(rename_selector = "mintBulkWithTokenURI")]651 #[solidity(rename_selector = "mintBulkWithTokenURI")]
533 #[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32))]652 #[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32))]
534 fn mint_bulk_with_token_uri(653 fn mint_bulk_with_token_uri(
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
16
17//! # Nonfungible Pallet
18//!
19//! The Nonfungible pallet provides functionality for handling nonfungible collections and tokens.
20//!
21//! - [`Config`]
22//! - [`NonfungibleHandle`]
23//! - [`Pallet`]
24//! - [`CommonWeights`]
25//!
26//! ## Overview
27//!
28//! The Nonfungible pallet provides functions for:
29//!
30//! - NFT collection creation and removal
31//! - Minting and burning of NFT tokens
32//! - Retrieving account balances
33//! - Transfering NFT tokens
34//! - Setting and checking allowance for NFT tokens
35//! - Setting properties and permissions for NFT collections and tokens
36//! - Nesting and unnesting tokens
37//!
38//! ### Terminology
39//!
40//! - **NFT token:** Non fungible token.
41//!
42//! - **NFT Collection:** A collection of NFT tokens. All NFT tokens are part of a collection.
43//! Each collection can define it's own properties, properties for it's tokens and set of permissions.
44//!
45//! - **Balance:** Number of NFT tokens owned by an account
46//!
47//! - **Allowance:** NFT tokens owned by one account that another account is allowed to make operations on
48//!
49//! - **Burning:** The process of “deleting” a token from a collection and from
50//! an account balance of the owner.
51//!
52//! - **Nesting:** Setting up parent-child relationship between tokens. Nested tokens are inhereting
53//! owner from their parent. There could be multiple levels of nesting. Token couldn't be nested in
54//! it's child token i.e. parent-child relationship graph shouldn't have cycles.
55//!
56//! - **Properties:** Key-Values pairs. Token properties are attached to a token. Collection properties are
57//! attached to a collection. Set of permissions could be defined for each property.
58//!
59//! ### Implementations
60//!
61//! The Nonfungible pallet provides implementations for the following traits. If these traits provide
62//! the functionality that you need, then you can avoid coupling with the Nonfungible pallet.
63//!
64//! - [`CommonWeightInfo`](pallet_common::CommonWeightInfo): Functions for retrieval of transaction weight
65//! - [`CommonCollectionOperations`](pallet_common::CommonCollectionOperations): Functions for dealing
66//! with collections
67//!
68//! ## Interface
69//!
70//! ### Dispatchable Functions
71//!
72//! - `init_collection` - Create NFT collection. NFT collection can be configured to allow or deny access for
73//! some accounts.
74//! - `destroy_collection` - Destroy exising NFT collection. There should be no tokens in the collection.
75//! - `burn` - Burn NFT token owned by account.
76//! - `transfer` - Transfer NFT token. Transfers should be enabled for NFT collection.
77//! Nests the NFT token if it is sent to another token.
78//! - `create_item` - Mint NFT token in collection. Sender should have permission to mint tokens.
79//! - `set_allowance` - Set allowance for another account.
80//! - `set_token_property` - Set token property value.
81//! - `delete_token_property` - Remove property from the token.
82//! - `set_collection_properties` - Set collection properties.
83//! - `delete_collection_properties` - Remove properties from the collection.
84//! - `set_property_permission` - Set collection property permission.
85//! - `set_token_property_permissions` - Set token property permissions.
86//!
87//! ## Assumptions
88//!
89//! * To perform operations on tokens sender should be in collection's allow list if collection access mode is `AllowList`.
1690
17#![cfg_attr(not(feature = "std"), no_std)]91#![cfg_attr(not(feature = "std"), no_std)]
1892
102 #[pallet::generate_store(pub(super) trait Store)]176 #[pallet::generate_store(pub(super) trait Store)]
103 pub struct Pallet<T>(_);177 pub struct Pallet<T>(_);
104178
179 /// Amount of tokens minted for collection.
105 #[pallet::storage]180 #[pallet::storage]
106 pub type TokensMinted<T: Config> =181 pub type TokensMinted<T: Config> =
107 StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;182 StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
183
184 /// Amount of burnt tokens for collection.
108 #[pallet::storage]185 #[pallet::storage]
109 pub type TokensBurnt<T: Config> =186 pub type TokensBurnt<T: Config> =
110 StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;187 StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
111188
189 /// Custom data serialized to bytes for token.
112 #[pallet::storage]190 #[pallet::storage]
113 pub type TokenData<T: Config> = StorageNMap<191 pub type TokenData<T: Config> = StorageNMap<
114 Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),192 Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
115 Value = ItemData<T::CrossAccountId>,193 Value = ItemData<T::CrossAccountId>,
116 QueryKind = OptionQuery,194 QueryKind = OptionQuery,
117 >;195 >;
118196
197 /// Key-Value map stored for token.
119 #[pallet::storage]198 #[pallet::storage]
120 #[pallet::getter(fn token_properties)]199 #[pallet::getter(fn token_properties)]
121 pub type TokenProperties<T: Config> = StorageNMap<200 pub type TokenProperties<T: Config> = StorageNMap<
125 OnEmpty = up_data_structs::TokenProperties,204 OnEmpty = up_data_structs::TokenProperties,
126 >;205 >;
127206
207 /// Custom data that is serialized to bytes and attached to a token property.
208 /// Currently used to store RMRK data.
128 #[pallet::storage]209 #[pallet::storage]
129 #[pallet::getter(fn token_aux_property)]210 #[pallet::getter(fn token_aux_property)]
130 pub type TokenAuxProperties<T: Config> = StorageNMap<211 pub type TokenAuxProperties<T: Config> = StorageNMap<
138 QueryKind = OptionQuery,219 QueryKind = OptionQuery,
139 >;220 >;
140221
141 /// Used to enumerate tokens owned by account222 /// Used to enumerate tokens owned by account.
142 #[pallet::storage]223 #[pallet::storage]
143 pub type Owned<T: Config> = StorageNMap<224 pub type Owned<T: Config> = StorageNMap<
144 Key = (225 Key = (
150 QueryKind = ValueQuery,231 QueryKind = ValueQuery,
151 >;232 >;
152233
153 /// Used to enumerate token's children234 /// Used to enumerate token's children.
154 #[pallet::storage]235 #[pallet::storage]
155 #[pallet::getter(fn token_children)]236 #[pallet::getter(fn token_children)]
156 pub type TokenChildren<T: Config> = StorageNMap<237 pub type TokenChildren<T: Config> = StorageNMap<
163 QueryKind = ValueQuery,244 QueryKind = ValueQuery,
164 >;245 >;
165246
247 /// Amount of tokens owned by account.
166 #[pallet::storage]248 #[pallet::storage]
167 pub type AccountBalance<T: Config> = StorageNMap<249 pub type AccountBalance<T: Config> = StorageNMap<
168 Key = (250 Key = (
173 QueryKind = ValueQuery,255 QueryKind = ValueQuery,
174 >;256 >;
175257
258 /// Allowance set by an owner for a spender for a token.
176 #[pallet::storage]259 #[pallet::storage]
177 pub type Allowance<T: Config> = StorageNMap<260 pub type Allowance<T: Config> = StorageNMap<
178 Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),261 Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
273}356}
274357
275impl<T: Config> Pallet<T> {358impl<T: Config> Pallet<T> {
359 /// Get number of NFT tokens in collection.
276 pub fn total_supply(collection: &NonfungibleHandle<T>) -> u32 {360 pub fn total_supply(collection: &NonfungibleHandle<T>) -> u32 {
277 <TokensMinted<T>>::get(collection.id) - <TokensBurnt<T>>::get(collection.id)361 <TokensMinted<T>>::get(collection.id) - <TokensBurnt<T>>::get(collection.id)
278 }362 }
363
364 /// Check that NFT token exists.
365 ///
366 /// - `token`: Token ID.
279 pub fn token_exists(collection: &NonfungibleHandle<T>, token: TokenId) -> bool {367 pub fn token_exists(collection: &NonfungibleHandle<T>, token: TokenId) -> bool {
280 <TokenData<T>>::contains_key((collection.id, token))368 <TokenData<T>>::contains_key((collection.id, token))
281 }369 }
282370
371 /// Set the token property with the scope.
372 ///
373 /// - `property`: Contains key-value pair.
283 pub fn set_scoped_token_property(374 pub fn set_scoped_token_property(
284 collection_id: CollectionId,375 collection_id: CollectionId,
285 token_id: TokenId,376 token_id: TokenId,
294 Ok(())385 Ok(())
295 }386 }
296387
388 /// Batch operation to set multiple properties with the same scope.
297 pub fn set_scoped_token_properties(389 pub fn set_scoped_token_properties(
298 collection_id: CollectionId,390 collection_id: CollectionId,
299 token_id: TokenId,391 token_id: TokenId,
308 Ok(())400 Ok(())
309 }401 }
310402
403 /// Add or edit auxiliary data for the property.
404 ///
405 /// - `f`: function that adds or edits auxiliary data.
311 pub fn try_mutate_token_aux_property<R, E>(406 pub fn try_mutate_token_aux_property<R, E>(
312 collection_id: CollectionId,407 collection_id: CollectionId,
313 token_id: TokenId,408 token_id: TokenId,
318 <TokenAuxProperties<T>>::try_mutate((collection_id, token_id, scope, key), f)413 <TokenAuxProperties<T>>::try_mutate((collection_id, token_id, scope, key), f)
319 }414 }
320415
416 /// Remove auxiliary data for the property.
321 pub fn remove_token_aux_property(417 pub fn remove_token_aux_property(
322 collection_id: CollectionId,418 collection_id: CollectionId,
323 token_id: TokenId,419 token_id: TokenId,
327 <TokenAuxProperties<T>>::remove((collection_id, token_id, scope, key));423 <TokenAuxProperties<T>>::remove((collection_id, token_id, scope, key));
328 }424 }
329425
426 /// Get all auxiliary data in a given scope.
427 ///
428 /// Returns iterator over Property Key - Data pairs.
330 pub fn iterate_token_aux_properties(429 pub fn iterate_token_aux_properties(
331 collection_id: CollectionId,430 collection_id: CollectionId,
332 token_id: TokenId,431 token_id: TokenId,
335 <TokenAuxProperties<T>>::iter_prefix((collection_id, token_id, scope))434 <TokenAuxProperties<T>>::iter_prefix((collection_id, token_id, scope))
336 }435 }
337436
437 /// Get ID of the last minted token
338 pub fn current_token_id(collection_id: CollectionId) -> TokenId {438 pub fn current_token_id(collection_id: CollectionId) -> TokenId {
339 TokenId(<TokensMinted<T>>::get(collection_id))439 TokenId(<TokensMinted<T>>::get(collection_id))
340 }440 }
341}441}
342442
343// unchecked calls skips any permission checks443// unchecked calls skips any permission checks
344impl<T: Config> Pallet<T> {444impl<T: Config> Pallet<T> {
445 /// Create NFT collection
446 ///
447 /// `init_collection` will take non-refundable deposit for collection creation.
448 ///
449 /// - `data`: Contains settings for collection limits and permissions.
345 pub fn init_collection(450 pub fn init_collection(
346 owner: T::CrossAccountId,451 owner: T::CrossAccountId,
347 data: CreateCollectionData<T::AccountId>,452 data: CreateCollectionData<T::AccountId>,
350 <PalletCommon<T>>::init_collection(owner, data, is_external)455 <PalletCommon<T>>::init_collection(owner, data, is_external)
351 }456 }
457
458 /// Destroy NFT collection
459 ///
460 /// `destroy_collection` will throw error if collection contains any tokens.
461 /// Only owner can destroy collection.
352 pub fn destroy_collection(462 pub fn destroy_collection(
353 collection: NonfungibleHandle<T>,463 collection: NonfungibleHandle<T>,
354 sender: &T::CrossAccountId,464 sender: &T::CrossAccountId,
373 Ok(())483 Ok(())
374 }484 }
375485
486 /// Burn NFT token
487 ///
488 /// `burn` removes `token` from the `collection`, from it's owner and from the parent token
489 /// if the token is nested.
490 /// Only the owner can `burn` the token. The `token` shouldn't have any nested tokens.
491 /// Also removes all corresponding properties and auxiliary properties.
492 ///
493 /// - `token`: Token that should be burned
494 /// - `collection`: Collection that contains the token
376 pub fn burn(495 pub fn burn(
377 collection: &NonfungibleHandle<T>,496 collection: &NonfungibleHandle<T>,
378 sender: &T::CrossAccountId,497 sender: &T::CrossAccountId,
442 Ok(())561 Ok(())
443 }562 }
444563
564 /// Same as [`burn`] but burns all the tokens that are nested in the token first
565 ///
566 /// - `self_budget`: Limit for searching children in depth.
567 /// - `breadth_budget`: Limit of breadth of searching children.
568 ///
569 /// [`burn`]: struct.Pallet.html#method.burn
445 #[transactional]570 #[transactional]
446 pub fn burn_recursively(571 pub fn burn_recursively(
447 collection: &NonfungibleHandle<T>,572 collection: &NonfungibleHandle<T>,
481 })606 })
482 }607 }
483608
609 /// Batch operation to add, edit or remove properties for the token
610 ///
611 /// All affected properties should have mutable permission and sender should have
612 /// permission to edit those properties.
613 ///
614 /// - `nesting_budget`: Limit for searching parents in depth to check ownership.
615 /// - `is_token_create`: Indicates that method is called during token initialization.
616 /// Allows to bypass ownership check.
484 #[transactional]617 #[transactional]
485 fn modify_token_properties(618 fn modify_token_properties(
486 collection: &NonfungibleHandle<T>,619 collection: &NonfungibleHandle<T>,
574 Ok(())707 Ok(())
575 }708 }
576709
710 /// Batch operation to add or edit properties for the token
711 ///
712 /// Same as [`modify_token_properties`] but doesn't allow to remove properties
713 ///
714 /// [`modify_token_properties`]: struct.Pallet.html#method.modify_token_properties
577 pub fn set_token_properties(715 pub fn set_token_properties(
578 collection: &NonfungibleHandle<T>,716 collection: &NonfungibleHandle<T>,
579 sender: &T::CrossAccountId,717 sender: &T::CrossAccountId,
592 )730 )
593 }731 }
594732
733 /// Add or edit single property for the token
734 ///
735 /// Calls [`set_token_properties`] internally
736 ///
737 /// [`set_token_properties`]: struct.Pallet.html#method.set_token_properties
595 pub fn set_token_property(738 pub fn set_token_property(
596 collection: &NonfungibleHandle<T>,739 collection: &NonfungibleHandle<T>,
597 sender: &T::CrossAccountId,740 sender: &T::CrossAccountId,
611 )754 )
612 }755 }
613756
757 /// Batch operation to remove properties from the token
758 ///
759 /// Same as [`modify_token_properties`] but doesn't allow to add or edit properties
760 ///
761 /// [`modify_token_properties`]: struct.Pallet.html#method.modify_token_properties
614 pub fn delete_token_properties(762 pub fn delete_token_properties(
615 collection: &NonfungibleHandle<T>,763 collection: &NonfungibleHandle<T>,
616 sender: &T::CrossAccountId,764 sender: &T::CrossAccountId,
630 )778 )
631 }779 }
632780
781 /// Remove single property from the token
782 ///
783 /// Calls [`delete_token_properties`] internally
784 ///
785 /// [`delete_token_properties`]: struct.Pallet.html#method.delete_token_properties
633 pub fn delete_token_property(786 pub fn delete_token_property(
634 collection: &NonfungibleHandle<T>,787 collection: &NonfungibleHandle<T>,
635 sender: &T::CrossAccountId,788 sender: &T::CrossAccountId,
646 )799 )
647 }800 }
648801
802 /// Add or edit properties for the collection
649 pub fn set_collection_properties(803 pub fn set_collection_properties(
650 collection: &NonfungibleHandle<T>,804 collection: &NonfungibleHandle<T>,
651 sender: &T::CrossAccountId,805 sender: &T::CrossAccountId,
654 <PalletCommon<T>>::set_collection_properties(collection, sender, properties)808 <PalletCommon<T>>::set_collection_properties(collection, sender, properties)
655 }809 }
656810
811 /// Remove properties from the collection
657 pub fn delete_collection_properties(812 pub fn delete_collection_properties(
658 collection: &CollectionHandle<T>,813 collection: &CollectionHandle<T>,
659 sender: &T::CrossAccountId,814 sender: &T::CrossAccountId,
662 <PalletCommon<T>>::delete_collection_properties(collection, sender, property_keys)817 <PalletCommon<T>>::delete_collection_properties(collection, sender, property_keys)
663 }818 }
664819
820 /// Set property permissions for the token.
821 ///
822 /// Sender should be the owner or admin of token's collection.
665 pub fn set_token_property_permissions(823 pub fn set_token_property_permissions(
666 collection: &CollectionHandle<T>,824 collection: &CollectionHandle<T>,
667 sender: &T::CrossAccountId,825 sender: &T::CrossAccountId,
670 <PalletCommon<T>>::set_token_property_permissions(collection, sender, property_permissions)828 <PalletCommon<T>>::set_token_property_permissions(collection, sender, property_permissions)
671 }829 }
672830
831 /// Set property permissions for the collection.
832 ///
833 /// Sender should be the owner or admin of the collection.
673 pub fn set_property_permission(834 pub fn set_property_permission(
674 collection: &CollectionHandle<T>,835 collection: &CollectionHandle<T>,
675 sender: &T::CrossAccountId,836 sender: &T::CrossAccountId,
678 <PalletCommon<T>>::set_property_permission(collection, sender, permission)839 <PalletCommon<T>>::set_property_permission(collection, sender, permission)
679 }840 }
680841
842 /// Transfer NFT token from one account to another.
843 ///
844 /// `from` account stops being the owner and `to` account becomes the owner of the token.
845 /// If `to` is token than `to` becomes owner of the token and the token become nested.
846 /// Unnests token from previous parent if it was nested before.
847 /// Removes allowance for the token if there was any.
848 /// Throws if transfers aren't allowed for collection or if receiver reached token ownership limit.
849 ///
850 /// - `nesting_budget`: Limit for token nesting depth
681 pub fn transfer(851 pub fn transfer(
682 collection: &NonfungibleHandle<T>,852 collection: &NonfungibleHandle<T>,
683 from: &T::CrossAccountId,853 from: &T::CrossAccountId,
769 Ok(())939 Ok(())
770 }940 }
771941
942 /// Batch operation to mint multiple NFT tokens.
943 ///
944 /// The sender should be the owner/admin of the collection or collection should be configured
945 /// to allow public minting.
946 /// Throws if amount of tokens reached it's limit for the collection or if caller reached
947 /// token ownership limit.
948 ///
949 /// - `data`: Contains list of token properties and users who will become the owners of the
950 /// corresponging tokens.
951 /// - `nesting_budget`: Limit for token nesting depth
772 pub fn create_multiple_items(952 pub fn create_multiple_items(
773 collection: &NonfungibleHandle<T>,953 collection: &NonfungibleHandle<T>,
774 sender: &T::CrossAccountId,954 sender: &T::CrossAccountId,
953 }1133 }
954 }1134 }
9551135
1136 /// Set allowance for the spender to `transfer` or `burn` sender's token.
1137 ///
1138 /// - `token`: Token the spender is allowed to `transfer` or `burn`.
956 pub fn set_allowance(1139 pub fn set_allowance(
957 collection: &NonfungibleHandle<T>,1140 collection: &NonfungibleHandle<T>,
958 sender: &T::CrossAccountId,1141 sender: &T::CrossAccountId,
985 Ok(())1168 Ok(())
986 }1169 }
9871170
1171 /// Checks allowance for the spender to use the token.
988 fn check_allowed(1172 fn check_allowed(
989 collection: &NonfungibleHandle<T>,1173 collection: &NonfungibleHandle<T>,
990 spender: &T::CrossAccountId,1174 spender: &T::CrossAccountId,
1027 Ok(())1211 Ok(())
1028 }1212 }
10291213
1214 /// Transfer NFT token from one account to another.
1215 ///
1216 /// Same as the [`transfer`] but spender doesn't needs to be the owner of the token.
1217 /// The owner should set allowance for the spender to transfer token.
1218 ///
1219 /// [`transfer`]: struct.Pallet.html#method.transfer
1030 pub fn transfer_from(1220 pub fn transfer_from(
1031 collection: &NonfungibleHandle<T>,1221 collection: &NonfungibleHandle<T>,
1032 spender: &T::CrossAccountId,1222 spender: &T::CrossAccountId,
1043 Self::transfer(collection, from, to, token, nesting_budget)1233 Self::transfer(collection, from, to, token, nesting_budget)
1044 }1234 }
10451235
1236 /// Burn NFT token for `from` account.
1237 ///
1238 /// Same as the [`burn`] but spender doesn't need to be an owner of the token. The owner should
1239 /// set allowance for the spender to burn token.
1240 ///
1241 /// [`burn`]: struct.Pallet.html#method.burn
1046 pub fn burn_from(1242 pub fn burn_from(
1047 collection: &NonfungibleHandle<T>,1243 collection: &NonfungibleHandle<T>,
1048 spender: &T::CrossAccountId,1244 spender: &T::CrossAccountId,
1057 Self::burn(collection, from, token)1253 Self::burn(collection, from, token)
1058 }1254 }
10591255
1256 /// Check that `from` token could be nested in `under` token.
1257 ///
1060 pub fn check_nesting(1258 pub fn check_nesting(
1061 handle: &NonfungibleHandle<T>,1259 handle: &NonfungibleHandle<T>,
1062 sender: T::CrossAccountId,1260 sender: T::CrossAccountId,
1126 .collect()1324 .collect()
1127 }1325 }
11281326
1327 /// Mint single NFT token.
1328 ///
1129 /// Delegated to `create_multiple_items`1329 /// Delegated to [`create_multiple_items`]
1330 ///
1331 /// [`create_multiple_items`]: struct.Pallet.html#method.create_multiple_items
1130 pub fn create_item(1332 pub fn create_item(
1131 collection: &NonfungibleHandle<T>,1333 collection: &NonfungibleHandle<T>,
1132 sender: &T::CrossAccountId,1334 sender: &T::CrossAccountId,
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
5353
54// Selector: 4136937754// Selector: 41369377
55contract TokenProperties is Dummy, ERC165 {55contract TokenProperties is Dummy, ERC165 {
56 // @notice Set permissions for token property.
57 // @dev Throws error if `msg.sender` is not admin or owner of the collection.
58 // @param key Property key.
59 // @param is_mutable Permission to mutate property.
60 // @param collection_admin Permission to mutate property by collection admin if property is mutable.
61 // @param token_owner Permission to mutate property by token owner if property is mutable.
62 //
56 // Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa63 // Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa
57 function setTokenPropertyPermission(64 function setTokenPropertyPermission(
58 string memory key,65 string memory key,
68 dummy = 0;75 dummy = 0;
69 }76 }
7077
78 // @notice Set token property value.
79 // @dev Throws error if `msg.sender` has no permission to edit the property.
80 // @param token_id ID of the token.
81 // @param key Property key.
82 // @param value Property value.
83 //
71 // Selector: setProperty(uint256,string,bytes) 1752d67b84 // Selector: setProperty(uint256,string,bytes) 1752d67b
72 function setProperty(85 function setProperty(
73 uint256 tokenId,86 uint256 tokenId,
81 dummy = 0;94 dummy = 0;
82 }95 }
8396
97 // @notice Delete token property value.
98 // @dev Throws error if `msg.sender` has no permission to edit the property.
99 // @param token_id ID of the token.
100 // @param key Property key.
101 //
84 // Selector: deleteProperty(uint256,string) 066111d1102 // Selector: deleteProperty(uint256,string) 066111d1
85 function deleteProperty(uint256 tokenId, string memory key) public {103 function deleteProperty(uint256 tokenId, string memory key) public {
86 require(false, stub_error);104 require(false, stub_error);
89 dummy = 0;107 dummy = 0;
90 }108 }
91109
110 // @notice Get token property value.
92 // Throws error if key not found111 // @dev Throws error if key not found
112 // @param token_id ID of the token.
113 // @param key Property key.
93 //114 //
94 // Selector: property(uint256,string) 7228c327115 // Selector: property(uint256,string) 7228c327
95 function property(uint256 tokenId, string memory key)116 function property(uint256 tokenId, string memory key)
107128
108// Selector: 42966c68129// Selector: 42966c68
109contract ERC721Burnable is Dummy, ERC165 {130contract ERC721Burnable is Dummy, ERC165 {
131 // @notice Burns a specific ERC721 token.
132 // @dev Throws unless `msg.sender` is the current NFT owner, or an authorized
133 // operator of the current owner.
134 // @param tokenId The NFT to approve
135 //
110 // Selector: burn(uint256) 42966c68136 // Selector: burn(uint256) 42966c68
111 function burn(uint256 tokenId) public {137 function burn(uint256 tokenId) public {
112 require(false, stub_error);138 require(false, stub_error);
117143
118// Selector: 58800161144// Selector: 58800161
119contract ERC721 is Dummy, ERC165, ERC721Events {145contract ERC721 is Dummy, ERC165, ERC721Events {
146 // @notice Count all NFTs assigned to an owner
147 // @dev NFTs assigned to the zero address are considered invalid, and this
148 // function throws for queries about the zero address.
149 // @param _owner An address for whom to query the balance
150 // @return The number of NFTs owned by `_owner`, possibly zero
151 //
120 // Selector: balanceOf(address) 70a08231152 // Selector: balanceOf(address) 70a08231
121 function balanceOf(address owner) public view returns (uint256) {153 function balanceOf(address owner) public view returns (uint256) {
122 require(false, stub_error);154 require(false, stub_error);
125 return 0;157 return 0;
126 }158 }
127159
160 // @notice Find the owner of an NFT
161 // @dev NFTs assigned to zero address are considered invalid, and queries
162 // about them do throw.
163 // @param _tokenId The identifier for an NFT
164 // @return The address of the owner of the NFT
165 //
128 // Selector: ownerOf(uint256) 6352211e166 // Selector: ownerOf(uint256) 6352211e
129 function ownerOf(uint256 tokenId) public view returns (address) {167 function ownerOf(uint256 tokenId) public view returns (address) {
130 require(false, stub_error);168 require(false, stub_error);
133 return 0x0000000000000000000000000000000000000000;171 return 0x0000000000000000000000000000000000000000;
134 }172 }
135173
136 // Not implemented174 // @dev Not implemented
137 //175 //
138 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a11672176 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a11672
139 function safeTransferFromWithData(177 function safeTransferFromWithData(
150 dummy = 0;188 dummy = 0;
151 }189 }
152190
153 // Not implemented191 // @dev Not implemented
154 //192 //
155 // Selector: safeTransferFrom(address,address,uint256) 42842e0e193 // Selector: safeTransferFrom(address,address,uint256) 42842e0e
156 function safeTransferFrom(194 function safeTransferFrom(
165 dummy = 0;203 dummy = 0;
166 }204 }
167205
206 // @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
207 // TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE
208 // THEY MAY BE PERMANENTLY LOST
209 // @dev Throws unless `msg.sender` is the current owner or an authorized
210 // operator for this NFT. Throws if `from` is not the current owner. Throws
211 // if `to` is the zero address. Throws if `tokenId` is not a valid NFT.
212 // @param from The current owner of the NFT
213 // @param to The new owner
214 // @param tokenId The NFT to transfer
215 // @param _value Not used for an NFT
216 //
168 // Selector: transferFrom(address,address,uint256) 23b872dd217 // Selector: transferFrom(address,address,uint256) 23b872dd
169 function transferFrom(218 function transferFrom(
170 address from,219 address from,
178 dummy = 0;227 dummy = 0;
179 }228 }
180229
230 // @notice Set or reaffirm the approved address for an NFT
231 // @dev The zero address indicates there is no approved address.
232 // @dev Throws unless `msg.sender` is the current NFT owner, or an authorized
233 // operator of the current owner.
234 // @param approved The new approved NFT controller
235 // @param tokenId The NFT to approve
236 //
181 // Selector: approve(address,uint256) 095ea7b3237 // Selector: approve(address,uint256) 095ea7b3
182 function approve(address approved, uint256 tokenId) public {238 function approve(address approved, uint256 tokenId) public {
183 require(false, stub_error);239 require(false, stub_error);
186 dummy = 0;242 dummy = 0;
187 }243 }
188244
189 // Not implemented245 // @dev Not implemented
190 //246 //
191 // Selector: setApprovalForAll(address,bool) a22cb465247 // Selector: setApprovalForAll(address,bool) a22cb465
192 function setApprovalForAll(address operator, bool approved) public {248 function setApprovalForAll(address operator, bool approved) public {
196 dummy = 0;252 dummy = 0;
197 }253 }
198254
199 // Not implemented255 // @dev Not implemented
200 //256 //
201 // Selector: getApproved(uint256) 081812fc257 // Selector: getApproved(uint256) 081812fc
202 function getApproved(uint256 tokenId) public view returns (address) {258 function getApproved(uint256 tokenId) public view returns (address) {
206 return 0x0000000000000000000000000000000000000000;262 return 0x0000000000000000000000000000000000000000;
207 }263 }
208264
209 // Not implemented265 // @dev Not implemented
210 //266 //
211 // Selector: isApprovedForAll(address,address) e985e9c5267 // Selector: isApprovedForAll(address,address) e985e9c5
212 function isApprovedForAll(address owner, address operator)268 function isApprovedForAll(address owner, address operator)
224280
225// Selector: 5b5e139f281// Selector: 5b5e139f
226contract ERC721Metadata is Dummy, ERC165 {282contract ERC721Metadata is Dummy, ERC165 {
283 // @notice A descriptive name for a collection of NFTs in this contract
284 //
227 // Selector: name() 06fdde03285 // Selector: name() 06fdde03
228 function name() public view returns (string memory) {286 function name() public view returns (string memory) {
229 require(false, stub_error);287 require(false, stub_error);
230 dummy;288 dummy;
231 return "";289 return "";
232 }290 }
233291
292 // @notice An abbreviated name for NFTs in this contract
293 //
234 // Selector: symbol() 95d89b41294 // Selector: symbol() 95d89b41
235 function symbol() public view returns (string memory) {295 function symbol() public view returns (string memory) {
236 require(false, stub_error);296 require(false, stub_error);
237 dummy;297 dummy;
238 return "";298 return "";
239 }299 }
240300
301 // @notice A distinct Uniform Resource Identifier (URI) for a given asset.
302 // @dev Throws if `tokenId` is not a valid NFT. URIs are defined in RFC
303 // 3986. The URI may point to a JSON file that conforms to the "ERC721
304 // Metadata JSON Schema".
241 // Returns token's const_metadata305 // @return token's const_metadata
242 //306 //
243 // Selector: tokenURI(uint256) c87b56dd307 // Selector: tokenURI(uint256) c87b56dd
244 function tokenURI(uint256 tokenId) public view returns (string memory) {308 function tokenURI(uint256 tokenId) public view returns (string memory) {
258 return false;322 return false;
259 }323 }
260324
325 // @notice Function to mint token.
261 // `token_id` should be obtained with `next_token_id` method,326 // @dev `tokenId` should be obtained with `nextTokenId` method,
262 // unlike standard, you can't specify it manually327 // unlike standard, you can't specify it manually
328 // @param to The new owner
329 // @param tokenId ID of the minted NFT
263 //330 //
264 // Selector: mint(address,uint256) 40c10f19331 // Selector: mint(address,uint256) 40c10f19
265 function mint(address to, uint256 tokenId) public returns (bool) {332 function mint(address to, uint256 tokenId) public returns (bool) {
270 return false;337 return false;
271 }338 }
272339
340 // @notice Function to mint token with the given tokenUri.
273 // `token_id` should be obtained with `next_token_id` method,341 // @dev `tokenId` should be obtained with `nextTokenId` method,
274 // unlike standard, you can't specify it manually342 // unlike standard, you can't specify it manually
343 // @param to The new owner
344 // @param tokenId ID of the minted NFT
345 // @param tokenUri Token URI that would be stored in the NFT properties
275 //346 //
276 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f347 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f
277 function mintWithTokenURI(348 function mintWithTokenURI(
287 return false;358 return false;
288 }359 }
289360
290 // Not implemented361 // @dev Not implemented
291 //362 //
292 // Selector: finishMinting() 7d64bcb4363 // Selector: finishMinting() 7d64bcb4
293 function finishMinting() public returns (bool) {364 function finishMinting() public returns (bool) {
299370
300// Selector: 780e9d63371// Selector: 780e9d63
301contract ERC721Enumerable is Dummy, ERC165 {372contract ERC721Enumerable is Dummy, ERC165 {
373 // @notice Enumerate valid NFTs
374 // @dev Throws if `index` >= `totalSupply()`.
375 // @param index A counter less than `totalSupply()`
376 // @return The token identifier for the `index`th NFT,
377 // (sort order not specified)
378 //
302 // Selector: tokenByIndex(uint256) 4f6ccce7379 // Selector: tokenByIndex(uint256) 4f6ccce7
303 function tokenByIndex(uint256 index) public view returns (uint256) {380 function tokenByIndex(uint256 index) public view returns (uint256) {
304 require(false, stub_error);381 require(false, stub_error);
307 return 0;384 return 0;
308 }385 }
309386
310 // Not implemented387 // @dev Not implemented
311 //388 //
312 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59389 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59
313 function tokenOfOwnerByIndex(address owner, uint256 index)390 function tokenOfOwnerByIndex(address owner, uint256 index)
322 return 0;399 return 0;
323 }400 }
324401
402 // @notice Count NFTs tracked by this contract
403 // @return A count of valid NFTs tracked by this contract, where each one of
404 // them has an assigned and queryable owner not equal to the zero address
405 //
325 // Selector: totalSupply() 18160ddd406 // Selector: totalSupply() 18160ddd
326 function totalSupply() public view returns (uint256) {407 function totalSupply() public view returns (uint256) {
327 require(false, stub_error);408 require(false, stub_error);
475556
476// Selector: d74d154f557// Selector: d74d154f
477contract ERC721UniqueExtensions is Dummy, ERC165 {558contract ERC721UniqueExtensions is Dummy, ERC165 {
559 // @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
560 // TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE
561 // THEY MAY BE PERMANENTLY LOST
562 // @dev Throws unless `msg.sender` is the current owner. Throws if `to`
563 // is the zero address. Throws if `tokenId` is not a valid NFT.
564 // @param to The new owner
565 // @param tokenId The NFT to transfer
566 // @param _value Not used for an NFT
567 //
478 // Selector: transfer(address,uint256) a9059cbb568 // Selector: transfer(address,uint256) a9059cbb
479 function transfer(address to, uint256 tokenId) public {569 function transfer(address to, uint256 tokenId) public {
480 require(false, stub_error);570 require(false, stub_error);
483 dummy = 0;573 dummy = 0;
484 }574 }
485575
576 // @notice Burns a specific ERC721 token.
577 // @dev Throws unless `msg.sender` is the current owner or an authorized
578 // operator for this NFT. Throws if `from` is not the current owner. Throws
579 // if `to` is the zero address. Throws if `tokenId` is not a valid NFT.
580 // @param from The current owner of the NFT
581 // @param tokenId The NFT to transfer
582 // @param _value Not used for an NFT
583 //
486 // Selector: burnFrom(address,uint256) 79cc6790584 // Selector: burnFrom(address,uint256) 79cc6790
487 function burnFrom(address from, uint256 tokenId) public {585 function burnFrom(address from, uint256 tokenId) public {
488 require(false, stub_error);586 require(false, stub_error);
491 dummy = 0;589 dummy = 0;
492 }590 }
493591
592 // @notice Returns next free NFT ID.
593 //
494 // Selector: nextTokenId() 75794a3c594 // Selector: nextTokenId() 75794a3c
495 function nextTokenId() public view returns (uint256) {595 function nextTokenId() public view returns (uint256) {
496 require(false, stub_error);596 require(false, stub_error);
497 dummy;597 dummy;
498 return 0;598 return 0;
499 }599 }
500600
601 // @notice Function to mint multiple tokens.
602 // @dev `tokenIds` should be an array of consecutive numbers and first number
603 // should be obtained with `nextTokenId` method
604 // @param to The new owner
605 // @param tokenIds IDs of the minted NFTs
606 //
501 // Selector: mintBulk(address,uint256[]) 44a9945e607 // Selector: mintBulk(address,uint256[]) 44a9945e
502 function mintBulk(address to, uint256[] memory tokenIds)608 function mintBulk(address to, uint256[] memory tokenIds)
503 public609 public
510 return false;616 return false;
511 }617 }
512618
619 // @notice Function to mint multiple tokens with the given tokenUris.
620 // @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive
621 // numbers and first number should be obtained with `nextTokenId` method
622 // @param to The new owner
623 // @param tokens array of pairs of token ID and token URI for minted tokens
624 //
513 // Selector: mintBulkWithTokenURI(address,(uint256,string)[]) 36543006625 // Selector: mintBulkWithTokenURI(address,(uint256,string)[]) 36543006
514 function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)626 function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)
515 public627 public
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
4444
45// Selector: 4136937745// Selector: 41369377
46interface TokenProperties is Dummy, ERC165 {46interface TokenProperties is Dummy, ERC165 {
47 // @notice Set permissions for token property.
48 // @dev Throws error if `msg.sender` is not admin or owner of the collection.
49 // @param key Property key.
50 // @param is_mutable Permission to mutate property.
51 // @param collection_admin Permission to mutate property by collection admin if property is mutable.
52 // @param token_owner Permission to mutate property by token owner if property is mutable.
53 //
47 // Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa54 // Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa
48 function setTokenPropertyPermission(55 function setTokenPropertyPermission(
49 string memory key,56 string memory key,
52 bool tokenOwner59 bool tokenOwner
53 ) external;60 ) external;
5461
62 // @notice Set token property value.
63 // @dev Throws error if `msg.sender` has no permission to edit the property.
64 // @param token_id ID of the token.
65 // @param key Property key.
66 // @param value Property value.
67 //
55 // Selector: setProperty(uint256,string,bytes) 1752d67b68 // Selector: setProperty(uint256,string,bytes) 1752d67b
56 function setProperty(69 function setProperty(
57 uint256 tokenId,70 uint256 tokenId,
58 string memory key,71 string memory key,
59 bytes memory value72 bytes memory value
60 ) external;73 ) external;
6174
75 // @notice Delete token property value.
76 // @dev Throws error if `msg.sender` has no permission to edit the property.
77 // @param token_id ID of the token.
78 // @param key Property key.
79 //
62 // Selector: deleteProperty(uint256,string) 066111d180 // Selector: deleteProperty(uint256,string) 066111d1
63 function deleteProperty(uint256 tokenId, string memory key) external;81 function deleteProperty(uint256 tokenId, string memory key) external;
6482
83 // @notice Get token property value.
65 // Throws error if key not found84 // @dev Throws error if key not found
85 // @param token_id ID of the token.
86 // @param key Property key.
66 //87 //
67 // Selector: property(uint256,string) 7228c32788 // Selector: property(uint256,string) 7228c327
68 function property(uint256 tokenId, string memory key)89 function property(uint256 tokenId, string memory key)
7394
74// Selector: 42966c6895// Selector: 42966c68
75interface ERC721Burnable is Dummy, ERC165 {96interface ERC721Burnable is Dummy, ERC165 {
97 // @notice Burns a specific ERC721 token.
98 // @dev Throws unless `msg.sender` is the current NFT owner, or an authorized
99 // operator of the current owner.
100 // @param tokenId The NFT to approve
101 //
76 // Selector: burn(uint256) 42966c68102 // Selector: burn(uint256) 42966c68
77 function burn(uint256 tokenId) external;103 function burn(uint256 tokenId) external;
78}104}
79105
80// Selector: 58800161106// Selector: 58800161
81interface ERC721 is Dummy, ERC165, ERC721Events {107interface ERC721 is Dummy, ERC165, ERC721Events {
108 // @notice Count all NFTs assigned to an owner
109 // @dev NFTs assigned to the zero address are considered invalid, and this
110 // function throws for queries about the zero address.
111 // @param _owner An address for whom to query the balance
112 // @return The number of NFTs owned by `_owner`, possibly zero
113 //
82 // Selector: balanceOf(address) 70a08231114 // Selector: balanceOf(address) 70a08231
83 function balanceOf(address owner) external view returns (uint256);115 function balanceOf(address owner) external view returns (uint256);
84116
117 // @notice Find the owner of an NFT
118 // @dev NFTs assigned to zero address are considered invalid, and queries
119 // about them do throw.
120 // @param _tokenId The identifier for an NFT
121 // @return The address of the owner of the NFT
122 //
85 // Selector: ownerOf(uint256) 6352211e123 // Selector: ownerOf(uint256) 6352211e
86 function ownerOf(uint256 tokenId) external view returns (address);124 function ownerOf(uint256 tokenId) external view returns (address);
87125
88 // Not implemented126 // @dev Not implemented
89 //127 //
90 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a11672128 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a11672
91 function safeTransferFromWithData(129 function safeTransferFromWithData(
95 bytes memory data133 bytes memory data
96 ) external;134 ) external;
97135
98 // Not implemented136 // @dev Not implemented
99 //137 //
100 // Selector: safeTransferFrom(address,address,uint256) 42842e0e138 // Selector: safeTransferFrom(address,address,uint256) 42842e0e
101 function safeTransferFrom(139 function safeTransferFrom(
104 uint256 tokenId142 uint256 tokenId
105 ) external;143 ) external;
106144
145 // @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
146 // TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE
147 // THEY MAY BE PERMANENTLY LOST
148 // @dev Throws unless `msg.sender` is the current owner or an authorized
149 // operator for this NFT. Throws if `from` is not the current owner. Throws
150 // if `to` is the zero address. Throws if `tokenId` is not a valid NFT.
151 // @param from The current owner of the NFT
152 // @param to The new owner
153 // @param tokenId The NFT to transfer
154 // @param _value Not used for an NFT
155 //
107 // Selector: transferFrom(address,address,uint256) 23b872dd156 // Selector: transferFrom(address,address,uint256) 23b872dd
108 function transferFrom(157 function transferFrom(
109 address from,158 address from,
110 address to,159 address to,
111 uint256 tokenId160 uint256 tokenId
112 ) external;161 ) external;
113162
163 // @notice Set or reaffirm the approved address for an NFT
164 // @dev The zero address indicates there is no approved address.
165 // @dev Throws unless `msg.sender` is the current NFT owner, or an authorized
166 // operator of the current owner.
167 // @param approved The new approved NFT controller
168 // @param tokenId The NFT to approve
169 //
114 // Selector: approve(address,uint256) 095ea7b3170 // Selector: approve(address,uint256) 095ea7b3
115 function approve(address approved, uint256 tokenId) external;171 function approve(address approved, uint256 tokenId) external;
116172
117 // Not implemented173 // @dev Not implemented
118 //174 //
119 // Selector: setApprovalForAll(address,bool) a22cb465175 // Selector: setApprovalForAll(address,bool) a22cb465
120 function setApprovalForAll(address operator, bool approved) external;176 function setApprovalForAll(address operator, bool approved) external;
121177
122 // Not implemented178 // @dev Not implemented
123 //179 //
124 // Selector: getApproved(uint256) 081812fc180 // Selector: getApproved(uint256) 081812fc
125 function getApproved(uint256 tokenId) external view returns (address);181 function getApproved(uint256 tokenId) external view returns (address);
126182
127 // Not implemented183 // @dev Not implemented
128 //184 //
129 // Selector: isApprovedForAll(address,address) e985e9c5185 // Selector: isApprovedForAll(address,address) e985e9c5
130 function isApprovedForAll(address owner, address operator)186 function isApprovedForAll(address owner, address operator)
135191
136// Selector: 5b5e139f192// Selector: 5b5e139f
137interface ERC721Metadata is Dummy, ERC165 {193interface ERC721Metadata is Dummy, ERC165 {
194 // @notice A descriptive name for a collection of NFTs in this contract
195 //
138 // Selector: name() 06fdde03196 // Selector: name() 06fdde03
139 function name() external view returns (string memory);197 function name() external view returns (string memory);
140198
199 // @notice An abbreviated name for NFTs in this contract
200 //
141 // Selector: symbol() 95d89b41201 // Selector: symbol() 95d89b41
142 function symbol() external view returns (string memory);202 function symbol() external view returns (string memory);
143203
204 // @notice A distinct Uniform Resource Identifier (URI) for a given asset.
205 // @dev Throws if `tokenId` is not a valid NFT. URIs are defined in RFC
206 // 3986. The URI may point to a JSON file that conforms to the "ERC721
207 // Metadata JSON Schema".
144 // Returns token's const_metadata208 // @return token's const_metadata
145 //209 //
146 // Selector: tokenURI(uint256) c87b56dd210 // Selector: tokenURI(uint256) c87b56dd
147 function tokenURI(uint256 tokenId) external view returns (string memory);211 function tokenURI(uint256 tokenId) external view returns (string memory);
152 // Selector: mintingFinished() 05d2035b216 // Selector: mintingFinished() 05d2035b
153 function mintingFinished() external view returns (bool);217 function mintingFinished() external view returns (bool);
154218
219 // @notice Function to mint token.
155 // `token_id` should be obtained with `next_token_id` method,220 // @dev `tokenId` should be obtained with `nextTokenId` method,
156 // unlike standard, you can't specify it manually221 // unlike standard, you can't specify it manually
222 // @param to The new owner
223 // @param tokenId ID of the minted NFT
157 //224 //
158 // Selector: mint(address,uint256) 40c10f19225 // Selector: mint(address,uint256) 40c10f19
159 function mint(address to, uint256 tokenId) external returns (bool);226 function mint(address to, uint256 tokenId) external returns (bool);
160227
228 // @notice Function to mint token with the given tokenUri.
161 // `token_id` should be obtained with `next_token_id` method,229 // @dev `tokenId` should be obtained with `nextTokenId` method,
162 // unlike standard, you can't specify it manually230 // unlike standard, you can't specify it manually
231 // @param to The new owner
232 // @param tokenId ID of the minted NFT
233 // @param tokenUri Token URI that would be stored in the NFT properties
163 //234 //
164 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f235 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f
165 function mintWithTokenURI(236 function mintWithTokenURI(
168 string memory tokenUri239 string memory tokenUri
169 ) external returns (bool);240 ) external returns (bool);
170241
171 // Not implemented242 // @dev Not implemented
172 //243 //
173 // Selector: finishMinting() 7d64bcb4244 // Selector: finishMinting() 7d64bcb4
174 function finishMinting() external returns (bool);245 function finishMinting() external returns (bool);
175}246}
176247
177// Selector: 780e9d63248// Selector: 780e9d63
178interface ERC721Enumerable is Dummy, ERC165 {249interface ERC721Enumerable is Dummy, ERC165 {
250 // @notice Enumerate valid NFTs
251 // @dev Throws if `index` >= `totalSupply()`.
252 // @param index A counter less than `totalSupply()`
253 // @return The token identifier for the `index`th NFT,
254 // (sort order not specified)
255 //
179 // Selector: tokenByIndex(uint256) 4f6ccce7256 // Selector: tokenByIndex(uint256) 4f6ccce7
180 function tokenByIndex(uint256 index) external view returns (uint256);257 function tokenByIndex(uint256 index) external view returns (uint256);
181258
182 // Not implemented259 // @dev Not implemented
183 //260 //
184 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59261 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59
185 function tokenOfOwnerByIndex(address owner, uint256 index)262 function tokenOfOwnerByIndex(address owner, uint256 index)
186 external263 external
187 view264 view
188 returns (uint256);265 returns (uint256);
189266
267 // @notice Count NFTs tracked by this contract
268 // @return A count of valid NFTs tracked by this contract, where each one of
269 // them has an assigned and queryable owner not equal to the zero address
270 //
190 // Selector: totalSupply() 18160ddd271 // Selector: totalSupply() 18160ddd
191 function totalSupply() external view returns (uint256);272 function totalSupply() external view returns (uint256);
192}273}
257338
258// Selector: d74d154f339// Selector: d74d154f
259interface ERC721UniqueExtensions is Dummy, ERC165 {340interface ERC721UniqueExtensions is Dummy, ERC165 {
341 // @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
342 // TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE
343 // THEY MAY BE PERMANENTLY LOST
344 // @dev Throws unless `msg.sender` is the current owner. Throws if `to`
345 // is the zero address. Throws if `tokenId` is not a valid NFT.
346 // @param to The new owner
347 // @param tokenId The NFT to transfer
348 // @param _value Not used for an NFT
349 //
260 // Selector: transfer(address,uint256) a9059cbb350 // Selector: transfer(address,uint256) a9059cbb
261 function transfer(address to, uint256 tokenId) external;351 function transfer(address to, uint256 tokenId) external;
262352
353 // @notice Burns a specific ERC721 token.
354 // @dev Throws unless `msg.sender` is the current owner or an authorized
355 // operator for this NFT. Throws if `from` is not the current owner. Throws
356 // if `to` is the zero address. Throws if `tokenId` is not a valid NFT.
357 // @param from The current owner of the NFT
358 // @param tokenId The NFT to transfer
359 // @param _value Not used for an NFT
360 //
263 // Selector: burnFrom(address,uint256) 79cc6790361 // Selector: burnFrom(address,uint256) 79cc6790
264 function burnFrom(address from, uint256 tokenId) external;362 function burnFrom(address from, uint256 tokenId) external;
265363
364 // @notice Returns next free NFT ID.
365 //
266 // Selector: nextTokenId() 75794a3c366 // Selector: nextTokenId() 75794a3c
267 function nextTokenId() external view returns (uint256);367 function nextTokenId() external view returns (uint256);
268368
369 // @notice Function to mint multiple tokens.
370 // @dev `tokenIds` should be an array of consecutive numbers and first number
371 // should be obtained with `nextTokenId` method
372 // @param to The new owner
373 // @param tokenIds IDs of the minted NFTs
374 //
269 // Selector: mintBulk(address,uint256[]) 44a9945e375 // Selector: mintBulk(address,uint256[]) 44a9945e
270 function mintBulk(address to, uint256[] memory tokenIds)376 function mintBulk(address to, uint256[] memory tokenIds)
271 external377 external
272 returns (bool);378 returns (bool);
273379
380 // @notice Function to mint multiple tokens with the given tokenUris.
381 // @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive
382 // numbers and first number should be obtained with `nextTokenId` method
383 // @param to The new owner
384 // @param tokens array of pairs of token ID and token URI for minted tokens
385 //
274 // Selector: mintBulkWithTokenURI(address,(uint256,string)[]) 36543006386 // Selector: mintBulkWithTokenURI(address,(uint256,string)[]) 36543006
275 function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)387 function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)
276 external388 external