Platform: Code4rena
Start Date: 01/08/2022
Pot Size: $50,000 USDC
Total HM: 26
Participants: 133
Period: 5 days
Judge: Jack the Pug
Total Solo HM: 6
Id: 151
League: ETH
Rank: 40/133
Findings: 1
Award: $165.63
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: scaraven
Also found by: 0x52, Deivitto, Lambda, TrungOre, auditor0517, hansfriese, rbserver, simon135, smiling_heretic, sseefried
165.6336 USDC - $165.63
There might be division loss during interest calculation so builders would pay less interest than they should to lenders.
During the interest calculation, we calculate the days of the elapsed period.
So if builders repay some amount after 47 hours, the interest will be added for 1 day only.
As a result, builders would pay less interest(almost half if they repay frequently) than they should and lenders might lose their interest.
Manual Review
Recommend calculating like below with this part.
uint256 _unclaimedInterest = _lentAmount * _communities[_communityID].projectDetails[_project].apr * (block.timestamp - _communityProject.lastTimestamp) / 365000 / 86400;
#0 - horsefacts
2022-08-06T20:40:34Z
#1 - itsmetechjay
2022-08-18T19:18:05Z
@parv3213 do you agree with this one?