Skip to main content

Staking721

Methods

claimRewards

function claimRewards() external nonpayable

Claim accumulated rewards.

See {_claimRewards}. Override that to implement custom logic. See {_calculateRewards} for reward-calculation logic.

getRewardTokenBalance

function getRewardTokenBalance() external view returns (uint256 _rewardsAvailableInContract)

View total rewards available in the staking contract.

Returns

NameTypeDescription
_rewardsAvailableInContractuint256undefined

getRewardsPerUnitTime

function getRewardsPerUnitTime() external view returns (uint256 _rewardsPerUnitTime)

Returns

NameTypeDescription
_rewardsPerUnitTimeuint256undefined

getStakeInfo

function getStakeInfo(address _staker) external view returns (uint256[] _tokensStaked, uint256 _rewards)

View amount staked and total rewards for a user.

Parameters

NameTypeDescription
_stakeraddressAddress for which to calculated rewards.

Returns

NameTypeDescription
_tokensStakeduint256[]List of token-ids staked by staker.
_rewardsuint256Available reward amount.

getTimeUnit

function getTimeUnit() external view returns (uint256 _timeUnit)

Returns

NameTypeDescription
_timeUnituint256undefined

indexedTokens

function indexedTokens(uint256) external view returns (uint256)

List of token-ids ever staked.

Parameters

NameTypeDescription
_0uint256undefined

Returns

NameTypeDescription
_0uint256undefined

isIndexed

function isIndexed(uint256) external view returns (bool)

Mapping from token-id to whether it is indexed or not.

Parameters

NameTypeDescription
_0uint256undefined

Returns

NameTypeDescription
_0boolundefined

setRewardsPerUnitTime

function setRewardsPerUnitTime(uint256 _rewardsPerUnitTime) external nonpayable

Set rewards per unit of time. Interpreted as x rewards per second/per day/etc based on time-unit.

Only admin/authorized-account can call it.

Parameters

NameTypeDescription
_rewardsPerUnitTimeuint256New rewards per unit time.

setTimeUnit

function setTimeUnit(uint256 _timeUnit) external nonpayable

Set time unit. Set as a number of seconds. Could be specified as -- x 1 hours, x 1 days, etc.

Only admin/authorized-account can call it.

Parameters

NameTypeDescription
_timeUnituint256New time unit.

stake

function stake(uint256[] _tokenIds) external nonpayable

Stake ERC721 Tokens.

See {_stake}. Override that to implement custom logic.

Parameters

NameTypeDescription
_tokenIdsuint256[]List of tokens to stake.

stakerAddress

function stakerAddress(uint256) external view returns (address)

Mapping from staked token-id to staker address.

Parameters

NameTypeDescription
_0uint256undefined

Returns

NameTypeDescription
_0addressundefined

stakers

function stakers(address) external view returns (uint256 amountStaked, uint256 timeOfLastUpdate, uint256 unclaimedRewards, uint256 conditionIdOflastUpdate)

Mapping from staker address to Staker struct. See {struct IStaking721.Staker}.

Parameters

NameTypeDescription
_0addressundefined

Returns

NameTypeDescription
amountStakeduint256undefined
timeOfLastUpdateuint256undefined
unclaimedRewardsuint256undefined
conditionIdOflastUpdateuint256undefined

stakersArray

function stakersArray(uint256) external view returns (address)

List of accounts that have staked their NFTs.

Parameters

NameTypeDescription
_0uint256undefined

Returns

NameTypeDescription
_0addressundefined

stakingToken

function stakingToken() external view returns (address)

Address of ERC721 NFT contract -- staked tokens belong to this contract.

Returns

NameTypeDescription
_0addressundefined

withdraw

function withdraw(uint256[] _tokenIds) external nonpayable

Withdraw staked tokens.

See {_withdraw}. Override that to implement custom logic.

Parameters

NameTypeDescription
_tokenIdsuint256[]List of tokens to withdraw.

Events

RewardsClaimed

event RewardsClaimed(address indexed staker, uint256 rewardAmount)

Parameters

NameTypeDescription
staker indexedaddressundefined
rewardAmountuint256undefined

TokensStaked

event TokensStaked(address indexed staker, uint256[] indexed tokenIds)

Parameters

NameTypeDescription
staker indexedaddressundefined
tokenIds indexeduint256[]undefined

TokensWithdrawn

event TokensWithdrawn(address indexed staker, uint256[] indexed tokenIds)

Parameters

NameTypeDescription
staker indexedaddressundefined
tokenIds indexeduint256[]undefined

UpdatedRewardsPerUnitTime

event UpdatedRewardsPerUnitTime(uint256 oldRewardsPerUnitTime, uint256 newRewardsPerUnitTime)

Parameters

NameTypeDescription
oldRewardsPerUnitTimeuint256undefined
newRewardsPerUnitTimeuint256undefined

UpdatedTimeUnit

event UpdatedTimeUnit(uint256 oldTimeUnit, uint256 newTimeUnit)

Parameters

NameTypeDescription
oldTimeUnituint256undefined
newTimeUnituint256undefined