Function: mint(uint256 shares, address receiver, address controller)
This function transfers a user's shares owed for a previously fulfilled deposit request.
Inputs
shares
Control: Fully controlled by the caller.
Constraints: This must match
_maxMint(fulfilledShares, depositAssets, depositRequest.totalDepositAssets)
.Impact: The amount of shares to receive.
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 the caller is not the controller or an operator of the controller.
Revert if
shares
does not match_maxMint(fulfilledShares, depositAssets, depositRequest.totalDepositAssets)
.
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?
shares
,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.