Function: deposit(uint256 assets, address receiver, address controller)
This function transfers a user's shares owed for a previously fulfilled deposit request.
Inputs
assets
Control: Fully controlled by the caller.
Constraints: This must match the claimable deposit assets.
Impact: The amount of assets previously requested for deposit.
receiver
Control: Fully controlled by the caller.
Constraints: None at this level.
Impact: The address to receive the shares.
controller
Control: Fully controlled by the caller.
Constraints: The caller must be the controller or an operator of the controller.
Impact: The address of the controller of the deposit request.
Branches and code coverage
Intended branches
Set
depositRequest.depositAssets[controller]
to zero.Transfer
shares
toreceiver
.
Negative behavior
Revert if
assets
is zero.Revert if the caller is not the controller or an operator of the controller.
Revert if
assets
does not match the claimable deposit assets.
Function call analysis
this._claimDeposit(depositRequest, assets, shares, receiver, controller) -> this._transfer(address(this), receiver, shares) -> this._update(from, to, value) -> ERC20PluginsUpgradeable._update -> ERC20PluginsUpgradeable._updateBalances(address plugin, address from, address to, uint256 amount)
What is controllable?
assets
,receiver
, andcontroller
.If the return value is 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? It can reenter the contract while updating balances calling
receiver
's plug-ins, but this function follows the checks-effects-interactions pattern.