-
Notifications
You must be signed in to change notification settings - Fork 198
Funding includes vamm #1971
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
base: amm-availability-update
Are you sure you want to change the base?
Funding includes vamm #1971
Conversation
| let depth = perp_market.get_market_depth_for_funding_rate()?; | ||
|
|
||
| let (bids, asks) = | ||
| let amm_worst_price_bid = perp_market |
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.
technically this is average price, does that mess with things?
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.
you can get the worst case price by looking at base/quote reserves to get price of amm at end of swap
| bids.retain(|level| level.price >= amm_worst_price_bid); | ||
| asks.retain(|level| level.price <= amm_worst_price_ask); | ||
|
|
||
| if !perp_market.is_operation_paused(PerpOperation::AmmFill) && !state.amm_paused()? { |
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.
one thing i'd be worried about is if there are any weird cu issues here, should we think about a feature flag for this?
| quote_reserve = new_quote_reserve; | ||
| remaining = remaining.saturating_sub(step_swap); | ||
|
|
||
| if out.len() as u8 >= levels { |
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.
is this redundant?
| sanitize_clamp: Option<i64>, | ||
| ) -> DriftResult { | ||
| let amm_reserve_price = amm.reserve_price()?; | ||
| let (amm_bid_price, amm_ask_price) = amm.bid_ask_price(amm_reserve_price)?; |
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.
nit: we might be able to save CUs only getting bid/ask iff on of the best bid/ask are none
No description provided.