AMM support for selling enough to repay a debt, or everything if there isn't enough #4321
Labels
AMM
Core Economy
OBSOLETE in favor of INTER-protocol
enhancement
New feature or request
Inter-protocol
Overarching Inter Protocol
needs-design
What is the Problem Being Solved?
When a Vault is in default, the liquidation contract currently makes two calls to the AMM in some cases. The request should be handled in a single call.
Description of the Design
See #2267. To satisfy offer safety, we start by trying to sell exactly enough to resolve the debt. If the balance of the collateral isn't enough to repay the debt, that transaction fails, and we make another call to sell everything. We should add a new method that relies on privateArgs to allow the caller to specify these requirements.
Security Considerations
Not a security issue.
Test Plan
Verify that the trade can succeed either by selling just enough and returning the excess, or by selling everything.
Eventually the RUN protocol will have to notice the shortfall and replace the lost funds, but we don't have a design for that yet.
The text was updated successfully, but these errors were encountered: