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

Create mock for the vault liquidation feature #419

Closed
3 tasks done
Tracked by #421 ...
zoey-kaiser opened this issue Aug 16, 2022 · 31 comments
Closed
3 tasks done
Tracked by #421 ...

Create mock for the vault liquidation feature #419

zoey-kaiser opened this issue Aug 16, 2022 · 31 comments
Assignees

Comments

@zoey-kaiser
Copy link
Contributor

zoey-kaiser commented Aug 16, 2022

Goal

Mocked vault liquidation feature

Context

When a vault becomes underwater, it can be liquidated and a collateral auction can be started. Beforehand the vault can be at risk for a certain amount of time. With this addition we hope to give users insight into what vaults are at risk and help them liquidate underwater vaults.

Tasks

  • Create mock
  • Discuss
  • Create outline of what needs to be done
@zoey-kaiser
Copy link
Contributor Author

@valiafetisov
Copy link
Contributor

valiafetisov commented Aug 16, 2022

  • Liquidated vault becomes a collateral auction (if it wasn't clear so far), so instead of Vault not found there should be a seamless transition/possibility to switch to the started collateral auction. This is one of the main UI problems how to combine those two, so I would start from answering this question
    • Moreover, we need to investigate if data about liquidated vault can be fetched after it was liquidated and adjust not found page accordingly
  • No wallet was selected to send the incentive shouldn't be a panel from my perspective, because it's optional non-primary action. The idea of the panels is to provide a clear path though the execution which is already quite complicated. We already have functionality for bidding where the user can receive outcome to another wallet – so you can use the same pattern here
  • There is no transaction page? The user have to understand why it have to spend money before clicking the button and even before connecting a wallet and engaging into panels. Currently there is just a bunch of numbers which doesn't make sense to someone seeing this page for the first time
  • For advanced users there should be a way to prepare for new liquidatable vaults (ie pre-authorize, etc)

Therefore, the only important information for a vault is:

  • How close it is to being "liquidatable"?
  • How much would I get if I liquidate it?
    • Is it Liquidation price? Then maybe at least Liquidation prize is a better name? Net profit?
  • When will those numbers change?
  • In which direction will those numbers change if the change would happen right now?

The rest are technical details of the vault that doesn't make a difference to me, at least according to the investigation. Risk score from my perspective doesn't communicate enough information

@LukSteib
Copy link
Contributor

LukSteib commented Aug 16, 2022

This is one of the main UI problems how to combine those two, so I would start from answering this question

Agree, let's include a proposal on how this transition could be handled to the Mock

We already have functionality for bidding where the user can receive outcome to another wallet – so you can use the same pattern here

To be verified: If no address is specified the one that calls the function to liquidate will be the one to receive the incentive
If so, I agree to use the components we have in place for sending collateral auction proceeds to another wallet (see screenshot below)

How close it is to being "liquidatable"?

Unaware of what we will be able to fetch in the end I would see the following values as relevant in that regard:

  • liquidation price (ie. the price at which the liquidation can happen; in other words: the price at which the vault is under collateralised)
  • current price (ie. the current OSM price of the collateral)
  • (computed based on the two previous ones) required price drop for liquidation (ie. the percentage change in current price to equal the liquidation price)

How much would I get if I liquidate it?

This is the incentive that is referenced in the investigation issue. Here I would like to understand: What determines the height of the incentive? Is it always the same?

When will those numbers change?

Agree that this would be very helpful for the user to know (and coincides with the OSM price updates - AFAIK happen every hour)


image

image

@zoey-kaiser
Copy link
Contributor Author

Agree that this would be very helpful for the user to know (and coincides with the OSM price updates - AFAIK happen every hour)

I was doing some research into this and I think there is not defined time space in which the prices are recalculated (correct me if I am going off on a limb here). In this text, they talk about their rates module, that is in charge or recalculating debt on vaults. From what I understand, the numbers are only recalculated every time someone calls drip on the vault.

This is also why when looking at the rate graphs of vaults, they appear as follows:

image
Source: https://docs.makerdao.com/smart-contract-modules/rates-module#who-calls-drip

@zoey-kaiser
Copy link
Contributor Author

zoey-kaiser commented Aug 17, 2022

Risk score from my perspective doesn't communicate enough information

How would you recommend handling Risk score? The current implementation is taken from the Blockanalytica site. I feel like having a simple score based system, will greatly help new users understand what the state of the wallet is, without having to dig into the numbers a lot.

MOCK v2

MakerDAO vaults (1)

@valiafetisov
Copy link
Contributor

I feel like having a simple score based system, will greatly help new users understand what the state of the wallet is

State of the vault? Such clustering is important for the maker community to know the state of the protocol, but don't think it's important for the users who want to liquidate vaults and profit from it. I also don't think that a new user seeing this page for the first time will understand the meaning of red Underwater text – for me it looks like an error state with unexplained meaning. Do I need to read some documentation first to understand the UI? As I said: the only important thing for the decision to participate/stay of the page and wait is how close the vault to liquidatable state.

the numbers are only recalculated every time someone calls drip on the vault

Well, it's a great find, in the direction of general understanding of liquidation mechanism that I've been pushing in #363. Since documentation explicitly says The following entities are motivated to call drip: Keepers seeking to liquidate Vaults the UI should:

  • Provide information on why it should be called
  • Provide data supporting decision to call or not call it
  • Provide possibility to call it

Regarding OSM prices it's still unclear to me when and how they are updated and how they affect vaults.

  • Looking at the updated mock I don't see any changes regarding "the only important information for a vault"
  • Please don't use $ for the displayed prices, since there is no way we operate with them
  • "Liquidated vault" page should display available information about that vault that is (and if) fetchable via events.
    • At least it makes sense to indicate when the auction started and if it is active or not

@zoey-kaiser
Copy link
Contributor Author

Well, it's a great find, in the direction of general understanding of liquidation mechanism that I've been pushing in #363. Since documentation explicitly says The following entities are motivated to call drip: Keepers seeking to liquidate Vaults the UI should:

Until now I have not focused on writing texts concerning how the liquidation of vaults work. I agree that all the points you mentioned will need to be addressed. How does the writing of texts work normally when you were designing previous UI? Did you write an initial draft and hand it of to Lukas for review?

Regarding OSM prices it's still unclear to me when and how they are updated and how they affect vaults.

As far as I can see I did take your feedback into account. From the comment Lukas left it appeared to me that:

  • liquidation price (ie. the price at which the liquidation can happen; in other words: the price at which the vault is under collateralised)
  • current price (ie. the current OSM price of the collateral)
  • (computed based on the two previous ones) required price drop for liquidation (ie. the percentage change in current price to equal the liquidation price)

These were some of the important points for the first page, and then that

How much would I get if I liquidate it?

would be added to the Transaction page. Is that wrong?

For the other points:

  • When will the values change
  • In which direction will the values change

I feel like we need to do some further investigation, as I have no idea right now, what and how we would calculate this data.

  • Please don't use $ for the displayed prices, since there is no way we operate with them

From what I saw on the BlockAnalytica page, the values provided for the vaults were set in USD. Is this also the data we recieve or did they do some kind of conversion? If we do have to use USD, should I write USD behind it as a currency?

[ ] "Liquidated vault" page should display available information about that vault that is (and if) fetchable via events.

Sounds good! Ill make a mock (based on the old SurplusEvents table) and include it underneath the link!

@zoey-kaiser
Copy link
Contributor Author

Questions that need to be addressed:

  • Do we only get vaults that are liquidated, ready to be liquidated or something else? (What does "at-risk" mean)
  • What information do we get for every single vault? (I have been basing my mocks on this output)
  • Do we get historical data about the vaults or only the current values?
  • The rates module speaks of the need to drip vaults regularly to update the data. Can we calculate the actual rates on our frontend, to give the user an outlook on what data they can expect when dripping to update the vaules?
  • Can we give the user an estimate (based on either the last blockchain information or our own calculations) of when a vault would be ready to be liquidated?
  • Can we give the user a approximate estimate of how much incentive they gain when liquidating a vault?
  • We want to give the user a easy value to look at to show them how close a vault is to being liquidated. @valiafetisov proposed to have a percentage score of how close it is to being liquidated (say 0%-100%). What values can be used to create this percentage? (This in addition to the countdown will then provide the user will sufficient information about the time to liquidation).

@valiafetisov
Copy link
Contributor

valiafetisov commented Aug 17, 2022

Do we only get vaults that are liquidated, ready to be liquidated or something else? (What does "at-risk" mean)

While in other questions you not explicitly hint what you would like to have, here you can also give a hint on what information you would like to have: or just avoid using a closed question. Eg: "How can we get information about vaults that are about to be in 'ready to liquidate' state, not only the ones that are in this state already?"

Besides that, you should better post those questions to the investigation issue: to keep answers in one place.

@KirillDogadin-std
Copy link
Contributor

Do we only get vaults that are liquidated, ready to be liquidated or something else? (What does "at-risk" mean)

the minimal desired result is to have the vaults that are ready to be liquidated. the best case scenario is to also list vaults that are at risk. vaults at risk are the vaults that might soon become ready to be liquidated. Vaults that are liquidated are not in scope because these vaults are alcready being auctioned and this is covered by our ui.

What information do we get for every single vault?

  • So far this is to be clarified. For now. basing your guesses on the linked docs makes sense.

Do we get historical data about the vaults or only the current values?

historical data might be useful at some point, but is not required for the minimal functionality and it's questionable wether we should use it for displaying vaults at risk. reason for that is the fact that we maybe could just orient ourselves on the current collateralization ratio and the value that is queued in the osm contract.

The rates module speaks of ...

  • please adjust the comment with links and references to docs and/or contract lines before i answer.

Can we give the user an estimate

technically yes, but my question would be "how far in advance" would you like to make this prediction? First we have to define the "at risk" margin that we are going to use. e.g. with margin 10% we would consider predictions for all vaults that are within 10% from being underwater.

Can we give the user a approximate estimate of how much incentive they gain when liquidating a vault?

Yes, the values are stored in the clipper contract of the collateral (link)

What values can be used to create this percentage?

we have a collateralization and liquidation ratios.

in contract terms these are the formulas:

Collateralization Ratio = Vat.urn.ink * Vat.ilk.spot * Spot.ilk.mat / (Vat.urn.art * Vat.ilk.rate)
Liquidation ratio = Ilk.mat

@zoey-kaiser
Copy link
Contributor Author

Thank you for your answers @KirillDogadin-std! I have copied your answers and responded here.

@zoey-kaiser
Copy link
Contributor Author

As I am getting to a point where I am ready to draft texts, I will use this comment to outline what I think would make sense to include:

View 1 (Vault table):

  • What is the Maker Protocol (already written)
  • What are vaults?
    • How does one start a vault
    • What is the functionality behind one (aka why use it)
  • When do vaults go "at-risk"
  • Why should I participate? (not the same text as with the collateral auctions, but in the same line)

View 2 (Vault page):

  • Small explanation beneath the information table that indicates to the user, what they can do. We currently have two primary actions:
    • Liquidate vault (if possible)
    • Link to Blockanalytica, where the user gets more information about the current vault. I would make the liqudation link a button and the Blockanalytica link a clickable link inside a textblock in which we can also say what value Blockanalytica may bring to the table.

View 3 (Vault Transaction page):

  • Above the panels, I would like to add a small paragraph explaining the incentives of liquidating a vault. The user starting it receives a monetary reward, so the text would need to explain:
    • Where it comes from
    • How much it is
  • Text about Collateral Pre-authorization (We want to allow users who start liqudate auctions, to pre authorize the collateral, the vault contains. This is an optional step, however can be useful for when the user wants to bid directly afterwards) We need a small 1-2 sentence text for the panel to explain this reasoning.
  • Text about Vault being ready to liquidate. I would add a 2-3 sentence text into the LiqudationPanel, that neutrally explains when a vault is ready to be liquidated.

@zoey-kaiser
Copy link
Contributor Author

zoey-kaiser commented Aug 22, 2022

This morning I focused on redesigning the vault page (SplitView 2). Taking previous feedback into account I decided to add the following information to the Vault Table:

  • Current price - The current OSM price of the collateral
  • Liquidation price - The price at which the liquidation can happen; in other words: the price at which the vault is under collateralised
  • Collateral - The amount and type of collateral contained in the vault (I find this important, as the user may want to see what kind of collateral they can get from the collateral auction)
  • Last updated - not much to say here 😆

Screenshot 2022-08-22 at 11 08 46

@zoey-kaiser
Copy link
Contributor Author

zoey-kaiser commented Aug 22, 2022

I updated the entire mock to reflect the new information we learned about the Vaults. As @LukSteib also requested here is an overview of the most important components:

  • VaultTable
  • Vault (The second page aka CollateralAuction component)
  • VaultLiquidationTransactionTable
  • VaultLiquidationTransactionFlow
  • AnimatedArrow (to either show up, down, left or right and animate between states)
  • VaultEventTable or just EventTable (maybe refactor Added SurplusEventTable #305 for a general purpose event table?)
  • WalletConnectionCheckPanel (already exists)
  • WalletCollateralAuthCheckPanel (might need to be refactored as we use it to pre-auth, meaning that authorization is optional and not mandatory (like in other flows))
  • LiquidationPanel
  • SelectOtherWalletPopup (should exist might need to be refactored in terms of texts @LukSteib)
  • VaultFlow
  • VaultText
New version of the mock

MakerDAO vaults (2)

@valiafetisov valiafetisov changed the title Create Risk Vaults mock Create mock for the vault liquidation feature Aug 25, 2022
@valiafetisov
Copy link
Contributor

valiafetisov commented Aug 25, 2022

  • Prices are still in USD, which I don't think is correct, since we operate on the blockchain where there is no USD and displaying USD is misleading from my perspective. Correct me if I am wrong
  • We still display a lot of irrelevant information for the decision to participate or not, which makes it just plain confusing
  • We still don't display predictions on when it will become liquidatable or if it's going to get back
  • Vault ids should include collateral types just like in the collateral auctions, they are not globally defined
    • We might display vault address as well or link one or the other to external analytics
  • The transaction table doesn't make much sense to me at the moment, it just displays a bunch of numbers instead it should explain where the money are coming from (ie tip and chip values)
  • The transaction panels have wrong states: The wallet is not yet authorized to execute ETH-A transactions is green for some reason
  • Liquidated vault links to the auction out of the context of the message on top – the message and the button should be grouped

And other minor things. I will try to update the mock based on those points right away

@valiafetisov
Copy link
Contributor

Also, there is no proposal on how to integrate drip into the UI, despite the finding that it directly affects state of the vaults

@valiafetisov
Copy link
Contributor

valiafetisov commented Aug 25, 2022

Updated mock. Notes:

  • I've added another panel that checks protocol debt as per the contract
    • I think there are more checks that should be added to the same (or possibly other panels)
  • drip is not yet taken into account, but I assume it can be another panel somewhere inside panel that checks that vault is liquidatable (ie currently it's the last panel) but we need more data to understand when it's going to happen
New version

MakerDAO vaults@2x (1)

@KirillDogadin-std please validate feasibility of the mock (ie if it's actually possible to implement proposed solution, based on your technical understanding)

@LukSteib
Copy link
Contributor

Some remarks

  • IMO the naming Liquidation ratio as the leading indicator on the liquidation state of a vault is misleading. What the current mock indicates as the Required collateralisation ratio is widely known as "liquidation ratio". So I'd rather propose to
    • Rename Required collateralisation ratio into Liquidation ratio
    • Rename Liquidation ratio into ???
  • I like the additional check panel for the line you are referencing (ie. regarding hole and dirt). However, think we need to adjust the naming. My understanding: On an overall and on an collateral level it is ensured that the amount of auctioned debt is not too high (to reduce the risk of illiquid markets). -> Question: How to put that into understandable words
    • Addtional complexity: AFAIK this check might fail, but one could still lquidate the vault resulting in a partial liquidation (mabye fine to leave aside for now)
  • Q: Does the arrow for the "Next price update" indicate whether a price increase or decrease is expected?
    • What is your reasoning to not display "Current Price" and "Next price" instead?

@valiafetisov
Copy link
Contributor

IMO the naming Liquidation ratio as the leading indicator on the liquidation state of a vault is misleading

Agree, renamed. The leading indicator is [temporary] named Proximity to liquidation threshold

Question: How to put that into understandable words

Eg Current global liquidation limits are not reached

Addtional complexity: AFAIK this check might fail, but one could still lquidate the vault resulting in a partial liquidation (mabye fine to leave aside for now)

Partial liquidation logic is below linked require statement, so I don't think it's true. Investigation result if the value that can still be auctioned is less than the value contained in the vault, partial liquidation is initiated. doesn't really explain when the edge case of partial liquidation is triggered

Q: Does the arrow for the "Next price update" indicate whether a price increase or decrease is expected?

In case of the down arrow the Proximity to liquidation threshold will go down

What is your reasoning to not display "Current Price" and "Next price" instead?

I think showing prices can be too raw: what user actually needs to know is the difference between current OSM price and expected OSM price in percentage. And I think we might need to explain OSM update logic somewhere in the text (possibly related to the drip functionality)

@valiafetisov
Copy link
Contributor

valiafetisov commented Aug 25, 2022

Updated mock

MakerDAO vaults@2x (3)

@LukSteib
Copy link
Contributor

Agree, renamed. The leading indicator is [temporary] named Proximity to liquidation threshold

Great new naming

Eg Current global liquidation limits are not reached

sounds good

what user actually needs to know is the difference between current OSM price and expected OSM price in percentage.

Are you planning to include this concrete percentage indicator to the "Next Price Update" row in addition to the arrow that indicates the direction?
Is my understanding correct that all else equal a price reduction of say 5% would also cause the Proximity to liquidation threshold to decrease by 5%?

And I think we might need to explain OSM update logic somewhere in the text (possibly related to the drip functionality)

Agree, I would like to improve our understanding of drip and poke functionality and add it where appropriate. Based on current understanding these two are non-auth protected functions that can directly affect collateralisation ratio of a given vault.

@KirillDogadin-std
Copy link
Contributor

KirillDogadin-std commented Aug 29, 2022

I have the following questions:

  • "Liquidation insensitive" is a typo, right? Otherwise what does the term mean?
  • I don't think transactions for collateral has to be authorized: the dog contract does not require any authorizations, does it?

Apart from this, the mock looks solid. That is, if the following holds true:

  • the price prediction is based on the contract parameter which sets the delay
  • we will calculate the current median price change in the field where we predict the price change:

@valiafetisov
Copy link
Contributor

valiafetisov commented Aug 29, 2022

"Liquidation insensitive" is a typo, right?

😓 yes, I meant incentive

I don't think transactions for collateral has to be authorized: the dog contract does not require any authorizations, does it?

No idea. The dog contract might not need authorization, but the underlying calls of the contracts (eg vat.grab or vow.fess or clip.kick, underlying calls of those methods) might need.

  • Regarding the mock: I suggest we remove the auth step until investigation proves that it is required

@zoey-kaiser
Copy link
Contributor Author

already done!

  • Regarding the mock: I suggest we remove the auth step until investigation proves that it is required

Ill remove it right now!

@zoey-kaiser
Copy link
Contributor Author

Screenshot 2022-08-29 at 14 51 19

@valiafetisov, what does this panel look like in the incorrect state? I don't know what it represents/looks like in other states.

@valiafetisov
Copy link
Contributor

This comment explains what it does: basically it fetches some values from the chain to make sure they are correct. So the expanded panel should explain what it checks, maybe show them in a table (or the derived values that makes sense, eg current global limit, current ${collateral} limit) and provide a button to refresh them

@zoey-kaiser
Copy link
Contributor Author

Updated Mock:
MakerDAO vaults (1)

@valiafetisov
Copy link
Contributor

Regarding limits: it's not the amount of liquidations, It's 2 numbers per limit, both in DAI: https://github.com/makerdao/dss/blob/fa4f6630afb0624d04a003e920b0d71a00331d98/src/dog.sol#L77

You can either display and explain both of them or display Max DAI needed to cover debt+fees of active auctions minus Amt DAI needed to cover debt+fees of active auctions to be bigger than 0 or the DAI amount of the liquidation (eg debt)

@zoey-kaiser
Copy link
Contributor Author

I updated it to the following:
Screenshot 2022-08-29 at 17 08 59

When hovering over the icon, you get a small explain field, with your explanations (rewritten a bit to make them more understandable)

@zoey-kaiser
Copy link
Contributor Author

I was in a call with @LukSteib, we were thinking if we can show the Liquidation Limits in the following way:

CurrentLiqudationsDAI (+DAI Added by Transaction) / GlobalLimitDAI

It would look as following in the mock:

Screenshot 2022-08-30 at 18 02 29

I believe this makes more sense, as the user is informed how much they are adding and how much DAI is left to liquidate. Is this technically possible @KirillDogadin-std and @valiafetisov? From my rough understanding we would need to fetch all active auctions (which we do anyway) and add their DAI amounts together right?

@valiafetisov
Copy link
Contributor

From my rough understanding we would need to fetch all active auctions (which we do anyway) and add their DAI amounts together right?

The limits are already tracked by the respective contracts as the contract itself have them. We just need to fetch those 4 numbers: dog.Hole, dog.Dirt, clip.hole, clip.dirt.

Regarding the mock:

  • The title Current global liquidation limits are reached seems to contradict the table
  • I don't think the user will make sense of this notation, which uses mix of math (eg +) and common sense (eg / in the meaning of, not divide). Instead, please stick to one notation (math) or use plain words

Suggestion:

Current global limit:     100000000 – 200 – 10 = 999997900 DAI
Current ETH-A limit:                  421 – 100 – 10 = 311 DAI

Where each of the numbers (100000000, 200 and 10; 421, 100 and 10 will have the Explain text)

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

4 participants