AthenaCoverToken
The AthenaCoverToken contract is a slightly modified ERC-721 token representing a cover in the Athena protocol. The contract includes the ERC721Enumerable extension, which adds enumerability of all the token IDs in the contract as well as all token IDs owned by each account. An additional Athena-specific method, tokensOf(), is also included to easily retrieve all the token IDs owned by an account.
The Athena cover ID is equivalent to the token's ERC-721 token ID.
State variables info
baseDataURI
The base URI for the token metadata. The metadata does NOT include the cover's parameters. To retrieve the cover's parameters, use the LiquidityManager contract's coverInfo() function.
nextCoverId
The ID of the next cover to be minted.
Read Functions info
name
Returns the token collection name.
symbol
Returns the token collection symbol.
tokenURI
Returns the Uniform Resource Identifier (URI) for tokenId
token.
balanceOf
Returns the number of tokens in owner
's account.
ownerOf
Returns the owner of the tokenId
token.
Requirements:
tokenId
must exist.
getApproved
Returns the account approved for tokenId
token.
Requirements:
tokenId
must exist.
isApprovedForAll
Returns if the operator
is allowed to manage all of the assets of owner
.
See {setApprovalForAll}
totalSupply
Returns the total amount of tokens stored by the contract.
tokenOfOwnerByIndex
Returns a token ID owned by owner
at a given index
of its token list. Use along with {balanceOf} to enumerate all of owner
's tokens.
tokenByIndex
Returns a token ID at a given index
of all the tokens stored by the contract. Use along with {totalSupply} to enumerate all tokens.
tokensOf
Returns the token IDs owned by an account
Parameters:
Name | Type | Description |
---|---|---|
account_ | address | The account to query |
Return values:
Name | Type | Description |
---|---|---|
tokens | uint256[] | The token IDs owned by the account |
Write Functions info
safeTransferFrom
Safely transfers tokenId
token from from
to to
.
Requirements:
from
cannot be the zero address.to
cannot be the zero address.tokenId
token must exist and be owned byfrom
.If the caller is not
from
, it must be approved to move this token by either {approve} or {setApprovalForAll}.If
to
refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
Emits a {Transfer} event.
transferFrom
Transfers tokenId
token from from
to to
.
WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must understand this adds an external call which potentially creates a re-entrancy vulnerability.
Requirements:
from
cannot be the zero address.to
cannot be the zero address.tokenId
token must be owned byfrom
.If the caller is not
from
, it must be approved to move this token by either {approve} or {setApprovalForAll}.
Emits a {Transfer} event.
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:
The caller must own the token or be an approved operator.
tokenId
must exist.
Emits an {Approval} event.
setApprovalForAll
Approve or remove operator
as an operator for the caller. Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
Requirements:
The
operator
cannot be the address zero.
Emits an {ApprovalForAll} event.
Events info
Transfer
Emitted when tokenId
token is transferred from from
to to
.
Approval
Emitted when owner
enables approved
to manage the tokenId
token.
ApprovalForAll
Emitted when owner
enables or disables (approved
) operator
to manage all of its assets.
Last updated