ERC1155Staking
The Staking1155 smart contract extension implements NFT staking mechanism for ERC1155. With this extension you can setup a staking contract for NFT holders of your ERC1155 Collection. Users can stake their NFTs and earn ERC20 tokens as rewards.
View on GitHub
This is an example smart contract demonstrating how to inherit from this extension and override the functions to add (optional) custom functionality.
- Lets a user stake a number of ERC1155 tokens of a specific token-Id.
- Parameter tokenId: ERC1155 token-id to stake.
- Parameter amount: Amount to stake.
- Un-stake and withdraw NFTs from the contract.
- Parameter tokenId: ERC1155 token-id to withdraw.
- Parameter amount: Amount to withdraw.
- Claim accumulated rewards. This claim method allows for a pull mechanism where users must initiate claiming of rewards.
- Parameter tokenId: ERC1155 token-id to claim rewards for.
- View number of NFTs staked and total rewards available for a user.
- Parameter staker: Account address of staker.
- View number of NFTs staked and total rewards available for a user.
- Parameter tokenId: ERC1155 token-id to view rewards for.
- Parameter staker: Account address of staker.
- Allows an authorized account to set rewards per unit of time. Interpreted as x rewards per second/per day/etc based on time-unit.
- Parameter tokenId: ERC1155 token-id to set this for.
- Parameter rewardsPerUnitTime: New rewards per unit time.
- Allows an authorized account to set time unit as a number of seconds. For e.g. 1 hour can be set as 3600 seconds - setting the reward frequency as per hour.
- Parameter tokenId: ERC1155 token-id to set this for.
- Parameter timeUnit: New time unit.
- Allows an authorized account to set rewards per unit of time applicable for all token-Ids by default.
- Parameter defaultRewardsPerUnitTime: New rewards per unit time.
- Allows an authorized account to set time unit applicable for all token-Ids by default.
- Parameter defaultTimeUnit: New time unit.