Skip to main content
Version: v1.3

ERC721NFTs

ERC721NFTs

This contract represents the ERC721 contract for the "global" collection of native NFTs on the chains L1 account.

Transfer

event Transfer(address from, address to, uint256 tokenId)

Emitted when a token is transferred from one address to another.

Parameters

NameTypeDescription
fromaddressThe address transferring the token.
toaddressThe address receiving the token.
tokenIduint256The ID of the token being transferred.

Approval

event Approval(address owner, address approved, uint256 tokenId)

Emitted when the approval of a token is changed or reaffirmed.

Parameters

NameTypeDescription
owneraddressThe owner of the token.
approvedaddressThe new approved address.
tokenIduint256The ID of the token.

ApprovalForAll

event ApprovalForAll(address owner, address operator, bool approved)

Emitted when operator gets the allowance from owner.

Parameters

NameTypeDescription
owneraddressThe owner of the token.
operatoraddressThe operator to get the approval.
approvedboolTrue if the operator got approval, false if not.

_balanceOf

function _balanceOf(struct ISCAgentID owner) internal view virtual returns (uint256)

_isManagedByThisContract

function _isManagedByThisContract(struct ISCNFT) internal view virtual returns (bool)

balanceOf

function balanceOf(address owner) public view returns (uint256)

Returns the number of tokens owned by a specific address.

Parameters

NameTypeDescription
owneraddressThe address to query the balance of.

Return Values

NameTypeDescription
[0]uint256The balance of the specified address.

ownerOf

function ownerOf(uint256 tokenId) public view returns (address)

Returns the owner of the specified token ID.

Parameters

NameTypeDescription
tokenIduint256The ID of the token to query the owner for.

Return Values

NameTypeDescription
[0]addressThe address of the owner of the token.

safeTransferFrom

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

_Safely transfers an ERC721 token from one address to another.

Emits a Transfer event.

Requirements:

  • from cannot be the zero address.
  • to cannot be the zero address.
  • The token must exist and be owned by from.
  • If to is a smart contract, it must implement the onERC721Received function and return the magic value._

Parameters

NameTypeDescription
fromaddressThe address to transfer the token from.
toaddressThe address to transfer the token to.
tokenIduint256The ID of the token to be transferred.
databytesAdditional data with no specified format, to be passed to the onERC721Received function if to is a smart contract.

safeTransferFrom

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

_Safely transfers an ERC721 token from one address to another.

Emits a Transfer event.

Requirements:

  • from cannot be the zero address.
  • to cannot be the zero address.
  • The caller must own the token or be approved for it._

Parameters

NameTypeDescription
fromaddressThe address to transfer the token from.
toaddressThe address to transfer the token to.
tokenIduint256The ID of the token to be transferred.

transferFrom

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

_Transfers an ERC721 token from one address to another. Emits a {Transfer} event.

Requirements:

  • The caller must be approved or the owner of the token._

Parameters

NameTypeDescription
fromaddressThe address to transfer the token from.
toaddressThe address to transfer the token to.
tokenIduint256The ID of the token to be transferred.

approve

function approve(address approved, uint256 tokenId) public payable

Only the owner of the token or an approved operator can call this function.

Approves another address to transfer the ownership of a specific token.

Parameters

NameTypeDescription
approvedaddressThe address to be approved for token transfer.
tokenIduint256The ID of the token to be approved for transfer.

setApprovalForAll

function setApprovalForAll(address operator, bool approved) public

Sets or revokes approval for the given operator to manage all of the caller's tokens.

Parameters

NameTypeDescription
operatoraddressThe address of the operator to set approval for.
approvedboolA boolean indicating whether to approve or revoke the operator's approval.

getApproved

function getApproved(uint256 tokenId) public view returns (address)

Returns the address that has been approved to transfer the ownership of the specified token.

Parameters

NameTypeDescription
tokenIduint256The ID of the token.

Return Values

NameTypeDescription
[0]addressThe address approved to transfer the ownership of the token.

isApprovedForAll

function isApprovedForAll(address owner, address operator) public view returns (bool)

Checks if an operator is approved to manage all of the owner's tokens.

Parameters

NameTypeDescription
owneraddressThe address of the token owner.
operatoraddressThe address of the operator.

Return Values

NameTypeDescription
[0]boolA boolean value indicating whether the operator is approved for all tokens of the owner.

_isApprovedOrOwner

function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool)

_transferFrom

function _transferFrom(address from, address to, uint256 tokenId) internal

supportsInterface

function supportsInterface(bytes4 interfaceID) public pure returns (bool)

Checks if a contract supports a given interface.

Parameters

NameTypeDescription
interfaceIDbytes4The interface identifier.

Return Values

NameTypeDescription
[0]boolA boolean value indicating whether the contract supports the interface.

_checkOnERC721Received

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

_isContract

function _isContract(address account) internal view returns (bool)

name

function name() external view virtual returns (string)

symbol

function symbol() external pure returns (string)

tokenURI

function tokenURI(uint256 tokenId) external view returns (string)

__erc721NFTs

contract ERC721NFTs __erc721NFTs

IERC721Receiver

onERC721Received

function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes _data) external returns (bytes4)