ODCdataManagersERC721extensions

ERC721Transfers

Abstract contract that provides ERC721 transfer functions of the ERC721 Data Manager

Based on OpenZeppelin ERC721 implementation

safeTransferFrom

function safeTransferFrom(address from, address to, uint256 tokenId) public virtual

Transfers tokenId token from from to to

The caller must have allowance for from's tokens or be from

Parameters

NameTypeDescription
fromaddressSource address
toaddressDestination address
tokenIduint256Token ID

safeTransferFrom

function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) public virtual

Transfers tokenId token from from to to

The caller must have allowance for from's tokens or be from

Parameters

NameTypeDescription
fromaddressSource address
toaddressDestination address
tokenIduint256Token ID
databytesAdditional data with no specified format

transferFrom

function transferFrom(address from, address to, uint256 tokenId) public virtual

Transfers tokenId token from from to to

The caller must have allowance for from's tokens or be from NOTE: This function is not safe, use {safeTransferFrom} when possible

Parameters

NameTypeDescription
fromaddressSource address
toaddressDestination address
tokenIduint256Token ID

_isAuthorized

function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool)

_Returns whether spender is allowed to manage owner's tokens, or tokenId in particular (ignoring whether it is owned by owner).

WARNING: This function assumes that owner is the actual owner of tokenId and does not verify this assumption._

_checkAuthorized

function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual

_Checks if spender can operate on tokenId, assuming the provided owner is the actual owner. Reverts if:

  • spender does not have approval from owner for tokenId.
  • spender does not have approval to manage all of owner's assets.

WARNING: This function assumes that owner is the actual owner of tokenId and does not verify this assumption._

_update

function _update(address to, uint256 tokenId, address auth) internal virtual returns (address)

_Transfers tokenId from its current owner to to, or alternatively mints (or burns) if the current owner (or to) is the zero address. Returns the owner of the tokenId before the update.

The auth argument is optional. If the value passed is non 0, then this function will check that auth is either the owner of the token, or approved to operate on the token (by the owner).

Emits a {Transfer} event.

NOTE: If overriding this function in a way that tracks balances, see also {increaseBalance}.

_writeTransfer

function _writeTransfer(address from, address to, uint256 tokenId) internal virtual

_checkOnERC721Received

function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes data) internal

Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the recipient doesn't accept the token transfer. The call is not executed if the target address is not a contract.

Parameters

NameTypeDescription
fromaddressaddress representing the previous owner of the given token ID
toaddresstarget address that will receive the tokens
tokenIduint256uint256 ID of the token to be transferred
databytesbytes optional data to send along with the call

On this page