20,000 USDC
View results
Submission Details
Severity: low

A year is not always `365` days

Summary

The smart contract's calculations are based on the assumption that a year always consists of 365 days. However, this approach is flawed as it does not account for leap years, leading to incorrect values during those years.

Vulnerability Details

The contract's calculations and logic do not consider leap years, which consist of 366 days instead of the usual 365. Consequently, any time-sensitive operations or calculations performed by the contract during leap years will yield inaccurate results.

Code Snippet

File: Lender.sol
724: interest = (l.interestRate * l.debt * timeElapsed) / 10000 / 365 days;

Impact

The failure to account for leap years can have significant consequences, particularly if time-related functionalities are critical to the smart contract's operations.

Tools Used

Manual Review

Recommendations

Modify the contract's logic to account for leap years correctly. Implement checks and adjustments to ensure that time-based operations yield accurate results during both regular and leap years.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.