-
Notifications
You must be signed in to change notification settings - Fork 84
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
Loans: multiple cashflows PoC #1408
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like to much!
@@ -52,6 +52,7 @@ impl<Rate: FixedPointNumber> DiscountedCashFlow<Rate> { | |||
}) | |||
} | |||
|
|||
// TODO: this should account for cashflows from interest payments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should tackle this in a future PR
pallets/loans/src/types/mod.rs
Outdated
Balance: tokens::Balance + FixedPointOperand, | ||
Rate: FixedPointNumber, | ||
{ | ||
// TODO: once we implement a pay_down_schedule other than `None`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should tackle this in a future PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A minor comment below. Tell me when it's ready for a final deep review
252dc29
to
bb9ae51
Compare
I've redo the PR because 99% of the changes were git conflicts with others PRs. I hope I did it well. |
f188035
to
24b7c29
Compare
…into multi-cashflows
Re-created branch & PR #1797 Most of the code generated conflicts when rebasing, and I want to maintain this as it is as reference. |
* updated from #1408 * add testing * organize and polish cashflow module * add Runtime API * update types.md * make it works without chronoutils * minor changes * add borrow check * fix legacy increase_debt test * add loan cashflow tests * compute principal and interest * correct validation * add CashflowPayment type * add variant error * fix interest computation when months are partial * remove Rate usage and use weight * fix start date for cashflows * rename api name * fix benchmarks * taplo fmt * using a lower discount rate to simply benchmarking * rewrite doc line * interest computed at maturity * remove borrow support * fix compilation * None to OnceAtMaturity variant * compilation fixes * Loans: multi cashflows fix external loan (#1864) * correct principal/interest for both kind of loans * support for external prices * add external test * simplify implementation * start from repayments
Description
Implements a basic PoC for multiple cashflows, specifically monthly or semi-annual interest payments, as well as a corresponding write-off trigger.
Checklist: