Skip to main content

IStaking1155

thirdweb

Methods​

claimRewards​

function claimRewards(uint256 tokenId) external nonpayable

Claim accumulated rewards.

Parameters​

NameTypeDescription
tokenIduint256Staked token Id.

getStakeInfo​

function getStakeInfo(address staker) external view returns (uint256[] _tokensStaked, uint256[] _tokenAmounts, uint256 _totalRewards)

View amount staked and total rewards for a user.

Parameters​

NameTypeDescription
stakeraddressAddress for which to calculated rewards.

Returns​

NameTypeDescription
_tokensStakeduint256[]undefined
_tokenAmountsuint256[]undefined
_totalRewardsuint256undefined

getStakeInfoForToken​

function getStakeInfoForToken(uint256 tokenId, address staker) external view returns (uint256 _tokensStaked, uint256 _rewards)

View amount staked and total rewards for a user.

Parameters​

NameTypeDescription
tokenIduint256Staked token Id.
stakeraddressAddress for which to calculated rewards.

Returns​

NameTypeDescription
_tokensStakeduint256undefined
_rewardsuint256undefined

stake​

function stake(uint256 tokenId, uint256 amount) external nonpayable

Stake ERC721 Tokens.

Parameters​

NameTypeDescription
tokenIduint256ERC1155 token-id to stake.
amountuint256Amount to stake.

withdraw​

function withdraw(uint256 tokenId, uint256 amount) external nonpayable

Withdraw staked tokens.

Parameters​

NameTypeDescription
tokenIduint256ERC1155 token-id to withdraw.
amountuint256Amount to withdraw.

Events​

RewardsClaimed​

event RewardsClaimed(address indexed staker, uint256 rewardAmount)

Emitted when a staker claims staking rewards.

Parameters​

NameTypeDescription
staker indexedaddressundefined
rewardAmountuint256undefined

TokensStaked​

event TokensStaked(address indexed staker, uint256 indexed tokenId, uint256 amount)

Emitted when tokens are staked.

Parameters​

NameTypeDescription
staker indexedaddressundefined
tokenId indexeduint256undefined
amountuint256undefined

TokensWithdrawn​

event TokensWithdrawn(address indexed staker, uint256 indexed tokenId, uint256 amount)

Emitted when a set of staked token-ids are withdrawn.

Parameters​

NameTypeDescription
staker indexedaddressundefined
tokenId indexeduint256undefined
amountuint256undefined

UpdatedDefaultRewardsPerUnitTime​

event UpdatedDefaultRewardsPerUnitTime(uint256 oldRewardsPerUnitTime, uint256 newRewardsPerUnitTime)

Emitted when contract admin updates rewardsPerUnitTime.

Parameters​

NameTypeDescription
oldRewardsPerUnitTimeuint256undefined
newRewardsPerUnitTimeuint256undefined

UpdatedDefaultTimeUnit​

event UpdatedDefaultTimeUnit(uint256 oldTimeUnit, uint256 newTimeUnit)

Emitted when contract admin updates timeUnit.

Parameters​

NameTypeDescription
oldTimeUnituint256undefined
newTimeUnituint256undefined

UpdatedRewardsPerUnitTime​

event UpdatedRewardsPerUnitTime(uint256 indexed _tokenId, uint256 oldRewardsPerUnitTime, uint256 newRewardsPerUnitTime)

Emitted when contract admin updates rewardsPerUnitTime.

Parameters​

NameTypeDescription
_tokenId indexeduint256undefined
oldRewardsPerUnitTimeuint256undefined
newRewardsPerUnitTimeuint256undefined

UpdatedTimeUnit​

event UpdatedTimeUnit(uint256 indexed _tokenId, uint256 oldTimeUnit, uint256 newTimeUnit)

Emitted when contract admin updates timeUnit.

Parameters​

NameTypeDescription
_tokenId indexeduint256undefined
oldTimeUnituint256undefined
newTimeUnituint256undefined