StakingAuRaTokens
contract StakingAuRaTokens
is IStakingAuRaTokens, StakingAuRaBase
Implements staking and withdrawal logic.
Index
Reference
Events
ClaimedReward
event ClaimedReward(address fromPoolStakingAddress, address staker, uint256 stakingEpoch, uint256 tokensAmount, uint256 nativeCoinsAmount)
Emitted by the `claimReward` function to signal the staker withdrew the specified amount of tokens and native coins from the specified pool for the specified staking epoch.
- Parameters:
fromPoolStakingAddress
- The pool from which the `staker` withdrew the amounts.staker
- The address of the staker that withdrew the amounts.stakingEpoch
- The serial number of the staking epoch for which the claim was made.tokensAmount
- The withdrawal amount of tokens.nativeCoinsAmount
- The withdrawal amount of native coins.
Functions
_sendWithdrawnStakeAmount
function _sendWithdrawnStakeAmount(address _to, uint256 _amount) internal
Sends tokens from this contract to the specified address.
- Parameters:
_to
- The target address to send amount to._amount
- The amount to send.
_stake
function _stake(address _toPoolStakingAddress, uint256 _amount) internal
The internal function used by the `stake` and `addPool` functions. See the `stake` public function for more details.
- Modifiers:
- gasPriceIsValid onlyInitialized
- Parameters:
_toPoolStakingAddress
- The staking address of the pool where the tokens should be staked._amount
- The amount of tokens to be staked.
_thisBalance
function _thisBalance() internal view returns (uint256)
Returns the balance of this contract in staking tokens.
- Returns:
- uint256
claimReward
function claimReward(uint256[] _stakingEpochs, address _poolStakingAddress) public
Withdraws a reward from the specified pool for the specified staking epochs to the staker address (msg.sender).
- Modifiers:
- gasPriceIsValid onlyInitialized
- Parameters:
_stakingEpochs
- The list of staking epochs in ascending order. If the list is empty, it is taken with `BlockRewardAuRa.epochsPoolGotRewardFor` getter._poolStakingAddress
- The staking address of the pool from which the reward needs to be withdrawn.
getRewardAmount
function getRewardAmount(uint256[] _stakingEpochs, address _poolStakingAddress, address _staker) public view returns (uint256, uint256)
Returns reward amounts for the specified pool, the specified staking epochs, and the specified staker address (delegator or validator).
- Parameters:
_stakingEpochs
- The list of staking epochs in ascending order. If the list is empty, it is taken with `BlockRewardAuRa.epochsPoolGotRewardFor` getter._poolStakingAddress
- The staking address of the pool for which the amounts need to be returned._staker
- The staker address (validator's staking address or delegator's address).- Returns:
- uint256
- uint256
setErc677TokenContract
function setErc677TokenContract(IERC677Minting _erc677TokenContract) external
Sets the address of the ERC677 staking token contract. Can only be called by the `owner`. Cannot be called if there was at least one stake in staking tokens before.
- Modifiers:
- onlyOwner onlyInitialized
- Parameters:
_erc677TokenContract
- The address of the contract.