If there is ETH, WETH, or RPL sent to the OperatorDistributor before any shares are minted, previewMint() and previewDeposit() are broken. This is because we override the totalAssets() function to take into account the OperatorDistributor's assets, but totalSupply() is still 0 when checked in _convertToAssets() or _convertToShares().
Unfortunately, we can't stop users from sending WETH or RPL to the OperatorDistributor contract before shares are minted, so the easiest fix might be to simply use different logic for in the special case where totalSupply() is 0:
in previewMint(), use shares.mulDiv(totalAssets(), 1e18) instead of the parent function
in previewDeposit(), use assets.mulDiv(1e18, totalAssets()) instead of the parent function
Note that this is low priority because they are only preview functions and the rest of the protocol still works effectively in this scenario.
If there is ETH, WETH, or RPL sent to the OperatorDistributor before any shares are minted,
previewMint()
andpreviewDeposit()
are broken. This is because we override thetotalAssets()
function to take into account the OperatorDistributor's assets, buttotalSupply()
is still 0 when checked in_convertToAssets()
or_convertToShares()
.Unfortunately, we can't stop users from sending WETH or RPL to the OperatorDistributor contract before shares are minted, so the easiest fix might be to simply use different logic for in the special case where
totalSupply()
is 0:previewMint()
, useshares.mulDiv(totalAssets(), 1e18)
instead of the parent functionpreviewDeposit()
, useassets.mulDiv(1e18, totalAssets())
instead of the parent functionNote that this is low priority because they are only preview functions and the rest of the protocol still works effectively in this scenario.