3838 syncedDepositCache = cache .NewCache (1_000_000 )
3939)
4040
41- func fixMissingExternalDeposits (ctx context.Context , data code_data.Provider , vmIndexerClient indexerpb.IndexerClient , userAuthority * common.Account ) error {
41+ func fixMissingExternalDeposits (ctx context.Context , data code_data.Provider , vmIndexerClient indexerpb.IndexerClient , integration Integration , userAuthority * common.Account ) error {
4242 err := maybeInitiateExternalDepositIntoVm (ctx , data , vmIndexerClient , userAuthority )
4343 if err != nil {
4444 return errors .Wrap (err , "error depositing into the vm" )
@@ -51,7 +51,7 @@ func fixMissingExternalDeposits(ctx context.Context, data code_data.Provider, vm
5151
5252 var anyError error
5353 for _ , signature := range signatures {
54- err := processPotentialExternalDepositIntoVm (ctx , data , signature , userAuthority )
54+ err := processPotentialExternalDepositIntoVm (ctx , data , integration , signature , userAuthority )
5555 if err != nil {
5656 anyError = errors .Wrap (err , "error processing signature for external deposit into vm" )
5757 }
@@ -202,7 +202,7 @@ func findPotentialExternalDepositsIntoVm(ctx context.Context, data code_data.Pro
202202 }
203203}
204204
205- func processPotentialExternalDepositIntoVm (ctx context.Context , data code_data.Provider , signature string , userAuthority * common.Account ) error {
205+ func processPotentialExternalDepositIntoVm (ctx context.Context , data code_data.Provider , integration Integration , signature string , userAuthority * common.Account ) error {
206206 vmDepositAta , err := userAuthority .ToVmDepositAssociatedTokenAccount (common .CodeVmAccount , common .CoreMintAccount )
207207 if err != nil {
208208 return errors .Wrap (err , "error getting vm deposit ata" )
@@ -276,6 +276,11 @@ func processPotentialExternalDepositIntoVm(ctx context.Context, data code_data.P
276276 return nil
277277 }
278278
279+ ownerAccount , err := common .NewAccountFromPublicKeyString (accountInfoRecord .OwnerAccount )
280+ if err != nil {
281+ return errors .Wrap (err , "invalid owner account" )
282+ }
283+
279284 usdExchangeRecord , err := data .GetExchangeRate (ctx , currency_lib .USD , time .Now ())
280285 if err != nil {
281286 return errors .Wrap (err , "error getting usd rate" )
@@ -287,7 +292,7 @@ func processPotentialExternalDepositIntoVm(ctx context.Context, data code_data.P
287292 IntentId : getExternalDepositIntentID (signature , userVirtualTimelockVaultAccount ),
288293 IntentType : intent .ExternalDeposit ,
289294
290- InitiatorOwnerAccount : accountInfoRecord . OwnerAccount ,
295+ InitiatorOwnerAccount : ownerAccount . PublicKey (). ToBase58 () ,
291296
292297 ExternalDepositMetadata : & intent.ExternalDepositMetadata {
293298 DestinationTokenAccount : userVirtualTimelockVaultAccount .PublicKey ().ToBase58 (),
@@ -322,6 +327,9 @@ func processPotentialExternalDepositIntoVm(ctx context.Context, data code_data.P
322327
323328 syncedDepositCache .Insert (cacheKey , true , 1 )
324329
330+ // Best-effort processing for notification back to the user
331+ integration .OnDepositReceived (ctx , ownerAccount , uint64 (deltaQuarksIntoOmnibus ))
332+
325333 return nil
326334 default :
327335 syncedDepositCache .Insert (cacheKey , true , 1 )
0 commit comments