Skip to main content

StakingRewards.sol

Details

This contract is used to reward stakers for their staking time.

Methods

PRECISION()

Solidity

function PRECISION() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

RATE_PRECISION()

Solidity

function RATE_PRECISION() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

SECONDS_IN_YEAR()

Solidity

function SECONDS_IN_YEAR() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

claimPendingRewards(uint256)

Solidity

function claimPendingRewards(uint256 poolId) external nonpayable
Details

To claim the pending rewards

Parameters

NameTypeDescription
poolIduint256The id of the pool from which the pending rewards should be claimed

createPool(address,address,uint256,uint256,uint256)

Solidity

function createPool(address stakingToken, address rewardToken, uint256 rewardRate, uint256 start, uint256 end) external nonpayable
Details

To create a staking pool

Parameters

NameTypeDescription
stakingTokenaddressAddress of the token that will be staked
rewardTokenaddressAddress of the token that will be given as reward
rewardRateuint256Rate at which the rewards will be calculated yearly and then multiplied by 100
startuint256Start time of the staking pool
enduint256Ending time for the staking pool

depositRewards(uint256,uint256)

Solidity

function depositRewards(uint256 poolId, uint256 amount) external nonpayable
Details

To deposit reward tokens that will be given to the stakers.

Parameters

NameTypeDescription
poolIduint256The id of the pool in which rewards should be allocated
amountuint256The value of tokens that should be added to give out as rewards.

getBalances(address)

Solidity

function getBalances(address user) external view returns (uint256[])

Parameters

NameTypeDescription
useraddressundefined

Returns

NameTypeDescription
_0uint256[]undefined

getPool(uint256)

Solidity

function getPool(uint256 poolId) external view returns (struct IStakingRewards.Pool)
Details

To get the pool for given id

Parameters

NameTypeDescription
poolIduint256undefined

Returns

NameTypeDescription
_0IStakingRewards.PoolPool which has the details for every pool

getPools()

Solidity

function getPools() external view returns (struct IStakingRewards.Pool[], string[])
Details

To get the details for all pools

Returns

NameTypeDescription
_0IStakingRewards.Pool[]pools which has the details for every pool
_1string[]undefined

getRewardsForAPool(address,uint256)

Solidity

function getRewardsForAPool(address account, uint256 poolId) external view returns (uint256)
Details

To get rewards for a particular address for a particular pool

Parameters

NameTypeDescription
accountaddressThe address of the account whose reward is to be fetched
poolIduint256The id of the pool from which rewards for the account needs to be fetched

Returns

NameTypeDescription
_0uint256undefined

initialize()

Solidity

function initialize() external nonpayable

isPaused(uint256)

Solidity

function isPaused(uint256) external view returns (bool)

Parameters

NameTypeDescription
_0uint256undefined

Returns

NameTypeDescription
_0boolundefined

owner()

Solidity

function owner() external view returns (address)
Details

Returns the address of the current owner.

Returns

NameTypeDescription
_0addressundefined

pendingRewards(address,uint256)

Solidity

function pendingRewards(address, uint256) external view returns (uint256)

Parameters

NameTypeDescription
_0addressundefined
_1uint256undefined

Returns

NameTypeDescription
_0uint256undefined

pools(uint256)

Solidity

function pools(uint256) external view returns (address stakingToken, address rewardToken, uint256 rewardRate, uint256 totalAmount, uint256 start, uint256 end)

Parameters

NameTypeDescription
_0uint256undefined

Returns

NameTypeDescription
stakingTokenaddressundefined
rewardTokenaddressundefined
rewardRateuint256undefined
totalAmountuint256undefined
startuint256undefined
enduint256undefined

renounceOwnership()

Solidity

function renounceOwnership() external nonpayable
Details

Leaves the contract without owner. It will not be possible to call onlyOwner functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.

setJobState(uint256,bool)

Solidity

function setJobState(uint256 poolId, bool pause) external nonpayable
Details

To pause or resume a particular staking pool

Parameters

NameTypeDescription
poolIduint256The id of the staking pool that should be paused or resumed
pauseboolThe boolean where passing true means pause the pool and passing false means resume the pool

stake(uint256,uint256)

Solidity

function stake(uint256 amount, uint256 poolId) external nonpayable
Details

To stake tokens

Parameters

NameTypeDescription
amountuint256The number of tokens to be staked.
poolIduint256The id of the pool in which tokens should be staked.

stakeFor(address,uint256,uint256)

Solidity

function stakeFor(address user, uint256 amount, uint256 poolId) external nonpayable
Details

To stake tokens

Parameters

NameTypeDescription
useraddressThe address that stake tokens for.
amountuint256The number of tokens to be staked.
poolIduint256The id of the pool in which tokens should be staked.

totalPools()

Solidity

function totalPools() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

totalRewardsPerPool(uint256)

Solidity

function totalRewardsPerPool(uint256) external view returns (uint256)

Parameters

NameTypeDescription
_0uint256undefined

Returns

NameTypeDescription
_0uint256undefined

transferOwnership(address)

Solidity

function transferOwnership(address newOwner) external nonpayable
Details

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Parameters

NameTypeDescription
newOwneraddressundefined

unstake(uint256)

Solidity

function unstake(uint256 poolId) external nonpayable
Details

To unstake staked tokens.

Parameters

NameTypeDescription
poolIduint256The id of pool from which the tokens whould be unstaked.

upgradeTo(address)

Solidity

function upgradeTo(address newImplementation) external nonpayable
Details

Upgrade the implementation of the proxy to newImplementation. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.

Parameters

NameTypeDescription
newImplementationaddressundefined

upgradeToAndCall(address,bytes)

Solidity

function upgradeToAndCall(address newImplementation, bytes data) external payable
Details

Upgrade the implementation of the proxy to newImplementation, and subsequently execute the function call encoded in data. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.

Parameters

NameTypeDescription
newImplementationaddressundefined
databytesundefined

userInfoPerPool(uint256,address)

Solidity

function userInfoPerPool(uint256, address) external view returns (uint256 balance, uint256 lastRewarded, uint256 rewards)

Parameters

NameTypeDescription
_0uint256undefined
_1addressundefined

Returns

NameTypeDescription
balanceuint256undefined
lastRewardeduint256undefined
rewardsuint256undefined

withdrawRewards(uint256,uint256,address)

Solidity

function withdrawRewards(uint256 poolId, uint256 amount, address receiver) external nonpayable
Details

To withdraw the extra rewards that remains on the contract and can only be called by owner of this contract.

Parameters

NameTypeDescription
poolIduint256The id of the pool in which rewards should be withdrawn
amountuint256The value of tokens that should be removed from the contract.
receiveraddressThe address where the withdrawn tokens should be sent

Events

AdminChanged

Solidity

event AdminChanged(address previousAdmin, address newAdmin)

Parameters

NameTypeDescription
previousAdminaddressundefined
newAdminaddressundefined

BeaconUpgraded

Solidity

event BeaconUpgraded(address indexed beacon)

Parameters

NameTypeDescription
beacon indexedaddressundefined

OwnershipTransferred

Solidity

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

Parameters

NameTypeDescription
previousOwner indexedaddressundefined
newOwner indexedaddressundefined

RewardPaid

Solidity

event RewardPaid(address indexed user, uint256 poolId, uint256 reward)

Parameters

NameTypeDescription
user indexedaddressundefined
poolIduint256undefined
rewarduint256undefined

RewardsDeposited

Solidity

event RewardsDeposited(address depositor, uint256 poolId, uint256 amount)

Parameters

NameTypeDescription
depositoraddressundefined
poolIduint256undefined
amountuint256undefined

RewardsWithdrawn

Solidity

event RewardsWithdrawn(uint256 amount, uint256 poolId)

Parameters

NameTypeDescription
amountuint256undefined
poolIduint256undefined

Staked

Solidity

event Staked(address indexed user, uint256 amount, uint256 poolId)

Parameters

NameTypeDescription
user indexedaddressundefined
amountuint256undefined
poolIduint256undefined

Upgraded

Solidity

event Upgraded(address indexed implementation)

Parameters

NameTypeDescription
implementation indexedaddressundefined

Withdrawn

Solidity

event Withdrawn(address indexed user, uint256 amount, uint256 poolId)

Parameters

NameTypeDescription
user indexedaddressundefined
amountuint256undefined
poolIduint256undefined