_startTokenId()
.
The _sequentialUpTo()
function can be overriden to enable spot mints
(i.e. non-consecutive mints) for tokenId
s greater than _sequentialUpTo()
.
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).
State Variables
_BITMASK_ADDRESS_DATA_ENTRY
_BITPOS_NUMBER_MINTED
_BITPOS_NUMBER_BURNED
_BITPOS_AUX
_BITMASK_AUX_COMPLEMENT
_BITPOS_START_TIMESTAMP
_BITMASK_BURNED
_BITPOS_NEXT_INITIALIZED
_BITMASK_NEXT_INITIALIZED
_BITPOS_EXTRA_DATA
_BITMASK_EXTRA_DATA_COMPLEMENT
_BITMASK_ADDRESS
_MAX_MINT_ERC2309_QUANTITY_LIMIT
_TRANSFER_EVENT_SIGNATURE
_currentIndex
_burnCounter
_name
_symbol
_packedOwnerships
_packedAddressData
_tokenApprovals
_operatorApprovals
_spotMinted
Functions
constructor
_startTokenId
Returns the starting token ID for sequential mints. Override this function to change the starting token ID for sequential mints. Note: The value returned must never change after any tokens have been minted._sequentialUpTo
Returns the maximum token ID (inclusive) for sequential mints. Override this function to return a value less than 2**256 - 1, but greater than_startTokenId()
, to enable spot (non-sequential) mints.
Note: The value returned must never change after any tokens have been minted.
_nextTokenId
Returns the next token ID to be minted.totalSupply
Returns the total number of tokens in existence. Burned tokens will reduce the count. To get the total number of tokens minted, please see _totalMinted._totalMinted
Returns the total amount of tokens minted in the contract._totalBurned
Returns the total number of tokens burned._totalSpotMinted
Returns the total number of tokens that are spot-minted.balanceOf
Returns the number of tokens inowner
’s account.
_numberMinted
Returns the number of tokens minted byowner
.
_numberBurned
Returns the number of tokens burned by or on behalf ofowner
.
_getAux
Returns the auxiliary data forowner
. (e.g. number of whitelist mint slots used).
_setAux
Sets the auxiliary data forowner
. (e.g. number of whitelist mint slots used).
If there are multiple variables, please pack them into a uint64.
supportsInterface
Returns true if this contract implements the interface defined byinterfaceId
. See the corresponding
EIP section
to learn more about how these ids are created.
This function call must use less than 30000 gas.
name
Returns the token collection name.symbol
Returns the token collection symbol.tokenURI
Returns the Uniform Resource Identifier (URI) fortokenId
token.
_baseURI
Base URI for computing tokenURI. If set, the resulting URI for each token will be the concatenation of thebaseURI
and the tokenId
. Empty
by default, it can be overridden in child contracts.
ownerOf
*Returns the owner of thetokenId
token.
Requirements:
tokenId
must exist.*
_ownershipOf
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._ownershipAt
Returns the unpackedTokenOwnership
struct at index
.
_ownershipIsInitialized
Returns whether the ownership slot atindex
is initialized.
An uninitialized slot does not necessarily mean that the slot has no owner.
_initializeOwnershipAt
Initializes the ownership slot minted atindex
for efficiency purposes.
_packedOwnershipOf
Returns the packed ownership data oftokenId
.
_unpackedOwnership
Returns the unpackedTokenOwnership
struct from packed
.
_packOwnershipData
Packs ownership data into a single uint256._nextInitializedFlag
Returns thenextInitialized
flag set if quantity
equals 1.
approve
*Gives permission toto
to transfer tokenId
token to another account. See ERC721A-_approve.
Requirements:
- The caller must own the token or be an approved operator.*
getApproved
*Returns the account approved fortokenId
token.
Requirements:
tokenId
must exist.*
setApprovalForAll
*Approve or removeoperator
as an operator for the caller.
Operators can call transferFrom or
for any token owned by the caller.
Requirements:
- The
operator
cannot be the caller. Emits an event.*
isApprovedForAll
Returns if theoperator
is allowed to manage all of the assets of owner
.
See setApprovalForAll.
_exists
Returns whethertokenId
exists.
Tokens can be managed by their owner or approved accounts via approve or .
Tokens start existing when they are minted. See {\_mint}
.
_packedOwnershipExists
Returns whetherpacked
represents a token that exists.
_isSenderApprovedOrOwner
Returns whethermsgSender
is equal to approvedAddress
or owner
.
_getApprovedSlotAndValue
Returns the storage slot and value for the approved address oftokenId
casted to a uint256.
transferFrom
*TransferstokenId
from from
to to
.
Requirements:
from
cannot be the zero address.to
cannot be the zero address.tokenId
token must be owned byfrom
.- If the caller is not
from
, it must be approved to move this token by either approve or . Emits a event.*
safeTransferFrom
Equivalent tosafeTransferFrom(from, to, tokenId, '')
.
safeTransferFrom
*Safely transferstokenId
token from from
to to
.
Requirements:
from
cannot be the zero address.to
cannot be the zero address.tokenId
token must exist and be owned byfrom
.- If the caller is not
from
, it must be approved to move this token by either approve or{setApprovalForAll}
. - If
to
refers to a smart contract, it must implement{IERC721Receiver-onERC721Received}
, which is called upon a safe transfer. Emits a event.*
_batchTransferFrom
Equivalent to_batchTransferFrom(from, to, tokenIds)
.
_batchTransferFrom
*TransferstokenIds
in batch from from
to to
.
Requirements:
from
cannot be the zero address.to
cannot be the zero address.tokenIds
tokens must be owned byfrom
.tokenIds
must be strictly ascending.- If
by
is notfrom
, it must be approved to move these tokens by either approve or .by
is the address that to check token approval for. If token approval check is not needed, pass inaddress(0)
forby
. Emits a event for each transfer.*
_safeBatchTransferFrom
*Safely transferstokenIds
in batch from from
to to
.
Requirements:
from
cannot be the zero address.to
cannot be the zero address.tokenIds
tokens must be owned byfrom
.- If
by
is notfrom
, it must be approved to move these tokens by either approve or{setApprovalForAll}
. - If
to
refers to a smart contract, it must implement{IERC721Receiver-onERC721Received}
, which is called for each transferred token.by
is the address that to check token approval for. If token approval check is not needed, pass inaddress(0)
forby
. Emits a event for each transfer.*
_beforeTokenTransfers
*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
andto
are both non-zero,from
’stokenId
will be transferred toto
. - When
from
is zero,tokenId
will be minted forto
. - When
to
is zero,tokenId
will be burned byfrom
. from
andto
are never both zero.*
_afterTokenTransfers
*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
andto
are both non-zero,from
’stokenId
has been transferred toto
. - When
from
is zero,tokenId
has been minted forto
. - When
to
is zero,tokenId
has been burned byfrom
. from
andto
are never both zero.*
_checkContractOnERC721Received
Private 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.
_mint
*Mintsquantity
tokens and transfers them to to
.
Requirements:
to
cannot be the zero address.quantity
must be greater than 0. Emits a event for each mint.*
_mintERC2309
*Mintsquantity
tokens and transfers them to to
.
This function is intended for efficient minting only during contract creation.
It emits only one as defined in
ERC2309,
instead of a sequence of event(s).
Calling this function outside of contract creation WILL make your contract
non-compliant with the ERC721 standard.
For full ERC721 compliance, substituting ERC721 event(s) with the ERC2309
event is only permissible during contract creation.
Requirements:
to
cannot be the zero address.quantity
must be greater than 0. Emits a event.*
_safeMint
*Safely mintsquantity
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 event for each mint.*
_safeMint
Equivalent to_safeMint(to, quantity, '')
.
_mintSpot
*Mints a single token attokenId
.
Note: A spot-minted tokenId
that has been burned can be re-minted again.
Requirements:
to
cannot be the zero address.tokenId
must be greater than_sequentialUpTo()
.tokenId
must not exist. Emits a event for each mint.*
_safeMintSpot
*Safely mints a single token attokenId
.
Note: A spot-minted tokenId
that has been burned can be re-minted again.
Requirements:
- If
to
refers to a smart contract, it must implement IERC721Receiver-onERC721Received. tokenId
must be greater than_sequentialUpTo()
.tokenId
must not exist. See{\_mintSpot}
. Emits a{Transfer}
event.*
_safeMintSpot
Equivalent to_safeMintSpot(to, tokenId, '')
.
_approve
Equivalent to_approve(to, tokenId, false)
.
_approve
*Gives permission toto
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 event.*
_burn
Equivalent to_burn(tokenId, false)
.
_burn
*DestroystokenId
.
The approval is cleared when the token is burned.
Requirements:
tokenId
must exist. Emits a event.*
_batchBurn
*DestroystokenIds
.
Approvals are not cleared when tokenIds are burned.
Requirements:
tokenIds
must exist.tokenIds
must be strictly ascending.by
must be approved to burn these tokens by either approve or .by
is the address that to check token approval for. If token approval check is not needed, pass inaddress(0)
forby
. Emits a event for each token burned.*
_setExtraDataAt
Directly sets the extra data for the ownership dataindex
.
_extraData
*Called during each token transfer to set the 24bitextraData
field.
Intended to be overridden by the cosumer contract.
previousExtraData
- the value of extraData
before transfer.
Calling conditions:
- When
from
andto
are both non-zero,from
’stokenId
will be transferred toto
. - When
from
is zero,tokenId
will be minted forto
. - When
to
is zero,tokenId
will be burned byfrom
. from
andto
are never both zero.*
_nextExtraData
Returns the next extra data for the packed ownership data. The returned result is shifted into position._mdataERC721A
Returns a memory pointer to the start ofa
’s data.
_mloadERC721A
Returns the uint256 atp
in memory.
_orERC721A
Branchless boolean or._msgSenderERC721A
Returns the message sender (defaults tomsg.sender
).
If you are writing GSN compatible contracts, you need to override this function.