ERC-4353: Interface for Staked Tokens in NFTs
This interface enables access to publicly viewable staking data of an NFT.
Abstract
EIP-721 tokens can be deposited or staked in NFTs for a variety of reasons including escrow, rewards, benefits, and others. There is currently no means of retrieving the number of tokens staked and/or bound to an NFT. This proposal outlines a standard that may be implemented by all wallets and marketplaces easily to correctly retrieve the staked token amount of an NFT.
Motivation
Without staked token data, the actual amount of staked tokens cannot be conveyed from token owners to other users, and cannot be displayed in wallets, marketplaces, or block explorers. The ability to identify and verify an exogenous value derived from the staking process may be critical to the aims of an NFT holder.
Specification
Suggested flow:
Constructor/deployment
- Creator - the owner of an NFT with its own rules for depositing tokens at and/or after the minting of a token.
- Token Amount - the current amount of on-chain EIP-20 or derived tokens bound to an NFT from one or more deposits.
- Withdraw Mechanism - rules based approach for withdrawing staked tokens and making sure to update the balance of the staked tokens.
Staking at mint and locking tokens in NFT
The suggested and intended implementation of this standard is to stake tokens at the time of minting an NFT, and not implementing any outbound transfer of tokens outside of burn
. Therefore, only to stake at minting and withdraw only at burning.
NFT displayed in wallet or marketplace
A wallet or marketplace checks if an NFT has publicly staked tokens available for display - if so, call stakedAmount(tokenId)
to get the current amount of tokens staked and/or bound to the NFT.
The logical code looks something like this and inspired by William Entriken:
Rationale
This standard is completely agnostic to how tokens are deposited or handled by the NFT. It is, therefore, the choice and responsibility of the author to encode and communicate the encoding of their tokenomics to purchasees of their token and/or to make their contracts viewable by purchasees.
Although the intention of this standard is for tokens staked at mint and withdrawable only upon burn, the interface may be modified for dynamic withdrawing and depositing of tokens especially under DeFi application settings. In its current form, the contract logic may be the determining factor whether a deviation from the standard exists.
Backward Compatibility
TBD
Test Cases
Security Considerations
The purpose of this standard is to simply and publicly identify whether an NFT claims to have staked tokens.
Staked claims will be unreliable without a locking mechanism enforced, for example, if staked tokens can only be transferred at burn. Otherwise, tokens may be deposited and/or withdrawn at any time via arbitrary methods. Also, contracts that may allow arbitrary transfers without updating the correct balance will result in potential issues. A strict rules-based approach should be taken with these edge cases in mind.
A dedicated service may exist to verify the claims of a token by analyzing transactions on the explorer. In this manner, verification may be automated to ensure a token's claims are valid. The logical extension of this method may be to extend the interface and support flagging erroneous claims, all the while maintaining a simple goal of validating and verifying a staked amount exists to benefit the operator experience.
Copyright
Copyright and related rights waived via CC0.