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
Name | Type | Description |
---|---|---|
from | address | The address transferring the token. |
to | address | The address receiving the token. |
tokenId | uint256 | The 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
Name | Type | Description |
---|---|---|
owner | address | The owner of the token. |
approved | address | The new approved address. |
tokenId | uint256 | The ID of the token. |
ApprovalForAll
event ApprovalForAll(address owner, address operator, bool approved)
Emitted when operator gets the allowance from owner.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The owner of the token. |
operator | address | The operator to get the approval. |
approved | bool | True 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
Name | Type | Description |
---|---|---|
owner | address | The address to query the balance of. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The balance of the specified address. |
ownerOf
function ownerOf(uint256 tokenId) public view returns (address)
Returns the owner of the specified token ID.
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The ID of the token to query the owner for. |
Return Values
Name | Type | Description |
---|---|---|
[0] | address | The address of the owner of the token. |
_requireNftExists
function _requireNftExists(uint256 tokenId) internal view
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 theonERC721Received
function and return the magic value._
Parameters
Name | Type | Description |
---|---|---|
from | address | The address to transfer the token from. |
to | address | The address to transfer the token to. |
tokenId | uint256 | The ID of the token to be transferred. |
data | bytes | Additional 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
Name | Type | Description |
---|---|---|
from | address | The address to transfer the token from. |
to | address | The address to transfer the token to. |
tokenId | uint256 | The 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
Name | Type | Description |
---|---|---|
from | address | The address to transfer the token from. |
to | address | The address to transfer the token to. |
tokenId | uint256 | The 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
Name | Type | Description |
---|---|---|
approved | address | The address to be approved for token transfer. |
tokenId | uint256 | The 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
Name | Type | Description |
---|---|---|
operator | address | The address of the operator to set approval for. |
approved | bool | A 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
Name | Type | Description |
---|---|---|
tokenId | uint256 | The ID of the token. |
Return Values
Name | Type | Description |
---|---|---|
[0] | address | The 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
Name | Type | Description |
---|---|---|
owner | address | The address of the token owner. |
operator | address | The address of the operator. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | A 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
Name | Type | Description |
---|---|---|
interfaceID | bytes4 | The interface identifier. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | A 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)