Skip to content

Commit

Permalink
add const for dusdc profile username
Browse files Browse the repository at this point in the history
  • Loading branch information
lazynina committed Nov 4, 2024
1 parent 30bc785 commit 406b372
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion routes/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ func (fes *APIServer) GetExchangeRateFromDeSoDex() (float64, error) {
if err != nil {
return 0, err
}
usdcProfileEntry := utxoView.GetProfileEntryForUsername([]byte("dusdc_"))
usdcProfileEntry := utxoView.GetProfileEntryForUsername([]byte(dusdcProfileUsername))
if usdcProfileEntry == nil {
return 0, fmt.Errorf("GetExchangeRateFromDeSoDex: Could not find profile entry for dusdc_")
}
Expand Down
8 changes: 6 additions & 2 deletions routes/dao_coin_exchange_with_fees.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import (
"strings"
)

const (
dusdcProfileUsername = "dusdc_"
)

type UpdateDaoCoinMarketFeesRequest struct {
// The profile that the fees are being modified for.
ProfilePublicKeyBase58Check string `safeForLogging:"true"`
Expand Down Expand Up @@ -914,7 +918,7 @@ func (fes *APIServer) GetQuoteCurrencyPriceInUsd(
"GetQuoteCurrencyPriceInUsd: Error fetching mempool view: %v", err)
}
if IsDesoPkid(quoteCurrencyPublicKey) {
usdcProfileEntry := utxoView.GetProfileEntryForUsername([]byte("dusdc_"))
usdcProfileEntry := utxoView.GetProfileEntryForUsername([]byte(dusdcProfileUsername))
if usdcProfileEntry == nil {
return "", "", "", fmt.Errorf("GetQuoteCurrencyPriceInUsd: Could not find profile entry for dusdc_")
}
Expand Down Expand Up @@ -951,7 +955,7 @@ func (fes *APIServer) GetQuoteCurrencyPriceInUsd(

// If the profile is the dusdc profile then just return 1.0
lowerUsername := strings.ToLower(string(existingProfileEntry.Username))
if lowerUsername == "dusdc_" {
if lowerUsername == dusdcProfileUsername {
return "1.0", "1.0", "1.0", nil
} else if lowerUsername == "focus" ||
lowerUsername == "openfund" {
Expand Down

0 comments on commit 406b372

Please sign in to comment.