ERC721AUpgradeableInternal
Was this helpful?
Was this helpful?
_Implementation of the Non-Fungible Token Standard, including the Metadata extension. Optimized for lower gas during batch mints.
Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) starting from _startTokenId()
.
Assumptions:
An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
The maximum token ID cannot exceed 2**256 - 1 (max value of uint256)._
Returns the starting token ID. To change the starting token ID, please override this function.
Returns the next token ID to be minted.
Returns the total amount of tokens minted in the contract.
Returns the total number of tokens burned.
Returns the number of tokens minted by owner
.
Returns the number of tokens burned by or on behalf of owner
.
Returns the auxiliary data for owner
. (e.g. number of whitelist mint slots used).
Sets the auxiliary data for owner
. (e.g. number of whitelist mint slots used). If there are multiple variables, please pack them into a uint64.
Base URI for computing {tokenURI}. If set, the resulting URI for each token will be the concatenation of the baseURI
and the tokenId
. Empty by default, it can be overridden in child contracts.
Gas spent here starts off proportional to the maximum mint batch size. It gradually moves to O(1) as tokens get transferred around over time.
Returns the unpacked TokenOwnership
struct at index
.
Returns whether the ownership slot at index
is initialized. An uninitialized slot does not necessarily mean that the slot has no owner.
Initializes the ownership slot minted at index
for efficiency purposes.
Returns the packed ownership data of tokenId
.
Returns the unpacked TokenOwnership
struct from packed
.
Packs ownership data into a single uint256.
Returns the nextInitialized
flag set if quantity
equals 1.
_Returns whether tokenId
exists.
Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
Tokens start existing when they are minted. See {mint}.
Returns whether msgSender
is equal to approvedAddress
or owner
.
Returns the storage slot and value for the approved address of tokenId
.
_Hook that is called before a set of serially-ordered token IDs are about to be transferred. This includes minting. And also called before burning one token.
startTokenId
- the first token ID to be transferred. quantity
- the amount to be transferred.
Calling conditions:
When from
and to
are both non-zero, from
's tokenId
will be transferred to to
.
When from
is zero, tokenId
will be minted for to
.
When to
is zero, tokenId
will be burned by from
.
from
and to
are never both zero._
_Hook that is called after a set of serially-ordered token IDs have been transferred. This includes minting. And also called after one token has been burned.
startTokenId
- the first token ID to be transferred. quantity
- the amount to be transferred.
Calling conditions:
When from
and to
are both non-zero, from
's tokenId
has been transferred to to
.
When from
is zero, tokenId
has been minted for to
.
When to
is zero, tokenId
has been burned by from
.
from
and to
are never both zero._
_internal function to invoke {IERC721Receiver-onERC721Received} on a target contract.
from
- Previous owner of the given token ID. to
- Target address that will receive the token. tokenId
- Token ID to be transferred. _data
- Optional data to send along with the call.
Returns whether the call correctly returned the expected magic value._
_Mints quantity
tokens and transfers them to to
.
Requirements:
to
cannot be the zero address.
quantity
must be greater than 0.
Emits a {Transfer} event for each mint._
_Mints quantity
tokens and transfers them to to
.
This function is intended for efficient minting only during contract creation.
Calling this function outside of contract creation WILL make your contract non-compliant with the ERC721 standard. For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 {ConsecutiveTransfer} event is only permissible during contract creation.
Requirements:
to
cannot be the zero address.
quantity
must be greater than 0.
Emits a {ConsecutiveTransfer} event._
_Safely mints quantity
tokens and transfers them to to
.
Requirements:
If to
refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
quantity
must be greater than 0.
See {_mint}.
Emits a {Transfer} event for each mint._
Equivalent to _safeMint(to, quantity, '')
.
Equivalent to _approve(to, tokenId, false)
.
_Gives permission to to
to transfer tokenId
token to another account. The approval is cleared when the token is transferred.
Only a single account can be approved at a time, so approving the zero address clears previous approvals.
Requirements:
tokenId
must exist.
Emits an {Approval} event._
Equivalent to _burn(tokenId, false)
.
_Destroys tokenId
. The approval is cleared when the token is burned.
Requirements:
tokenId
must exist.
Emits a {Transfer} event._
Directly sets the extra data for the ownership data index
.
_Called during each token transfer to set the 24bit extraData
field. Intended to be overridden by the cosumer contract.
previousExtraData
- the value of extraData
before transfer.
Calling conditions:
When from
and to
are both non-zero, from
's tokenId
will be transferred to to
.
When from
is zero, tokenId
will be minted for to
.
When to
is zero, tokenId
will be burned by from
.
from
and to
are never both zero._
Returns the next extra data for the packed ownership data. The returned result is shifted into position.
_Returns the message sender (defaults to msg.sender
).
If you are writing GSN compatible contracts, you need to override this function._
Converts a uint256 to its ASCII string decimal representation.
For more efficient reverts.
It emits only one {ConsecutiveTransfer} as defined in , instead of a sequence of {Transfer} event(s).