🔴LT Optimizer (Easy)

Taken ✨ (1-2 weeks)

To protect pool from loss, user collateral is weighted for 2 reasons:

  • The liquidation comes with fees, a premium for the liquidator and an other part for the protocol. Thus, we need to take into account those fees in the value of user collaterals.

  • The collateral can be different from the user debt token. A very volatile asset (against the debt token) could rapidly lose in value and create an insolvency and thus a loss for the pool

Liquidation Threshold = 1 - ( liquidation premium + liquidation fees + volatility of the asset against the debt token)

Currently, volatility is set by the governance, this process requires manual intervention and brings a lot of overhead with it. Also it is pretty centralized

Our solution is to create an on-chain liquidation threshold parameters optimizer. Anyone can update the liquidation thresholds, calling the optimizer, taking account the volatility of the concerned asset through Empiric composable datafeed.

Task:

  • Head to lib/morphine/optimizers and create ltOptimizer.cairo

  • Implement the contract

  • Once you are ready, setup unit test with protostar

  • Propose solution to reward updaters, explain how the optimizer could be improved (what timeframe should we consider volatility for exemple)

Steps:

  • Build functions to add and remove token key for Empiric (docs)

  • Quote all allowed assets from borrow module and the debt token

  • Quote the volatility data through Empiric

  • Calculate the new liquidation threshold, taking into account the new volatility

  • Connect to borrow module configurator to access the "update liq threshold" method

  • Stick to the Yagi keeper standard so we can use it. (docs)

The interesting parameter here is the volatility of the asset against the debt token.

Last updated