Issue 43 - Need to account for already repaid amount in liquidations#85
Open
ethereumdegen wants to merge 20 commits intomerge-train-r5from
Open
Issue 43 - Need to account for already repaid amount in liquidations#85ethereumdegen wants to merge 20 commits intomerge-train-r5from
ethereumdegen wants to merge 20 commits intomerge-train-r5from
Conversation
Collaborator
Author
|
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 |
Collaborator
Author
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.