A Python bot for liquidation of unhealthy obligations in Solaris protocol.
-
The bot fetches all obligations accounts inside the protocol and tries to find an unhealthy one (
obligation.borrowed_value < obligation.unhealthy_borrow_value
) and checks if the liquidation will be profitable (liquidation_reward > flashloan_fee
) -
The bot sends a
liquidate_obligation
instruction to the liquidation program containing a public key of unhealthy obligation -
Liquidation program gets some
liquidity_amount
from a lending program via flashloan and repays a loan. Then if it returns flashloan +flashloan_fees
and takes a liquidation reward. Ifbalance_before < balance_after
it returnOk()
, if now throws an error and reverts the transaction.