From 1b5c00e98d280ca2cca04b5fffdac065670e6734 Mon Sep 17 00:00:00 2001 From: Chris Heaney Date: Fri, 22 Dec 2023 07:09:12 -0600 Subject: [PATCH] sdk: fix isFillableByVAMM --- sdk/src/math/orders.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sdk/src/math/orders.ts b/sdk/src/math/orders.ts index e19e55919..5179f0fd3 100644 --- a/sdk/src/math/orders.ts +++ b/sdk/src/math/orders.ts @@ -10,7 +10,11 @@ import { import { ZERO, TWO } from '../constants/numericConstants'; import { BN } from '@coral-xyz/anchor'; import { OraclePriceData } from '../oracles/types'; -import { getAuctionPrice, isAuctionComplete } from './auction'; +import { + getAuctionPrice, + isAuctionComplete, + isFallbackAvailableLiquiditySource, +} from './auction'; import { calculateMaxBaseAssetAmountFillable, calculateMaxBaseAssetAmountToTrade, @@ -186,10 +190,11 @@ export function isFillableByVAMM( market: PerpMarketAccount, oraclePriceData: OraclePriceData, slot: number, - ts: number + ts: number, + minAuctionDuration: number ): boolean { return ( - (isAuctionComplete(order, slot) && + (isFallbackAvailableLiquiditySource(order, minAuctionDuration, slot) && calculateBaseAssetAmountForAmmToFulfill( order, market,