Skip to content

Latest commit

 

History

History
258 lines (227 loc) · 8.07 KB

File metadata and controls

258 lines (227 loc) · 8.07 KB

StakingPools.sol

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

↗ Extends: StakingPoolInfo

StakingPools

Functions

function (IStore s) public nonpayable StakingPoolInfo 

Arguments

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

deposit

Deposit your desired amount of tokens to the specified staking pool. When you deposit, you receive rewards if tokens are still available in the reward pool.

function deposit(bytes32 key, uint256 amount) external nonpayable nonReentrant 

Arguments

Name Type Description
key bytes32
amount uint256
Source Code
function deposit(bytes32 key, uint256 amount) external override nonReentrant {
    s.mustNotBePaused();
    s.ensureValidStakingPoolInternal(key);

    (address stakingToken, address rewardToken, uint256 rewards, uint256 rewardsPlatformFee) = s.depositInternal(key, amount);
    emit Deposited(key, msg.sender, stakingToken, amount);

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

withdraw

Withdraw your desired amount of tokens from the staking pool. When you withdraw, you receive rewards if tokens are still available in the reward pool.

function withdraw(bytes32 key, uint256 amount) external nonpayable nonReentrant 

Arguments

Name Type Description
key bytes32
amount uint256
Source Code
function withdraw(bytes32 key, uint256 amount) external override nonReentrant {
    s.mustNotBePaused();
    s.ensureValidStakingPoolInternal(key);

    (address stakingToken, address rewardToken, uint256 rewards, uint256 rewardsPlatformFee) = s.withdrawInternal(key, amount);
    emit Withdrawn(key, msg.sender, stakingToken, amount);

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

Contracts