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_obligationinstruction to the liquidation program containing a public key of unhealthy obligation -
Liquidation program gets some
liquidity_amountfrom a lending program via flashloan and repays a loan. Then if it returns flashloan +flashloan_feesand takes a liquidation reward. Ifbalance_before < balance_afterit returnOk(), if now throws an error and reverts the transaction.