We propose an ERC-721 extension in which tokens accrue staking time simply by being held, without staking transactions or custody transfers. The problem: Many NFT projects reward long-term holders, but the usual staking pattern asks holders to call a staking function, move the token into a separate staking contract, and later withdraw it. Every step costs gas, the token leaves the holder’s wallet (breaking token-gated access, profile pictures and other wallet-based utilities), and a separate contract adds its own custody risk. What these systems actually measure is how long a token has been held without being traded, and the token contract already touches the data needed to derive that on every transfer. The mechanism: The contract defines a staking season: stakingId, stakingBegin, stakingEnd and a breaktime in seconds. On every transfer, the contract adds the time accrued since the token’s last status change to a stored total, then records the current timestamp. After a transfer, the token takes a break: it accrues nothing for breaktime seconds. This replaces locking as the defense against one token being used to claim rewards across many wallets in quick succession, while keeping tokens freely transferable. Tokens that are never transferred cost nothing to hold; their totals are computed lazily in view functions. A new season (different stakingId) resets every token’s total without iterating over tokens. Interface: interface IERC721AutoStaking /* is IERC721 */ { function stakingTotal(uint256 tokenId) external view returns (uint256); function stakingTimestamp(uint256 tokenId) external view returns (uint256); function isTakingBreak(uint256 tokenId) external view returns (bool); function stakingBegin() external view returns (uint256); function stakingEnd() external view returns (uint256); function stakingId() external view returns (uint256); function stakingBreaktime() external view returns (uint256); } Background: The mechanism was originally developed in 2022 for our own NFT project, and the implementation is open source (github: jeff-rhie/ERC721AS). The proposal was first opened as ethereum/EIPs#8902 in 2024; the editors asked for it to be moved to the ERCs repository, and this thread accompanies the resubmission. Open questions: Minting during a season. The reference implementation does not record a status change at mint, so a token minted mid-season is credited from the season start. Should the standard require recording at mint, or leave it implementation-defined with a security note (the current draft does the latter)? Record follows the token, not the owner. A buyer inherits the seller’s accrued total, while the break period stops the buyer from accruing immediately. Is this the right default, or should the standard reset the total on transfer? Policy change event. The draft leaves the mechanism for changing the staking policy unspecified. Should the standard require an event when a season or breaktime changes, so indexers and reward contracts can track policy history? Prior art. We are not aware of an existing ERC that standardizes in-place, transfer-derived staking time. Pointers to related proposals are very welcome. Feedback on the interface and the break-period design is appreciated. 2 posts - 1 participant Read full topic
ERC-XXXX: Holding-Time Auto Staking for NFTs
来自 A 信源 Ethereum Magicians,发布 9 小时,热度评分 79