-
Notifications
You must be signed in to change notification settings - Fork 125
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
Crispheaney/guard bad limit order fills #304
Conversation
// if the auction isn't complete, cant fill against vamm yet | ||
// use the vamm price to guard against bad fill for taker | ||
if taker.orders[taker_order_index].is_limit_order() | ||
&& !taker.orders[taker_order_index].is_auction_complete(slot)? |
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.
should check vs min_perp_auction_duration
instead of auction completeness
sdk/src/dlob/DLOB.ts
Outdated
@@ -1047,6 +1052,33 @@ export class DLOB { | |||
bidNode | |||
); | |||
|
|||
// extra guard against bad fills for perp limit orders where auction is incomplete | |||
if ( | |||
isVariant(takerNode.order.marketType, 'perp') && |
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.
do we really want to enforce market type here? this seems like a nice check for spot as well?
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.
it's a bit tricky to do it on the smart contract, but we always try to fill against serum first, so i think it's ok to remove the perp check here
No description provided.