Solidity API
SpanningERC721
Implementation of the {ISpanningERC721} interface.
name_
string name_
symbol_
string symbol_
owners_
mapping(uint256 => bytes32) owners_
balances_
mapping(bytes32 => uint256) balances_
tokenApprovals_
mapping(uint256 => bytes32) tokenApprovals_
operatorApprovals_
mapping(bytes32 => mapping(bytes32 => bool)) operatorApprovals_
onlyOwnerOrApproved
modifier onlyOwnerOrApproved(uint256 tokenId)
constructor
constructor(string nameIn, string symbolIn, address delegate) internal
Creates the instance and assigns required values.
Name | Type | Description |
---|---|---|
nameIn | string | - Desired name for the token collection |
symbolIn | string | - Desired symbol for the token collection |
delegate | address | - Legacy (local) address for the Spanning Delegate |
supportsInterface
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)
See {IERC165-supportsInterface}.
balanceOf
function balanceOf(address accountLegacyAddress) public view virtual returns (uint256)
See {IERC721-balanceOf}.
balanceOf
function balanceOf(bytes32 accountAddress) public view virtual returns (uint256)
Returns the number of tokens owned by an account.
Name | Type | Description |
---|---|---|
accountAddress | bytes32 | - Address to be queried |
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 - Number of tokens owned by an account |
ownerOf
function ownerOf(uint256 tokenId) public view virtual returns (address)
See {IERC721-ownerOf}.
ownerOfSpanning
function ownerOfSpanning(uint256 tokenId) public view virtual returns (bytes32)
See {IERC721-ownerOf}.
name
function name() public view virtual returns (string)
See {IERC721Metadata-name}.
symbol
function symbol() public view virtual returns (string)
See {IERC721Metadata-symbol}.
tokenURI
function tokenURI(uint256 tokenId) public view virtual returns (string)
See {IERC721Metadata-tokenURI}.
_baseURI
function _baseURI() internal view virtual returns (string)
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, can be overridden in child contracts.
approve
function approve(address receiverLegacyAddress, uint256 tokenId) public virtual
See {IERC721-approve}.
approve
function approve(bytes32 receiverAddress, uint256 tokenId) public virtual
Sets a token allowance for a pair of addresses (sender and receiver).
Name | Type | Description |
---|---|---|
receiverAddress | bytes32 | - Address of the allowance receiver |
tokenId | uint256 | - Token allowance to be approved |
getApproved
function getApproved(uint256 tokenId) public view virtual returns (address)
See {IERC721-getApproved}.
getApprovedSpanning
function getApprovedSpanning(uint256 tokenId) public view virtual returns (bytes32)
Returns the account approved for a token.
Name | Type | Description |
---|---|---|
tokenId | uint256 | - Token to be queried |
Name | Type | Description |
---|---|---|
[0] | bytes32 | bytes32 - Address of the account approved for a token |
setApprovalForAll
function setApprovalForAll(address receiverLegacyAddress, bool shouldApprove) public virtual
See {IERC721-setApprovalForAll}.
setApprovalForAll
function setApprovalForAll(bytes32 receiverAddress, bool shouldApprove) public virtual
Allows an account to have control over another account's tokens.
Name | Type | Description |
---|---|---|
receiverAddress | bytes32 | - Address of the allowance receiver (gains control) |
shouldApprove | bool | - Whether to approve or revoke the approval |
isApprovedForAll
function isApprovedForAll(address senderLegacyAddress, address receiverLegacyAddress) public view virtual returns (bool)
See {IERC721-isApprovedForAll}.
isApprovedForAll
function isApprovedForAll(bytes32 senderAddress, bytes32 receiverAddress) public view virtual returns (bool)
Indicates if an account has total control over another's assets.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address of the allowance sender (cede control) |
receiverAddress | bytes32 | - Address of the allowance receiver (gains control) |
Name | Type | Description |
---|---|---|
[0] | bool | bool - Indicates whether the account is approved for all |
transferFrom
function transferFrom(address senderLegacyAddress, address receiverLegacyAddress, uint256 tokenId) public virtual
See {IERC721-transferFrom}.
transferFrom
function transferFrom(bytes32 senderAddress, bytes32 receiverAddress, uint256 tokenId) public virtual
Moves requested tokens between accounts.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address of the sender |
receiverAddress | bytes32 | - Address of the receiver |
tokenId | uint256 | - Token to be transferred |
safeTransferFrom
function safeTransferFrom(address senderLegacyAddress, address receiverLegacyAddress, uint256 tokenId) public virtual
See {IERC721-safeTransferFrom}.
safeTransferFrom
function safeTransferFrom(bytes32 senderAddress, bytes32 receiverAddress, uint256 tokenId) public virtual
Safely moves requested tokens between accounts.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address of the sender |
receiverAddress | bytes32 | - Address of the receiver |
tokenId | uint256 | - Token to be transferred |
safeTransferFrom
function safeTransferFrom(address senderLegacyAddress, address receiverLegacyAddress, uint256 tokenId, bytes payload) public virtual
See {IERC721-safeTransferFrom}.
safeTransferFrom
function safeTransferFrom(bytes32 senderAddress, bytes32 receiverAddress, uint256 tokenId, bytes payload) public virtual
Safely moves requested tokens between accounts, including data.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address of the sender |
receiverAddress | bytes32 | - Address of the receiver |
tokenId | uint256 | - Token to be transferred |
payload | bytes | - Additional, unstructured data to be included |
_safeTransfer
function _safeTransfer(bytes32 senderAddress, bytes32 receiverAddress, uint256 tokenId, bytes payload) internal virtual
Safely transfers a token between accounts, checking for ERC721 validity.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address of the sender |
receiverAddress | bytes32 | - Address of the receiver |
tokenId | uint256 | - Token to be transferred |
payload | bytes | - Additional, unstructured data to be included |
_exists
function _exists(uint256 tokenId) internal view virtual returns (bool)
Checks if the token exists (has been minted but not burned).
Name | Type | Description |
---|---|---|
tokenId | uint256 | - Token to be checked |
Name | Type | Description |
---|---|---|
[0] | bool | bool - Whether the token exists |
_isApprovedOrOwner
function _isApprovedOrOwner(bytes32 receiverAddress, uint256 tokenId) internal view virtual returns (bool)
Checks if the account is authorized to spend the token.
Name | Type | Description |
---|---|---|
receiverAddress | bytes32 | - Address of the receiver |
tokenId | uint256 | - Token to be checked |
Name | Type | Description |
---|---|---|
[0] | bool | bool - Whether the account is authorized to spend the token |
_safeMint
function _safeMint(bytes32 receiverAddress, uint256 tokenId) internal virtual
Safely mints a new token to an account
Name | Type | Description |
---|---|---|
receiverAddress | bytes32 | - Address of the receiver |
tokenId | uint256 | - Token to be minted |
_safeMint
function _safeMint(bytes32 receiverAddress, uint256 tokenId, bytes payload) internal virtual
Safely mints a new token to an account
Name | Type | Description |
---|---|---|
receiverAddress | bytes32 | - Address of the receiver |
tokenId | uint256 | - Token to be minted |
payload | bytes | - Additional, unstructured data to be included |
_mint
function _mint(bytes32 receiverAddress, uint256 tokenId) internal virtual
Mints a new token to an account
Name | Type | Description |
---|---|---|
receiverAddress | bytes32 | - Address of the receiver |
tokenId | uint256 | - Token to be minted |
_burn
function _burn(uint256 tokenId) internal virtual
Burns the token
Name | Type | Description |
---|---|---|
tokenId | uint256 | - Token to be burned |
_transfer
function _transfer(bytes32 senderAddress, bytes32 receiverAddress, uint256 tokenId) internal virtual
Transfers the token between accounts
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address of the sender |
receiverAddress | bytes32 | - Address of the receiver |
tokenId | uint256 | - Token to be transferred |
_approve
function _approve(bytes32 receiverAddress, uint256 tokenId) internal virtual
Sets a token allowance for a pair of addresses (sender and receiver).
Name | Type | Description |
---|---|---|
receiverAddress | bytes32 | - Address of the allowance receiver |
tokenId | uint256 | - Token allowance to be approved |
_setApprovalForAll
function _setApprovalForAll(bytes32 receiverAddress, bool shouldApprove) internal virtual
Allows an account to have control over another account's tokens.
Name | Type | Description |
---|---|---|
receiverAddress | bytes32 | - Address of the allowance receiver (gains control) |
shouldApprove | bool | - Whether to approve or revoke the approval |
_checkOnERC721Received
function _checkOnERC721Received(bytes32 senderAddress, bytes32 receiverAddress, uint256 tokenId, bytes payload) private returns (bool)
Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address of the sender |
receiverAddress | bytes32 | - Address of the receiver |
tokenId | uint256 | - Token to be transferred |
payload | bytes | - Additional, unstructured data to be included |
Name | Type | Description |
---|---|---|
[0] | bool | bool - If call correctly returned the expected magic value |
_beforeTokenTransfer
function _beforeTokenTransfer(bytes32 senderAddress, bytes32 receiverAddress, uint256 tokenId) internal virtual
Hook that is called before any transfer of tokens.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address initiating the transfer |
receiverAddress | bytes32 | - Address receiving the transfer |
tokenId | uint256 | - Token to be transferred |
_afterTokenTransfer
function _afterTokenTransfer(bytes32 senderAddress, bytes32 receiverAddress, uint256 tokenId) internal virtual
Hook that is called after any burn of tokens.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address sending tokens to burn |
receiverAddress | bytes32 | - Unused |
tokenId | uint256 | - Token to be burned |