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

[VEN-2030]: add flash swap liquidation operator #372

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

kkirka
Copy link
Collaborator

@kkirka kkirka commented Oct 18, 2023

This PR contains a contract to perform liquidations on Venus using flash loans (for in-kind liquidations) and flash swaps (for cross-token liquidations) on PancakeSwap V3.

The following kinds of liquidations are supported:

  1. In-kind liquidation (liquidate BUSD borrow seizing vBUSD) – uses the pool from the provided path to source the liquidity from, flash-loans from this pool using flash() and performs the liquidation.
  2. Cross-token liquidation:
    a. Using a single pool (e.g., liquidate BUSD seizing vBNB) – flash-swaps the collateral token to the borrowed token using swap(), performs the liquidation and repays the flash swap using collateral tokens directly.
    b. Liquidating along the path (BUSD-TokenB-TokenC-...-CollateralToken, e.g. liquidate BUSD seizing vADA, using BUSD/WBNB pool as a liquidity source) – flash-swaps the path's TokenB to the borrowed token using swap(), performs the liquidation, swaps collateral tokens to TokenB along the remainder of the path, and repays the flash swap using the TokenB.

Notes:

  • The script for choosing the optimized path is out of the scope of this PR.
  • This PR will likely not be merged into this repository, I propose we create a new repo for such contracts (and possibly scripts working with such contracts).
  • Unit-tests and more fork tests are to be developed.

@kkirka kkirka added the don't merge Need to merge after passing test label Oct 18, 2023
@Debugger022 Debugger022 self-requested a review October 23, 2023 12:31
Base automatically changed from feat/busd-liquidator to develop October 24, 2023 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
don't merge Need to merge after passing test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants