Function: requestRedeem(uint256 shares, address controller, address owner)
This function allows a user to request a redemption of shares from the basket. The shares are immediately transferred to this contract.
Inputs
sharesControl: Fully controlled by the caller.
Constraints: Nonzero.
Impact: The amount of shares to redeem.
controllerControl: Fully controlled by the caller.
Constraints: The
controllermust not have the last pending/claimable redeem request and claimable fallback shares.Impact: The address of the controller of the redeem request being created.
ownerControl: Fully controlled by the caller.
Constraints: None at this level.
Impact: The address of the owner of the redeemed shares.
Branches and code coverage
Intended branches
Check
AssetRegistry(assetRegistry).hasPausedAssets(bitFlag).Call
_spendAllowance(owner, msg.sender, shares)ifmsg.senderis notownerandowneris not an operator ofmsg.sender.Update
redeemRequestandlastRedeemRequestIdmappings.Transfer
owner'ssharesto this contract.
Negative behavior
Revert if
sharesis zero.Revert if
controllerhas the last pending redeem request.Revert if
controllerhas the last claimable redeem request.Revert if
controllerhas claimable fallback shares.Revert if any of the assets in the
bitFlagare paused.
Function call analysis
AssetRegistry(this.assetRegistry).hasPausedAssets(this.bitFlag)What is controllable? None.
If the return value is controllable, how is it used and how can it go wrong? A user can request a deposit for paused assets.
What happens if it reverts, reenters or does other unusual control flow? N/A.
this._transfer(owner, address(this), shares) -> this._update(from, to, value) -> ERC20PluginsUpgradeable._update -> ERC20PluginsUpgradeable._updateBalances(address plugin, address from, address to, uint256 amount)What is controllable?
ownerandshares.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
owner's plug-ins, butERC20PluginsUpgradeable._updatehas a reentrancy guard.