Function: stakeForAccount(address _fundingAccount, address _account, address _depositToken, uint256 _amount)
Allows staking of tokens on behalf of another account.
Inputs
_fundingAccountControl: Fully controlled by the caller (handler).
Constraints: None.
Impact: The account that will be used to fund the staking.
_accountControl: Fully controlled by the caller (handler).
Constraints: None.
Impact: The account that will be staked for.
_depositTokenControl: Controlled by the caller (handler).
Constraints: Checked that the token is whitelisted (
isDepositToken).Impact: The token to be staked.
_amountControl: Controlled by the caller (handler).
Constraints: Checked that the amount is greater than zero. Also, in the
safeTransferFromcall, it is checked that the_fundingAccount(in this case,msg.sender) has enough balance.Impact: The amount of tokens to be staked.
Branches and code coverage (including function calls)
Intended branches
Assumes no malicious intent on behalf of the handler.
Checks that the token is whitelisted (
isDepositToken).Checks that the amount is greater than zero.
Checks that the
_fundingAccounthas enough balance (safeTransferFrom).Updates the rewards for the
_account.Updates the
stakedAmountsfor the_account.Updates the
depositBalancesfor the_account.Updates the
totalDepositSupplyfor the_depositToken.Mints the
_amountof tokens to the_account.
Negative behavior
Should not be callable by anyone other than a handler.
Should not be callable if
isPrivateStakingModeistrue.