-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Implement fallback oracles for perps #943
base: dev
Are you sure you want to change the base?
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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_ref = &AccountInfoRef::borrow(ctx.accounts.oracle.as_ref())?; | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so when this function is used, raydium/orca fallbacks are not available?
No description provided.