Judge has assessed an item in Issue #206 as 2 risk. The relevant finding follows:
[L-01] Incorrect Return Value for previewDeposit()
The calculation path for previewDeposit() and deposit() is as follows:
previewDeposit() => _convertIBTsToSharesPreview() => _getPTandIBTRates(true)
deposit() => _convertIBTsToShares() =>_getPTandIBTRates(false)
previewDeposit() should use the same rounding direction as deposit().
suggest:
function _convertIBTsToSharesPreview(uint256 ibts) internal view returns (uint256 shares) {
(uint256 _ptRate, uint256 _ibtRate) = _getPTandIBTRates(true); // to round up the shares, the PT rate must round down
(uint256 _ptRate, uint256 _ibtRate) = _getPTandIBTRates(false); // to round up the shares, the PT rate must round down
if (_ptRate == 0) {
revert RateError();
}
shares = ibts.mulDiv(_ibtRate, _ptRate);
}
Judge has assessed an item in Issue #206 as 2 risk. The relevant finding follows:
[L-01] Incorrect Return Value for previewDeposit() The calculation path for previewDeposit() and deposit() is as follows:
previewDeposit() => _convertIBTsToSharesPreview() => _getPTandIBTRates(true) deposit() => _convertIBTsToShares() =>_getPTandIBTRates(false) previewDeposit() should use the same rounding direction as deposit().
suggest: