Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Year is not exactly 365 days #26

Open
code423n4 opened this issue Apr 16, 2021 · 1 comment
Open

Year is not exactly 365 days #26

code423n4 opened this issue Apr 16, 2021 · 1 comment

Comments

@code423n4
Copy link
Contributor

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.

@lucas-manuel
Copy link
Collaborator

Informational, will not address

@Arachnid Arachnid changed the title Year is not exactly 356 days Year is not exactly 365 days Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants