You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function getNextPayment in RepaymentCalc.sol makes a calculation based on 365 days.
However a year does not exactly contain 365 days, depending on it being a leap year.
So the calculations might be slightly off.
Proof of Concept
RepaymentCalc.sol:
function getNextPayment(address _loan) view public returns(uint256, uint256, uint256) {
..
uint256 interest =
principalOwed
.mul(loan.apr())
.mul(loan.paymentIntervalSeconds())
.div(10_000)
.div(365 days);
Tools Used
Editor
Recommended Mitigation Steps
Check if the difference for leap years is relevant. Perhaps add a comment if the difference is ignored.
The text was updated successfully, but these errors were encountered:
Handle
gpersoon
Vulnerability details
Impact
The function getNextPayment in RepaymentCalc.sol makes a calculation based on 365 days.
However a year does not exactly contain 365 days, depending on it being a leap year.
So the calculations might be slightly off.
Proof of Concept
RepaymentCalc.sol:
function getNextPayment(address _loan) view public returns(uint256, uint256, uint256) {
..
uint256 interest =
principalOwed
.mul(loan.apr())
.mul(loan.paymentIntervalSeconds())
.div(10_000)
.div(365 days);
Tools Used
Editor
Recommended Mitigation Steps
Check if the difference for leap years is relevant. Perhaps add a comment if the difference is ignored.
The text was updated successfully, but these errors were encountered: