@@ -17,12 +17,12 @@ import (
1717
1818 "github.com/code-payments/code-server/pkg/code/balance"
1919 "github.com/code-payments/code-server/pkg/code/common"
20+ currency_util "github.com/code-payments/code-server/pkg/code/currency"
2021 code_data "github.com/code-payments/code-server/pkg/code/data"
2122 "github.com/code-payments/code-server/pkg/code/data/account"
2223 "github.com/code-payments/code-server/pkg/code/data/action"
2324 "github.com/code-payments/code-server/pkg/code/data/fulfillment"
2425 "github.com/code-payments/code-server/pkg/code/data/intent"
25- "github.com/code-payments/code-server/pkg/currency"
2626 "github.com/code-payments/code-server/pkg/metrics"
2727 "github.com/code-payments/code-server/pkg/pointer"
2828 "github.com/code-payments/code-server/pkg/retry"
@@ -300,7 +300,12 @@ func updateAutoReturnFulfillmentPreSorting(
300300}
301301
302302func insertAutoReturnIntentRecord (ctx context.Context , data code_data.Provider , giftCardIssuedIntent * intent.Record , isVoidedByUser bool ) error {
303- usdExchangeRecord , err := data .GetExchangeRate (ctx , currency .USD , time .Now ())
303+ mintAccount , err := common .NewAccountFromPublicKeyString (giftCardIssuedIntent .MintAccount )
304+ if err != nil {
305+ return err
306+ }
307+
308+ usdMarketValue , err := currency_util .CalculateUsdMarketValue (ctx , data , mintAccount , giftCardIssuedIntent .SendPublicPaymentMetadata .Quantity , time .Now ())
304309 if err != nil {
305310 return err
306311 }
@@ -312,6 +317,8 @@ func insertAutoReturnIntentRecord(ctx context.Context, data code_data.Provider,
312317 IntentId : getAutoReturnIntentId (giftCardIssuedIntent .IntentId ),
313318 IntentType : intent .ReceivePaymentsPublicly ,
314319
320+ MintAccount : common .CoreMintAccount .PublicKey ().ToBase58 (),
321+
315322 InitiatorOwnerAccount : giftCardIssuedIntent .InitiatorOwnerAccount ,
316323
317324 ReceivePaymentsPubliclyMetadata : & intent.ReceivePaymentsPubliclyMetadata {
@@ -326,7 +333,7 @@ func insertAutoReturnIntentRecord(ctx context.Context, data code_data.Provider,
326333 OriginalExchangeRate : giftCardIssuedIntent .SendPublicPaymentMetadata .ExchangeRate ,
327334 OriginalNativeAmount : giftCardIssuedIntent .SendPublicPaymentMetadata .NativeAmount ,
328335
329- UsdMarketValue : usdExchangeRecord . Rate * float64 ( giftCardIssuedIntent . SendPublicPaymentMetadata . Quantity ) / float64 ( common . CoreMintQuarksPerUnit ) ,
336+ UsdMarketValue : usdMarketValue ,
330337 },
331338
332339 State : intent .StateConfirmed ,
0 commit comments