Function: prepareForRebalance(uint16 feeBps, address feeCollector)
This function advances the deposit and redeem epochs. It ensures that the previous deposit and redeem requests have been fulfilled before advancing the epochs. It also harvests the management fee.
Inputs
feeBpsControl: Controllable by the basket manager.
Constraints: The fee must be less than or equal to 3,000.
Impact: The management fee in basis points to be harvested.
feeCollectorControl: Controllable by the basket manager.
Constraints: None at this level.
Impact: The address that will receive the harvested management fee.
Branches and code coverage
Intended branches
Increase
nextDepositRequestIdby two.Increase
nextRedeemRequestIdby two.Call
_harvestManagementFee(feeBps, feeCollector).Update
lastManagementFeeHarvestTimestamptoblock.timestamp.Mint
feetofeeCollector.Call
FeeCollector(feeCollector).notifyHarvestFee(fee).
Negative behavior
Revert if the caller is not the basket manager.
Revert if
previousDepositRequest.totalDepositAssetsis greater than zero andpreviousDepositRequest.fulfilledSharesis zero.Revert if
previousRedeemRequest.totalRedeemSharesis greater than zero,previousRedeemRequest.fulfilledAssetsis zero, andpreviousRedeemRequest.fallbackTriggeredis false.Revert if
feeBpsis greater than 3,000.
Function call analysis
this._harvestManagementFee(feeBps, feeCollector) -> this._mint(feeCollector, fee) -> this._update(address(0), account, value) -> ERC20PluginsUpgradeable._updateWhat is controllable?
feeCollectorandfeeare controllable by the basket manager.If the return value is controllable, how is it used and how can it go wrong?
feeBpsandfeeCollectorare controllable by the basket manager.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 before updating claimable fees in FeeCollector, butERC20PluginsUpgradeable._updatehas a reentrancy guard.
this._harvestManagementFee(feeBps, feeCollector) -> FeeCollector(feeCollector).notifyHarvestFee(fee)What is controllable?
feeBpsandfeeCollectorare controllable by the basket manager.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.