ERC721AUpgradeableInternal

ERC721AUpgradeableInternal

_Implementation of the ERC721 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)._

_BITMASK_ADDRESS_DATA_ENTRY

uint256 _BITMASK_ADDRESS_DATA_ENTRY

_BITPOS_NUMBER_MINTED

uint256 _BITPOS_NUMBER_MINTED

_BITPOS_NUMBER_BURNED

uint256 _BITPOS_NUMBER_BURNED

_BITPOS_AUX

uint256 _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

_startTokenId

Returns the starting token ID. To change the starting token ID, please override this function.

_nextTokenId

Returns the next token ID to be minted.

_totalMinted

Returns the total amount of tokens minted in the contract.

_totalBurned

Returns the total number of tokens burned.

_numberMinted

Returns the number of tokens minted by owner.

_numberBurned

Returns the number of tokens burned by or on behalf of owner.

_getAux

Returns the auxiliary data for owner. (e.g. number of whitelist mint slots used).

_setAux

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.

_baseURI

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.

_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 unpacked TokenOwnership struct at index.

_ownershipIsInitialized

Returns whether the ownership slot at index is initialized. An uninitialized slot does not necessarily mean that the slot has no owner.

_initializeOwnershipAt

Initializes the ownership slot minted at index for efficiency purposes.

_packedOwnershipOf

Returns the packed ownership data of tokenId.

_unpackedOwnership

Returns the unpacked TokenOwnership struct from packed.

_packOwnershipData

Packs ownership data into a single uint256.

_nextInitializedFlag

Returns the nextInitialized flag set if quantity equals 1.

_exists

_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}.

_isSenderApprovedOrOwner

Returns whether msgSender is equal to approvedAddress or owner.

_getApprovedSlotAndAddress

Returns the storage slot and value for the approved address of tokenId.

_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 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._

_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 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._

_checkContractOnERC721Received

_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._

_mint

_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._

_mintERC2309

_Mints quantity tokens and transfers them to to.

This function is intended for efficient minting only during contract creation.

It emits only one {ConsecutiveTransfer} as defined in ERC2309, instead of a sequence of {Transfer} 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 {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._

_safeMint

_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._

_safeMint

Equivalent to _safeMint(to, quantity, '').

_approve

Equivalent to _approve(to, tokenId, false).

_ownerOf

_approve

_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._

_burn

Equivalent to _burn(tokenId, false).

_isApprovedForAll

_burn

_Destroys tokenId. The approval is cleared when the token is burned.

Requirements:

  • tokenId must exist.

Emits a {Transfer} event._

_setExtraDataAt

Directly sets the extra data for the ownership data index.

_extraData

_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._

_nextExtraData

Returns the next extra data for the packed ownership data. The returned result is shifted into position.

_msgSenderERC721A

_Returns the message sender (defaults to msg.sender).

If you are writing GSN compatible contracts, you need to override this function._

_toString

Converts a uint256 to its ASCII string decimal representation.

_revert

For more efficient reverts.

Was this helpful?