-
Notifications
You must be signed in to change notification settings - Fork 1
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
Issue 43 - Need to account for already repaid amount in liquidations #85
base: merge-train-r5
Are you sure you want to change the base?
Conversation
additional work must be done here + testing it is important that this accounting is done correctly so that the poolTotalEstimatedValue remains valid even after a loan, which had been partially repaid, is liquidated |
used TDD to help me improve and simplify this - built 6 unit tests with different scenarios/stories rebuilt some of the logic related to liquidations. The amount taken from the liquidator is actually now the amount that remained unpaid -- not the total loan amount. |
Need to account for already repaid amount in liquidations
if a loan had already been partially repaid, the pool WILL have more tokens, but the estimated value of the pool will not increase because we arent (we cant) include tokens repaid amount in the tool est value. In this story, if the loan is normally repaid in full so there is no issue.
However, if a loan is repaid 95% but the remaining 5% is unpaid, then it goes into liquidation, this is more complex.
For example, if the loan auction is at a shortfall of $200 but the loan was previously partially repaid $1800 , the loan really isnt at a shortfall but it is up $1600 overall. SO that is how it should affect the accounting. Before, we would account that it was a total shortfall of $200.