@@ -98,6 +98,7 @@ import { selectMakers } from '../makerSelection';
9898import { LRUCache } from 'lru-cache' ;
9999import { bs58 } from '@project-serum/anchor/dist/cjs/utils/bytes' ;
100100import { PythPriceFeedSubscriber } from '../pythPriceFeedSubscriber' ;
101+ import { FallbackLiquiditySource } from '../experimental-bots/filler-common/types' ;
101102
102103const THROTTLED_NODE_SIZE_TO_PRUNE = 10 ; // Size of throttled nodes to get to before pruning the map
103104const FILL_ORDER_THROTTLE_BACKOFF = 1000 ; // the time to wait before trying to fill a throttled (error filling) node again
@@ -162,8 +163,6 @@ function getMakerNodeFromNodeToFill(
162163 return nodeToFill . makerNodes [ 0 ] ;
163164}
164165
165- export type FallbackLiquiditySource = 'phoenix' | 'openbook' ;
166-
167166export type NodesToFillWithContext = {
168167 nodesToFill : NodeToFill [ ] ;
169168 fallbackAskSource ?: FallbackLiquiditySource ;
@@ -1760,6 +1759,7 @@ export class SpotFillerBot implements Bot {
17601759 'multiMakerSpotFill' ,
17611760 this . revertOnFailure ?? false ,
17621761 false ,
1762+ undefined ,
17631763 spotPrecision
17641764 ) ;
17651765
@@ -1965,7 +1965,7 @@ export class SpotFillerBot implements Bot {
19651965 ) ! ;
19661966 const spotMarketPrecision = TEN . pow ( new BN ( spotMarket . decimals ) ) ;
19671967
1968- if ( nodeToFill . makerNodes . length > 1 ) {
1968+ if ( nodeToFill . makerNodes . length > 0 ) {
19691969 // do multi maker fills in a separate tx since they're larger
19701970 return this . tryFillMultiMakerSpotNode (
19711971 fillTxId ,
@@ -1979,55 +1979,48 @@ export class SpotFillerBot implements Bot {
19791979 ? fallbackBidSource
19801980 : fallbackAskSource ;
19811981
1982- const {
1983- makerInfos,
1984- takerUser,
1985- takerUserPubKey,
1986- takerUserSlot,
1987- marketType,
1988- } = await this . getNodeFillInfo ( nodeToFill ) ;
1982+ const { takerUser, takerUserPubKey, takerUserSlot, marketType } =
1983+ await this . getNodeFillInfo ( nodeToFill ) ;
19891984
19901985 if ( ! isVariant ( marketType , 'spot' ) ) {
19911986 throw new Error ( 'expected spot market type' ) ;
19921987 }
19931988
1994- const makerInfo = makerInfos . length > 0 ? makerInfos [ 0 ] . data : undefined ;
19951989 let fulfillmentConfig :
19961990 | PhoenixV1FulfillmentConfigAccount
19971991 | OpenbookV2FulfillmentConfigAccount
19981992 | undefined = undefined ;
1999- if ( makerInfo === undefined ) {
2000- if ( fallbackSource === 'phoenix' ) {
2001- const cfg = this . phoenixFulfillmentConfigMap . get (
2002- nodeToFill . node . order ! . marketIndex
2003- ) ;
2004- if ( cfg && isVariant ( cfg . status , 'enabled' ) ) {
2005- fulfillmentConfig = cfg ;
2006- }
2007- } else if ( fallbackSource === 'openbook' ) {
2008- const cfg = this . openbookFulfillmentConfigMap . get (
2009- nodeToFill . node . order ! . marketIndex
2010- ) ;
2011- if ( cfg && isVariant ( cfg . status , 'enabled' ) ) {
2012- fulfillmentConfig = cfg ;
2013- }
2014- } else {
2015- logger . error (
2016- `makerInfo doesnt exist and unknown fallback source: ${ fallbackSource } (fillTxId: ${ fillTxId } )`
2017- ) ;
1993+ if ( fallbackSource === 'phoenix' ) {
1994+ const cfg = this . phoenixFulfillmentConfigMap . get (
1995+ nodeToFill . node . order ! . marketIndex
1996+ ) ;
1997+ if ( cfg && isVariant ( cfg . status , 'enabled' ) ) {
1998+ fulfillmentConfig = cfg ;
1999+ }
2000+ } else if ( fallbackSource === 'openbook' ) {
2001+ const cfg = this . openbookFulfillmentConfigMap . get (
2002+ nodeToFill . node . order ! . marketIndex
2003+ ) ;
2004+ if ( cfg && isVariant ( cfg . status , 'enabled' ) ) {
2005+ fulfillmentConfig = cfg ;
20182006 }
2007+ } else {
2008+ logger . error (
2009+ `unknown fallback source: ${ fallbackSource } (fillTxId: ${ fillTxId } )`
2010+ ) ;
20192011 }
20202012
20212013 logMessageForNodeToFill (
20222014 nodeToFill ,
20232015 takerUserPubKey ,
20242016 takerUserSlot ,
2025- makerInfos ,
2017+ [ ] ,
20262018 this . getMaxSlot ( ) ,
20272019 fillTxId ,
20282020 'fillSpotNode' ,
20292021 this . revertOnFailure ?? false ,
20302022 false ,
2023+ fallbackSource ,
20312024 spotMarketPrecision
20322025 ) ;
20332026
@@ -2055,8 +2048,7 @@ export class SpotFillerBot implements Bot {
20552048 new PublicKey ( takerUserPubKey ) ,
20562049 takerUser ,
20572050 nodeToFill . node . order ,
2058- fulfillmentConfig ,
2059- makerInfo
2051+ fulfillmentConfig
20602052 )
20612053 ) ;
20622054
0 commit comments