AthenaPositionToken
The AthenaPositionToken contract is a slightly modified ERC-721 token representing a liquidity position 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.
State variables info
baseDataURI
string baseDataURIThe base URI for the token metadata. The metadata does NOT include the position's parameters. To retrieve the position's parameters, use the LiquidityManager contract's positionInfo() function.
nextPositionId
uint256 nextPositionIdThe ID of the next position to be minted.
Read Functions info
name
function name() external view returns (string memory)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:
tokenIdmust exist.
getApproved
Returns the account approved for tokenId token.
Requirements:
tokenIdmust 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:
account_
address
The account to query
Return values:
tokens
uint256[]
The token IDs owned by the account
Write Functions info
safeTransferFrom
Safely transfers tokenId token from from to to.
Requirements:
fromcannot be the zero address.tocannot be the zero address.tokenIdtoken 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
torefers 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:
fromcannot be the zero address.tocannot be the zero address.tokenIdtoken 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.
tokenIdmust 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
operatorcannot 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
Was this helpful?