StakingRewards.sol
This contract is used to reward stakers for their staking time.
Methods
PRECISION()
function PRECISION() external view returns (uint256)
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
RATE_PRECISION()
function RATE_PRECISION() external view returns (uint256)
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
SECONDS_IN_YEAR()
function SECONDS_IN_YEAR() external view returns (uint256)
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
claimPendingRewards(uint256)
function claimPendingRewards(uint256 poolId) external nonpayable
To claim the pending rewards
Parameters
Name | Type | Description |
---|---|---|
poolId | uint256 | The id of the pool from which the pending rewards should be claimed |
createPool(address,address,uint256,uint256,uint256)
function createPool(address stakingToken, address rewardToken, uint256 rewardRate, uint256 start, uint256 end) external nonpayable
To create a staking pool
Parameters
Name | Type | Description |
---|---|---|
stakingToken | address | Address of the token that will be staked |
rewardToken | address | Address of the token that will be given as reward |
rewardRate | uint256 | Rate at which the rewards will be calculated yearly and then multiplied by 100 |
start | uint256 | Start time of the staking pool |
end | uint256 | Ending time for the staking pool |
depositRewards(uint256,uint256)
function depositRewards(uint256 poolId, uint256 amount) external nonpayable
To deposit reward tokens that will be given to the stakers.
Parameters
Name | Type | Description |
---|---|---|
poolId | uint256 | The id of the pool in which rewards should be allocated |
amount | uint256 | The value of tokens that should be added to give out as rewards. |
getBalances(address)
function getBalances(address user) external view returns (uint256[])
Parameters
Name | Type | Description |
---|---|---|
user | address | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256[] | undefined |
getPool(uint256)
function getPool(uint256 poolId) external view returns (struct IStakingRewards.Pool)
To get the pool for given id
Parameters
Name | Type | Description |
---|---|---|
poolId | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | IStakingRewards.Pool | Pool which has the details for every pool |
getPools()
function getPools() external view returns (struct IStakingRewards.Pool[], string[])
To get the details for all pools
Returns
Name | Type | Description |
---|---|---|
_0 | IStakingRewards.Pool[] | pools which has the details for every pool |
_1 | string[] | undefined |
getRewardsForAPool(address,uint256)
function getRewardsForAPool(address account, uint256 poolId) external view returns (uint256)
To get rewards for a particular address for a particular pool
Parameters
Name | Type | Description |
---|---|---|
account | address | The address of the account whose reward is to be fetched |
poolId | uint256 | The id of the pool from which rewards for the account needs to be fetched |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
initialize()
function initialize() external nonpayable
isPaused(uint256)
function isPaused(uint256) external view returns (bool)
Parameters
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
owner()
function owner() external view returns (address)
Returns the address of the current owner.
Returns
Name | Type | Description |
---|---|---|
_0 | address | undefined |
pendingRewards(address,uint256)
function pendingRewards(address, uint256) external view returns (uint256)
Parameters
Name | Type | Description |
---|---|---|
_0 | address | undefined |
_1 | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
pools(uint256)
function pools(uint256) external view returns (address stakingToken, address rewardToken, uint256 rewardRate, uint256 totalAmount, uint256 start, uint256 end)
Parameters
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
stakingToken | address | undefined |
rewardToken | address | undefined |
rewardRate | uint256 | undefined |
totalAmount | uint256 | undefined |
start | uint256 | undefined |
end | uint256 | undefined |
renounceOwnership()
function renounceOwnership() external nonpayable
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)
function setJobState(uint256 poolId, bool pause) external nonpayable
To pause or resume a particular staking pool
Parameters
Name | Type | Description |
---|---|---|
poolId | uint256 | The id of the staking pool that should be paused or resumed |
pause | bool | The boolean where passing true means pause the pool and passing false means resume the pool |
stake(uint256,uint256)
function stake(uint256 amount, uint256 poolId) external nonpayable
To stake tokens
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | The number of tokens to be staked. |
poolId | uint256 | The id of the pool in which tokens should be staked. |
stakeFor(address,uint256,uint256)
function stakeFor(address user, uint256 amount, uint256 poolId) external nonpayable
To stake tokens
Parameters
Name | Type | Description |
---|---|---|
user | address | The address that stake tokens for. |
amount | uint256 | The number of tokens to be staked. |
poolId | uint256 | The id of the pool in which tokens should be staked. |
totalPools()
function totalPools() external view returns (uint256)
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
totalRewardsPerPool(uint256)
function totalRewardsPerPool(uint256) external view returns (uint256)
Parameters
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
transferOwnership(address)
function transferOwnership(address newOwner) external nonpayable
Transfers ownership of the contract to a new account (newOwner
). Can only be called by the current owner.
Parameters
Name | Type | Description |
---|---|---|
newOwner | address | undefined |
unstake(uint256)
function unstake(uint256 poolId) external nonpayable
To unstake staked tokens.
Parameters
Name | Type | Description |
---|---|---|
poolId | uint256 | The id of pool from which the tokens whould be unstaked. |
upgradeTo(address)
function upgradeTo(address newImplementation) external nonpayable
Upgrade the implementation of the proxy to newImplementation
. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.
Parameters
Name | Type | Description |
---|---|---|
newImplementation | address | undefined |
upgradeToAndCall(address,bytes)
function upgradeToAndCall(address newImplementation, bytes data) external payable
Upgrade the implementation of the proxy to newImplementation
, and subsequently execute the function call encoded in data
. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.
Parameters
Name | Type | Description |
---|---|---|
newImplementation | address | undefined |
data | bytes | undefined |
userInfoPerPool(uint256,address)
function userInfoPerPool(uint256, address) external view returns (uint256 balance, uint256 lastRewarded, uint256 rewards)
Parameters
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
_1 | address | undefined |
Returns
Name | Type | Description |
---|---|---|
balance | uint256 | undefined |
lastRewarded | uint256 | undefined |
rewards | uint256 | undefined |
withdrawRewards(uint256,uint256,address)
function withdrawRewards(uint256 poolId, uint256 amount, address receiver) external nonpayable
To withdraw the extra rewards that remains on the contract and can only be called by owner of this contract.
Parameters
Name | Type | Description |
---|---|---|
poolId | uint256 | The id of the pool in which rewards should be withdrawn |
amount | uint256 | The value of tokens that should be removed from the contract. |
receiver | address | The address where the withdrawn tokens should be sent |
Events
AdminChanged
event AdminChanged(address previousAdmin, address newAdmin)
Parameters
Name | Type | Description |
---|---|---|
previousAdmin | address | undefined |
newAdmin | address | undefined |
BeaconUpgraded
event BeaconUpgraded(address indexed beacon)
Parameters
Name | Type | Description |
---|---|---|
beacon indexed | address | undefined |
OwnershipTransferred
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
Parameters
Name | Type | Description |
---|---|---|
previousOwner indexed | address | undefined |
newOwner indexed | address | undefined |
RewardPaid
event RewardPaid(address indexed user, uint256 poolId, uint256 reward)
Parameters
Name | Type | Description |
---|---|---|
user indexed | address | undefined |
poolId | uint256 | undefined |
reward | uint256 | undefined |
RewardsDeposited
event RewardsDeposited(address depositor, uint256 poolId, uint256 amount)
Parameters
Name | Type | Description |
---|---|---|
depositor | address | undefined |
poolId | uint256 | undefined |
amount | uint256 | undefined |
RewardsWithdrawn
event RewardsWithdrawn(uint256 amount, uint256 poolId)
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | undefined |
poolId | uint256 | undefined |
Staked
event Staked(address indexed user, uint256 amount, uint256 poolId)
Parameters
Name | Type | Description |
---|---|---|
user indexed | address | undefined |
amount | uint256 | undefined |
poolId | uint256 | undefined |
Upgraded
event Upgraded(address indexed implementation)
Parameters
Name | Type | Description |
---|---|---|
implementation indexed | address | undefined |
Withdrawn
event Withdrawn(address indexed user, uint256 amount, uint256 poolId)
Parameters
Name | Type | Description |
---|---|---|
user indexed | address | undefined |
amount | uint256 | undefined |
poolId | uint256 | undefined |