@@ -39,15 +39,15 @@ var (
3939 syncedDepositCache = cache .NewCache (1_000_000 )
4040)
4141
42- func fixMissingExternalDeposits (ctx context.Context , data code_data.Provider , pusher push_lib.Provider , vault * common.Account ) error {
42+ func fixMissingExternalDeposits (ctx context.Context , conf * conf , data code_data.Provider , pusher push_lib.Provider , vault * common.Account ) error {
4343 signatures , err := findPotentialExternalDeposits (ctx , data , vault )
4444 if err != nil {
4545 return errors .Wrap (err , "error finding potential external deposits" )
4646 }
4747
4848 var anyError error
4949 for _ , signature := range signatures {
50- err := processPotentialExternalDeposit (ctx , data , pusher , signature , vault )
50+ err := processPotentialExternalDeposit (ctx , conf , data , pusher , signature , vault )
5151 if err != nil {
5252 anyError = errors .Wrap (err , "error processing signature for external deposit" )
5353 }
@@ -115,7 +115,7 @@ func findPotentialExternalDeposits(ctx context.Context, data code_data.Provider,
115115 }
116116}
117117
118- func processPotentialExternalDeposit (ctx context.Context , data code_data.Provider , pusher push_lib.Provider , signature string , tokenAccount * common.Account ) error {
118+ func processPotentialExternalDeposit (ctx context.Context , conf * conf , data code_data.Provider , pusher push_lib.Provider , signature string , tokenAccount * common.Account ) error {
119119 // Avoid reprocessing deposits we've recently seen and processed. Particularly,
120120 // the backup process will likely be triggered in frequent bursts, so this is
121121 // just an optimization around that.
@@ -199,7 +199,7 @@ func processPotentialExternalDeposit(ctx context.Context, data code_data.Provide
199199 return nil
200200 }
201201
202- isCodeSwap , usdcQuarksSwapped , err := getCodeSwapMetadata (tokenBalances )
202+ isCodeSwap , usdcQuarksSwapped , err := getCodeSwapMetadata (ctx , conf , tokenBalances )
203203 if err != nil {
204204 return errors .Wrap (err , "error getting code swap metadata" )
205205 }
@@ -381,13 +381,12 @@ func getDeltaQuarksFromTokenBalances(tokenAccount *common.Account, tokenBalances
381381 return postQuarkBalance - preQuarkBalance , nil
382382}
383383
384- func getCodeSwapMetadata (tokenBalances * solana.TransactionTokenBalances ) (bool , uint64 , error ) {
384+ func getCodeSwapMetadata (ctx context. Context , conf * conf , tokenBalances * solana.TransactionTokenBalances ) (bool , uint64 , error ) {
385385 // Detect whether this is a Code swap by inspecting whether the swap subsidizer
386386 // is included in the transaction.
387387 var isCodeSwap bool
388388 for _ , account := range tokenBalances .Accounts {
389- // todo: configurable
390- if account == "swapBMF2EzkHSn9NDwaSFWMtGC7ZsgzApQv9NSkeUeU" {
389+ if account == conf .swapSubsidizerPublicKey .Get (ctx ) {
391390 isCodeSwap = true
392391 break
393392 }
0 commit comments