Skip to content

Latest commit

 

History

History
247 lines (219 loc) · 7.6 KB

StakingPoolReward.md

File metadata and controls

247 lines (219 loc) · 7.6 KB

StakingPoolReward.sol

View Source: contracts/pool/Staking/StakingPoolReward.sol

↗ Extends: StakingPoolBase ↘ Derived Contracts: StakingPoolInfo

StakingPoolReward

Functions

function (IStore s) internal nonpayable StakingPoolBase 

Arguments

Name Type Description
s IStore
Source Code
constructor(IStore s) StakingPoolBase(s) {}

calculateRewards

function calculateRewards(bytes32 key, address account) external view
returns(uint256)

Arguments

Name Type Description
key bytes32
account address
Source Code
function calculateRewards(bytes32 key, address account) external view override returns (uint256) {
    return s.calculateRewardsInternal(key, account);
  }

withdrawRewards

Withdraw your staking reward. Ensure that you preiodically call this function or else you risk receiving no rewards as a result of token depletion in the reward pool.

function withdrawRewards(bytes32 key) external nonpayable nonReentrant 

Arguments

Name Type Description
key bytes32
Source Code
function withdrawRewards(bytes32 key) external override nonReentrant {
    s.mustNotBePaused();
    s.ensureValidStakingPool(key);

    (address rewardToken, uint256 rewards, uint256 platformFee) = s.withdrawRewardsInternal(key, msg.sender);

    if (rewards > 0) {
      emit RewardsWithdrawn(key, msg.sender, rewardToken, rewards, platformFee);
    }
  }

Contracts