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

error in caculate PV #635

Open
mosheng-eng opened this issue Feb 7, 2024 · 0 comments
Open

error in caculate PV #635

mosheng-eng opened this issue Feb 7, 2024 · 0 comments

Comments

@mosheng-eng
Copy link

In the function _writeOff of navfeed.sol, I find an error in caculating PV(Present Value).
// first time written-off if (isLoanWrittenOff(loan) == false) { uint256 fv = futureValue(nftID_); if (uniqueDayTimestamp(lastNAVUpdate) > maturityDate_) { // write off after the maturity date overdueLoans = secureSub(overdueLoans, fv); latestNAV_ = secureSub(latestNAV_, fv); } else { // write off before or on the maturity date buckets[maturityDate_] = safeSub(buckets[maturityDate_], fv); uint256 pv = rmul(fv, rpow(discountRate, safeSub(uniqueDayTimestamp(maturityDate_), nnow), ONE)); latestDiscount = secureSub(latestDiscount, pv); latestNAV_ = secureSub(latestNAV_, pv); } }
I think you should use rdiv to caculate PV by FV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant