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

Minimum acceptable Liquidation Contract #4568

Closed
rowgraus opened this issue Feb 16, 2022 · 5 comments
Closed

Minimum acceptable Liquidation Contract #4568

rowgraus opened this issue Feb 16, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request Inter-protocol Overarching Inter Protocol Vaults VaultFactor (née Treasury)
Milestone

Comments

@rowgraus
Copy link

rowgraus commented Feb 16, 2022

What is the Problem Being Solved?

Our existing liquidation contract sells vaults on the AMM one at a time until liquidations are complete. However, there is no protection against large vaults (relative to AMM pool size) coming up for liquidation, such as the $65m vault that was liquidated on Maker several weeks ago. A sale of a large vault relative to the collateral in the liquidity pool would cause a large price impact and lead to significant losses for the RUN Protocol.

For reference, the price impact of a trade on an X*Y=K curve is 2x the size of the trade relative to the size of the pool. For example, a $10m trade on a pool with $50m in liquidity would lead to a drop in price received for the trader of 40% (2 x 20%).

This ticket is to create a new liquidation contract which implements controls on the sale to minimize price impacts.

Description of the Design

Specific elements include:

  1. Creating and defining a "cohort" of liquidated vaults, which share in leftover change after liquidation of the full cohort is complete
  2. Splitting individual sales on the AMM based on X% of the total AMM pool size (specific % a governance-controllable parameter. 0.05% reasonable)
  3. Delay sale actions by a controllable parameter (gov. controllable parameter. 10 seconds reasonable)
  4. Stop sale activity if AMM price diverges from Oracle price by > then X% (gov. controllable parameter. 5% reasonable)

Raw notes from previous discussion:

  • Aggregation of liquidated vaults (liq contract has internal seat to sell from with loop until it is empty)
  • Rate limiting of liquidation:
    -- Limit size of sales to limit price impact to a threshold (0.1% of pool size - controllable by governance)
    -- We expect Liquidator to pay gas fees out of execution fees it got from everyone else
    -- Delay between sale actions by controllable parameter (10 seconds)
  • Limit of oracle vs. AMM price - stop selling if price diverges by X% controllable by governance
  • Cohort model to return assets
    -- Message to liquidation engine that says “ok I’m done now”
    -- Cohort model to be defined as we go

Security Considerations

Test Plan

  • sell an amount smaller than the tranche size
  • sell an amount exactly equal to the tranche size
  • sell larger than tranche size
  • oracle diverges from amm price and so pause liquidation

ref: #3533

@rowgraus rowgraus added enhancement New feature or request Inter-protocol Overarching Inter Protocol labels Feb 16, 2022
@Tartuffo
Copy link
Contributor

@turadg For Restival, create a new ticket to clean up liquidation selection in Vault Manager.

@dckc
Copy link
Member

dckc commented Feb 16, 2022

The problem statement isn't clear to me. Why should we protect against "large vaults (relative to AMM pool size) coming up for liquidation"? What bad thing happens if we don't?

@turadg
Copy link
Member

turadg commented Feb 16, 2022

@turadg For Restival, create a new ticket to clean up liquidation selection in Vault Manager.

#4571 is the portion we need for Restival.

@rowgraus
Copy link
Author

The problem statement isn't clear to me. Why should we protect against "large vaults (relative to AMM pool size) coming up for liquidation"? What bad thing happens if we don't?

Problem statement updated to clarify

@dckc
Copy link
Member

dckc commented Apr 26, 2022

@dtribble what's left to do on this? Did you mean to close it? For the purpose of #5062, I presume you did.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Inter-protocol Overarching Inter Protocol Vaults VaultFactor (née Treasury)
Projects
None yet
Development

No branches or pull requests

6 participants