WIP: Implement fallback oracles for perps#943
Conversation
liquidator: split TCS triggering and liquidation job Concurrent execution of candidate lookup and tx building/sending - Also added an health assertion IX to protect liqor in multi liquidation scenario - And a timeout for jupiter v6 queries (avoid blocking liquidation because of slow TCS)
…ing at every try if one token is having an issue (#921)
* liquidator: forcefully exit process if snapshot job die * client: return snapshot_job join handle so it can be watched for early unexpected exit
liquidator: add a sequence check in rebalancing
liquidator: add sanctum swap
This is necessary for new liquidator feature of rebalancing using limit orders: We need to close the token and market slot so that it's available for new liquidation, but at the same time, it's possible that the min order quantity for a given market is still bigger than allowed max withdrawal.
liquidator: rebalance with limit order
Co-authored-by: CanardMandarin <thibault.marboud@gmail.com>
ckamm
left a comment
There was a problem hiding this comment.
While this approach could work with some fixes (to enable raydium/orca fallbacks), my opinion is that we should stop reading the explicitly-passed oracles where possible.
Instead, we should read the oracle price from the AccountRetriever, to have a unified way of accessing oracle prices for a token/perp.
Unfortunately that will often require significant instruction adjustments (because creating the AccountRetriever is reasonably expensive and also holds a bunch of borrows)
| let oracle_state = perp_market.oracle_state( | ||
| &OracleAccountInfos::from_reader(oracle_ref), | ||
| &OracleAccountInfos::from_reader_with_fallback(oracle_ref, fallback_opt.as_ref()), | ||
| None, // staleness checked in health |
There was a problem hiding this comment.
note that continuing to pass None here will not do the staleness check and thus potentially not use the fallback when it should
| oracle: acc_reader, | ||
| fallback_opt, | ||
| usdc_opt: None, | ||
| sol_opt: None, |
There was a problem hiding this comment.
so when this function is used, raydium/orca fallbacks are not available?
No description provided.