Function: addToDepositQueue(uint256 amount, address receiver)
Adds a deposit to the depositQueue
storage array.
Inputs
amount
Control: Fully controlled.
Constraints: The
receiver
must own at least this amount ofasset
tokens.Impact: This amount of tokens are transferred from the
receiver
to this contract.
receiver
Control: Fully controlled.
Constraints: Must have preapproved this contract.
Impact: Tokens are transferred from this address to this contract.
Branches and code coverage (including function calls)
Intended branches
Should update the count of queued deposits.
Should update the total queued deposits amount.
Should add a new deposit into the
depositQueue
storage array.Should emit a
DepositQueued
event.Should decrease the asset balance of the
receiver
.Should increase the asset balance of this contract.
Negative behaviour
Should revert if the deposit queue is not open.
Should revert if this deposit would cause the product to go over its maximum deposit amount limit.
Should revert if the
receiver
has not approved this contract to spend the required amount.
Function call analysis
IERC20(asset).safeTransferFrom(receiver, address(this), amount)
What is controllable? receiver, amount.
If return value controllable, how is it used and how can it go wrong? N/A.
What happens if it reverts, reenters, or does other unusual control flow? If it reverts, the deposit will fail. No other side effects as it follows the CEI pattern.