ERC-4353 NFT staked token query interface (Interface for Staked Tokens in NFTs)
Stagnant · NFTs & multi-token · created 2021-10-08
An interface that lets wallets or marketplaces query, through a single standard function, the quantity of tokens staked (deposited) in an NFT.
Why it is needed
ERC-721 tokens can be staked in or bound to an NFT for various purposes such as escrow, rewards, or benefits, but there is currently no standard way to query this staked amount. As a result, NFT owners cannot convey to other users how many tokens they have actually staked, and wallets, marketplaces, and block explorers cannot display this value either. Being able to identify and let others verify the external value tied to an NFT can matter to holders, but without a standard query function, each project is left to confirm this only through its own inconsistent methods.
What to implement
function stakedAmount(uint256 tokenId) external view returns (uint256);: Returns the quantity of on-chain tokens staked in or bound to the given NFT (tokenId).
In depth
Interface definition
This standard consists of a single interface, IERC721Staked. stakedAmount(uint256 tokenId) is an externally callable view function that returns the quantity (uint256) of on-chain tokens bound to the given NFT. Wallets and marketplaces should call this function to display the amount of tokens staked or locked. The ERC-165 identifier for this interface is specified as 0x3a3d855f, allowing implementation support to be queried via ERC-165 beforehand.
Elements to define when implementing
Following the flow proposed in the source text, implementers must define three things. First, the Creator: the NFT owner, who has their own rules for staking tokens at mint time and afterward. Second, the Token Amount: the current quantity of ERC-20 tokens or their derivatives bound to the NFT through one or more stakes. Third, the Withdraw Mechanism: a rule-based procedure that accurately updates the staked balance while withdrawing staked tokens.
Recommended implementation: stake at mint, withdraw only at burn
The implementation approach this standard proposes and intends is to stake tokens at the time an NFT is minted and to implement no external transfer other than burn. In other words, staking happens only at minting and withdrawal happens only at burning. Wallets and marketplaces should check whether an NFT has publicly staked tokens and then call stakedAmount(tokenId) to retrieve the currently staked/locked token amount.
A standard that is neutral on the staking method
This standard is entirely neutral as to how tokens are staked or processed. Accordingly, how the token economics are designed and communicated to buyers, or whether buyers can inspect the author's own contract, is the author's choice and responsibility. The standard's intent is for staking to occur at mint and withdrawal to be possible only at burn, but especially in DeFi contexts, the interface may be adapted for dynamic staking and withdrawal. In that case, whether a given implementation has deviated from the standard may depend on the actual contract logic.
Proposal status
ERC-4353 is in Stagnant status, meaning it is a proposal that has not been finalized and whose discussion has stalled. The Backward Compatibility section is also still marked TBD and requires further review.
Things to watch out for
- Without a locking mechanism, staking claims cannot be trusted: For example, if a locking mechanism that allows token transfer only at burn time is not enforced, staking claims cannot be trusted. Otherwise, tokens could be staked or withdrawn at any time through arbitrary methods.
- Arbitrary transfers and balance inconsistency issues: Contracts that allow arbitrary transfers without correctly updating balances create potential problems. These exceptional situations must be kept in mind, and a strict, rule-based approach must be taken.
- Possibility of external verification services: A dedicated service could exist that analyzes an explorer's transactions to verify a token's staking claims. This could automatically confirm the validity of such claims, and the interface could even be extended further to support flagging false claims.