Function: _stakeFor(address _account, uint256 _amount)
This function will be called by the stake function, used for users to stake stakeToken and record the relevant information of this transaction.
Inputs
_accountControl: Arbitrary.
Constraints: None.
Impact: The address of the user performing the staking.
_amountControl: Arbitrary.
Constraints: Greater than zero.
Impact: The amount of
stakeTokenthe user wants to stake.
Branches and code coverage
Intended branches
Transfer
stakeTokento the current contract.Get the
UserInfostructure of_accountto update the user's staking information.Calculate, by iterating over
rewardPoolInfo, therewardDebtfor each reward pool and update the user'srewardDebtwith the new amount.Update
user.lastStakeTimeto the currentblock.timestampto record the time when the staking occurs.
Negative behavior
Revert if
_amountis zero.