Function: addToDepositQueue(uint256 amount, address receiver)
Adds a deposit to the depositQueue storage array.
Inputs
amountControl: Fully controlled.
Constraints: The
receivermust own at least this amount ofassettokens.Impact: This amount of tokens are transferred from the
receiverto this contract.
receiverControl: 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
depositQueuestorage array.Should emit a
DepositQueuedevent.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
receiverhas 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.