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
3 changes: 2 additions & 1 deletion ocp/common/mint.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/code-payments/ocp-server/ocp/config"
ocp_data "github.com/code-payments/ocp-server/ocp/data"
"github.com/code-payments/ocp-server/solana/currencycreator"
"github.com/code-payments/ocp-server/usdc"
"github.com/code-payments/ocp-server/usdf"
)

Expand Down Expand Up @@ -46,7 +47,7 @@ func IsCoreMint(mint *Account) bool {

func IsCoreMintUsdStableCoin() bool {
switch CoreMintAccount.PublicKey().ToBase58() {
case usdf.Mint:
case usdf.Mint, usdc.Mint:
return true
default:
return false
Expand Down
11 changes: 6 additions & 5 deletions ocp/data/external.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import (
"errors"
"time"

"github.com/code-payments/ocp-server/ocp/config"
"github.com/code-payments/ocp-server/ocp/data/currency"
currency_lib "github.com/code-payments/ocp-server/currency"
"github.com/code-payments/ocp-server/currency/coingecko"
"github.com/code-payments/ocp-server/currency/fixer"
"github.com/code-payments/ocp-server/metrics"
"github.com/code-payments/ocp-server/ocp/config"
"github.com/code-payments/ocp-server/ocp/data/currency"
"github.com/code-payments/ocp-server/usdc"
"github.com/code-payments/ocp-server/usdf"
)

Expand Down Expand Up @@ -50,7 +51,7 @@ func (dp *WebProvider) GetCurrentExchangeRatesFromExternalProviders(ctx context.
var err error

switch config.CoreMintPublicKeyString {
case usdf.Mint:
case usdc.Mint, usdf.Mint:
coinGeckoRates[string(currency_lib.USD)] = 1.0
default:
coinGeckoData, err := dp.coinGecko.GetCurrentRates(ctx, string(config.CoreMintSymbol))
Expand Down Expand Up @@ -83,7 +84,7 @@ func (dp *WebProvider) GetPastExchangeRatesFromExternalProviders(ctx context.Con
ts := t
var err error
switch config.CoreMintPublicKeyString {
case usdf.Mint:
case usdc.Mint, usdf.Mint:
coinGeckoRates[string(currency_lib.USD)] = 1.0
default:
coinGeckoData, err := dp.coinGecko.GetCurrentRates(ctx, string(config.CoreMintSymbol))
Expand Down Expand Up @@ -116,7 +117,7 @@ func computeAllExchangeRates(coreMintRates map[string]float64, usdRates map[stri
return nil, errors.New("usd rate missing")
}
switch config.CoreMintPublicKeyString {
case usdf.Mint:
case usdc.Mint, usdf.Mint:
coreMintToUsd = 1.0
}

Expand Down
2 changes: 2 additions & 0 deletions ocp/transaction/alt.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
ocp_data "github.com/code-payments/ocp-server/ocp/data"
"github.com/code-payments/ocp-server/solana"
"github.com/code-payments/ocp-server/solana/system"
"github.com/code-payments/ocp-server/usdc"
)

// GetAltForMint gets an address lookup table to operate in a versioned
Expand Down Expand Up @@ -47,6 +48,7 @@ func GetAltForMint(ctx context.Context, data ocp_data.Provider, mint *common.Acc
common.CoreMintAccount.PublicKey().ToBytes(),
system.RentSysVar,
system.RecentBlockhashesSysVar,
usdc.TokenMint,
},
}, nil
}
Expand Down
15 changes: 15 additions & 0 deletions usdc/usdc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package usdc

import (
"crypto/ed25519"
)

const (
Mint = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
QuarksPerUsdf = 1000000
Decimals = 6
)

var (
TokenMint = ed25519.PublicKey{198, 250, 122, 243, 190, 219, 173, 58, 61, 101, 243, 106, 171, 201, 116, 49, 177, 187, 228, 194, 210, 246, 224, 228, 124, 166, 2, 3, 69, 47, 93, 97}
)
4 changes: 2 additions & 2 deletions usdf/usdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
// todo: Update config once USDF is created

const (
Mint = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
Mint = "USDFmFa553nkGNSvFn2gXCnpPuWLkgre2aHmPMDyaWi"
QuarksPerUsdf = 1000000
Decimals = 6
)

var (
TokenMint = ed25519.PublicKey{198, 250, 122, 243, 190, 219, 173, 58, 61, 101, 243, 106, 171, 201, 116, 49, 177, 187, 228, 194, 210, 246, 224, 228, 124, 166, 2, 3, 69, 47, 93, 97}
TokenMint = ed25519.PublicKey{7, 7, 48, 54, 200, 135, 41, 84, 87, 240, 35, 129, 5, 62, 49, 49, 241, 253, 42, 157, 138, 222, 175, 252, 65, 146, 180, 12, 103, 218, 59, 22}
)