Open
Conversation
crispheaney
reviewed
Oct 20, 2025
crispheaney
reviewed
Oct 27, 2025
| let depth = perp_market.get_market_depth_for_funding_rate()?; | ||
|
|
||
| let (bids, asks) = | ||
| let amm_worst_price_bid = perp_market |
Member
There was a problem hiding this comment.
technically this is average price, does that mess with things?
Member
There was a problem hiding this comment.
you can get the worst case price by looking at base/quote reserves to get price of amm at end of swap
crispheaney
reviewed
Oct 27, 2025
| 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()? { |
Member
There was a problem hiding this comment.
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?
crispheaney
reviewed
Oct 27, 2025
| quote_reserve = new_quote_reserve; | ||
| remaining = remaining.saturating_sub(step_swap); | ||
|
|
||
| if out.len() as u8 >= levels { |
crispheaney
reviewed
Oct 27, 2025
| @@ -114,12 +114,12 @@ pub fn update_mark_twap_crank( | |||
| let (amm_bid_price, amm_ask_price) = amm.bid_ask_price(amm_reserve_price)?; | |||
Member
There was a problem hiding this comment.
nit: we might be able to save CUs only getting bid/ask iff on of the best bid/ask are none
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.