Function: fulfillRedeem(uint256 assets)
This function allows the basket manager to fulfill all pending redeem requests for the current request. The shares in this contract are burned, and the assets are transferred to the basket manager.
Inputs
assetsControl: Fully controlled by the basket manager.
Constraints: Nonzero.
Impact: The amount of assets the current redemption will be fulfilled with.
Branches and code coverage
Intended branches
Set
fulfilledAssetsof the current request toassets.Burn
sharesPendingRedemptionshares from the basket.Transfer
assetsto the basket manager.
Negative behavior
Revert if the caller is not the basket manager.
Revert if
sharesPendingRedemptionis zero.Revert if
assetsis zero.Revert if the current request has already been fulfilled.
Function call analysis
this._burn(address(this), sharesPendingRedemption) -> this._update(account, address(0), value) -> ERC20PluginsUpgradeable._update -> ERC20PluginsUpgradeable._updateBalances(address plugin, address from, address to, uint256 amount)What is controllable?
sharesPendingRedemption.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? N/A.
SafeERC20.safeTransferFrom(IERC20(this.asset()), msg.sender, address(this), assets)What is controllable? Can increase
assetsby redeeming more shares.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? N/A.