thirdweb

⌘K

Pricing

Docs

Support

NFTStake

StakeERC721

Contract for staking ERC721 NFTs, for ERC20 tokens as rewards.


thirdweb's ERC721 Staking contract

This contract allows users to stake their ERC-721 NFTs and get ERC-20 tokens as staking rewards. Contract admin should set the NFT and Reward-token addresses during deployment. These can't be changed later.

Staked NFTs are stored inside the contract and rewards are calculated for the amount of time these NFTs were staked. Admin should maintain adequate balance of reward tokens in the staking-contract. These rewards are then transferred to stakers upon claiming.

Reward calculation at the time of claiming rewards:

rewardsPerTokenStaked = (stakingDuration * rewardsPerUnitTime) / timeUnit

Note:

  • Users need to approve their NFTs to the staking contract address before they can stake them

  • Contract admin should maintain adequate balance of Reward Tokens in the staking contract -- use the deposit function for depositing reward tokens

1.0.3 Release Notes


  • Published with new flow (Default Factory)

  • Gas optimization (https://github.com/thirdweb-dev/contracts/pull/452)

DEFAULT_ADMIN_ROLE

(DEFAULT_ADMIN_ROLE)

view

Published by

thirdweb.eth

View all contracts

Details

  • Publish Date

    Aug 16, 2023

  • Audit Report

    View Audit Report

  • Licenses

    Apache-2.0, MIT


  • Extensions

  • Extension detected

    Permissions


  • Share


    Learn about Publish
    FeedbackPrivacy PolicyTerms of ServiceGas EstimatorChainlist

    thirdweb © 2023