Open hats-bug-reporter[bot] opened 1 year ago
Github username: @0xmahdirostami Submission hash (on-chain): 0x75be549b866a04a89b15b940f9dbb02891d0089e67530973cbe15f1adc7461fa Severity: low
Description: Description\
In deposit function :
// calculate amount of shares to mint shares = _convertToShares(assets, Math.Rounding.Up);
BUT in _processTotalAssetsDelta function:
// calculate fee recipient's shares uint256 feeRecipientShares; if (totalShares == 0) { feeRecipientShares = feeRecipientAssets; } else { unchecked { feeRecipientShares = Math.mulDiv( feeRecipientAssets, totalShares, newTotalAssets - feeRecipientAssets ); } }
Math.mulDiv Calculates floor(x * y / denominator). So shares are calculated differently for the fee receiver.
Impact\
wrong calculation of shares for the fee received. As the the difference in calculations, I think it's low severity.
Attachments
Proof of Concept (PoC) File
Revised Code File (Optional)
feeRecipientShares = Math.mulDiv( feeRecipientAssets, totalShares, newTotalAssets - feeRecipientAssets, + Math.Rounding.Up ); } }
We round up only for user, because we don't want him to deposit 1 ETH and see 0.99999... ETH in the UI, otherwise we round down.
Github username: @0xmahdirostami Submission hash (on-chain): 0x75be549b866a04a89b15b940f9dbb02891d0089e67530973cbe15f1adc7461fa Severity: low
Description: Description\
In deposit function :
BUT in _processTotalAssetsDelta function:
Math.mulDiv Calculates floor(x * y / denominator). So shares are calculated differently for the fee receiver.
Impact\
wrong calculation of shares for the fee received. As the the difference in calculations, I think it's low severity.
Attachments
Proof of Concept (PoC) File
Revised Code File (Optional)