-
Notifications
You must be signed in to change notification settings - Fork 6
feat: collateral tracking #192
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
Conversation
|
@peer2f00l few things that I am unsure about:
|
|
Add collateral step is here: contracts/contract/market/src/impl_helper.rs Lines 40 to 70 in b167daf
Withdraw collateral step is here: contracts/contract/market/src/impl_market_external.rs Lines 119 to 154 in b167daf
You should be able to perform just about all of the necessary calculations as-we-go by adding logic in those two places. (And to the |
99e060d to
de232a9
Compare
peer2f00l
left a comment
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.
Please write tests to ensure the correctness of the new field as it appears in snapshots.
|
Added tests and encapsulation on snapshot, which is better to use defined functions so that future updaters don't accidentally make mistakes. |
d21fcf9 to
5fa7be2
Compare
Gas Report
Estimated snapshot limit: 14422
Estimated snapshot limit: 11235 |
peer2f00l
left a comment
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.
Tweaked some of the tests. In general, I think they should be more precise (checking actual values instead of just "is non-zero after deposit" or "is different from the previous state after X action").
Do agree, they should've been more tightly bound. It was mostly the interest that was (understandably) inconsistent, but it could yield false positives. |
|
Added priority high since this is blocking another priority-high #171. |
e8d7e85 to
07ea3a9
Compare
In order to support #171 (DefiLlama integration) we need to be able to expose the metrics of collateral standalone, as well as in the snapshot as well. This would then allow external parties to be able to calculate using the correct TVL method. TVL (total deposits (collateral assets + borrow assets) - outstanding loans)