Skip to content

Commit

Permalink
docs: add sequence diagram for liquidations
Browse files Browse the repository at this point in the history
  • Loading branch information
Teolhyn committed Sep 12, 2024
1 parent c2db8b3 commit c094612
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,34 @@ sequenceDiagram
LoanManager-->>LendingPool: borrow()
LoanManager-->>UI: OK/Error
```

## Liquidate flow

```mermaid
sequenceDiagram
box Front-end
participant UI
end
box Laina Contracts
participant LendingPool
participant LoanManager
end
box Oracle Contracts
participant PriceOracle
end
UI->>LoanManager: get_undercol_loans()
loop calculate_health_factor()
LoanManager->>PriceOracle: last_price(token_borrow)
PriceOracle-->>LoanManager: PriceData
LoanManager->>PriceOracle: last_price(token_collat)
PriceOracle-->>LoanManager: PriceData
LoanManager->>LoanManager: Check that health-factor is under minimum threshold
end
LoanManager-->>UI: Available Loans
UI->>LoanManager: liquidate_loan(token_borrow, amount)
LoanManager-->>UI: OK/Error
LoanManager-->>UI: if OK: transfer(token_collat, amount+liquidation_bonus)
```

0 comments on commit c094612

Please sign in to comment.