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

  • _account

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: The address of the user performing the staking.

  • _amount

    • Control: Arbitrary.

    • Constraints: Greater than zero.

    • Impact: The amount of stakeToken the user wants to stake.

Branches and code coverage

Intended branches

  • Transfer stakeToken to the current contract.

  • Get the UserInfo structure of _account to update the user's staking information.

  • Calculate, by iterating over rewardPoolInfo, the rewardDebt for each reward pool and update the user's rewardDebt with the new amount.

  • Update user.lastStakeTime to the current block.timestamp to record the time when the staking occurs.

Negative behavior

  • Revert if _amount is zero.

Zellic © 2025Back to top ↑