Contract for staking ERC1155 NFTs, for ERC20 tokens as rewards.
This contract allows users to stake their ERC-1155 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
view