Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ocp/currency/usd_market_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ import (
// CalculateUsdMarketValue calculates the current USD market value of a crypto
// amount in quarks.
func CalculateUsdMarketValue(ctx context.Context, data ocp_data.Provider, mint *common.Account, quarks uint64, at time.Time) (float64, float64, error) {
_, err := common.GetVmConfigForMint(ctx, data, mint)
isSupportedMint, err := common.IsSupportedMint(ctx, data, mint)
if err != nil {
return 0, 0, err
} else if !isSupportedMint {
return 0, 0, common.ErrUnsupportedMint
}

usdExchangeRecord, err := data.GetExchangeRate(ctx, currency_lib.USD, at)
Expand Down
10 changes: 5 additions & 5 deletions ocp/rpc/transaction/intent.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,12 @@ func (s *transactionServer) SubmitIntent(streamer transactionpb.Transaction_Subm
}
log = log.With(zap.String("mint", mintAccount.PublicKey().ToBase58()))

_, err = common.GetVmConfigForMint(ctx, s.data, mintAccount)
if err == common.ErrUnsupportedMint {
return handleSubmitIntentError(ctx, streamer, intentRecord, NewIntentValidationError("mint account must be the core mint or a launchpad currency"))
} else if err != nil {
log.With(zap.Error(err)).Warn("failure getting vm config for mint")
isSupportedMint, err := common.IsSupportedMint(ctx, s.data, mintAccount)
if err != nil {
log.With(zap.Error(err)).Warn("failure checking for mint support")
return handleSubmitIntentError(ctx, streamer, intentRecord, err)
} else if !isSupportedMint {
return handleSubmitIntentError(ctx, streamer, intentRecord, NewIntentValidationError("mint account must be the core mint or a launchpad currency"))
}

// Populate metadata into the new DB record
Expand Down