galacticcouncil / galacticcouncil/hydration-node

Add option to flash loan for unlooping MM position

Open
#1,392 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
208
Forks
109
Avg merge
6d 3h
Merged PRs (30d)
3

Description

### Description:
Use flash loan to cover all user debt in money market, and repay this loan with his supplied asset.
We will use this feature for unlooping MM positions.
This position will be created on proxy account (adding just for context if it would change any decision)

### Scenario
Users position on proxy account is as follows:
MM: 300 PRIME supplied, 205.78 HOLLAR borrowed
WALLET: 300 aPRIME, 205.78 HOLLAR

Step 1: Flash Loan the exact debt amount
Borrow 205.78 HOLLAR from the flash loan provider (no collateral needed, must repay within same transaction)

Step 2: Repay entire HOLLAR debt
Use the flash loaned HOLLAR to clear money market debt completely

Step 3: Withdraw all PRIME
With 0 debt, there are no HF constraints — user can withdraw everything

Step 4: Swap just enough PRIME to cover the flash loan

Step 5: Repay flash loan

With this process, user will end up with clear money market, without any supply or debt

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.