Skip to content

Commit

Permalink
Merge branch 'main' into adam/hquery
Browse files Browse the repository at this point in the history
  • Loading branch information
toteki authored Jan 15, 2023
2 parents 49c7f50 + 63251f4 commit d133e56
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions x/leverage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,19 @@ A user's borrow limit is the sum of the contributions from each denomination of
}
```

#### Historic Borrow Limit, Value

The leverage module also makes use of the oracle's historic prices to enforce an additional restriction on borrowing.

The logic is:
- For any `MsgBorrow`, `MsgMaxBorrow`, `MsgDecollateralize`, `MsgWithdraw`, or `MsgMaxWithdraw`
- The borrower’s borrowed value must be less than their borrow limit (both computed using current prices) after the transaction
- AND the borrower’s borrowed_value must be less than their borrow_limit (both computed using historic prices) after the transaction
- Where historic prices are defined as the Median of the last `N` historic medians from the `oracle` module with `N = Token.HistoricMedians` in the leverage registry
- Else the transaction fails

Historic borrow limit and historic borrowed value are computed identically to their non-historic counterparts, except using the historic price described above in place of current price.

#### Liquidation Threshold

Each token in the `Token Registry` has a parameter called `LiquidationThreshold`, always greater than or equal to collateral weight, but less than 1, which determines the portion of the token's value that goes towards a _borrower's_ liquidation threshold, when the token is used as collateral.
Expand Down

0 comments on commit d133e56

Please sign in to comment.