38
38
syncedDepositCache = cache .NewCache (1_000_000 )
39
39
)
40
40
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 {
42
42
err := maybeInitiateExternalDepositIntoVm (ctx , data , vmIndexerClient , userAuthority )
43
43
if err != nil {
44
44
return errors .Wrap (err , "error depositing into the vm" )
@@ -51,7 +51,7 @@ func fixMissingExternalDeposits(ctx context.Context, data code_data.Provider, vm
51
51
52
52
var anyError error
53
53
for _ , signature := range signatures {
54
- err := processPotentialExternalDepositIntoVm (ctx , data , signature , userAuthority )
54
+ err := processPotentialExternalDepositIntoVm (ctx , data , integration , signature , userAuthority )
55
55
if err != nil {
56
56
anyError = errors .Wrap (err , "error processing signature for external deposit into vm" )
57
57
}
@@ -202,7 +202,7 @@ func findPotentialExternalDepositsIntoVm(ctx context.Context, data code_data.Pro
202
202
}
203
203
}
204
204
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 {
206
206
vmDepositAta , err := userAuthority .ToVmDepositAssociatedTokenAccount (common .CodeVmAccount , common .CoreMintAccount )
207
207
if err != nil {
208
208
return errors .Wrap (err , "error getting vm deposit ata" )
@@ -276,6 +276,11 @@ func processPotentialExternalDepositIntoVm(ctx context.Context, data code_data.P
276
276
return nil
277
277
}
278
278
279
+ ownerAccount , err := common .NewAccountFromPublicKeyString (accountInfoRecord .OwnerAccount )
280
+ if err != nil {
281
+ return errors .Wrap (err , "invalid owner account" )
282
+ }
283
+
279
284
usdExchangeRecord , err := data .GetExchangeRate (ctx , currency_lib .USD , time .Now ())
280
285
if err != nil {
281
286
return errors .Wrap (err , "error getting usd rate" )
@@ -287,7 +292,7 @@ func processPotentialExternalDepositIntoVm(ctx context.Context, data code_data.P
287
292
IntentId : getExternalDepositIntentID (signature , userVirtualTimelockVaultAccount ),
288
293
IntentType : intent .ExternalDeposit ,
289
294
290
- InitiatorOwnerAccount : accountInfoRecord . OwnerAccount ,
295
+ InitiatorOwnerAccount : ownerAccount . PublicKey (). ToBase58 () ,
291
296
292
297
ExternalDepositMetadata : & intent.ExternalDepositMetadata {
293
298
DestinationTokenAccount : userVirtualTimelockVaultAccount .PublicKey ().ToBase58 (),
@@ -322,6 +327,9 @@ func processPotentialExternalDepositIntoVm(ctx context.Context, data code_data.P
322
327
323
328
syncedDepositCache .Insert (cacheKey , true , 1 )
324
329
330
+ // Best-effort processing for notification back to the user
331
+ integration .OnDepositReceived (ctx , ownerAccount , uint64 (deltaQuarksIntoOmnibus ))
332
+
325
333
return nil
326
334
default :
327
335
syncedDepositCache .Insert (cacheKey , true , 1 )
0 commit comments