diff --git a/ocp/common/vm.go b/ocp/common/vm.go index 3bf7ae2..30825dd 100644 --- a/ocp/common/vm.go +++ b/ocp/common/vm.go @@ -33,27 +33,25 @@ func GetVmConfigForMint(ctx context.Context, data ocp_data.Provider, mint *Accou Omnibus: CoreMintVmOmnibusAccount, Mint: CoreMintAccount, }, nil - /* - case jeffyMintAccount.PublicKey().ToBase58(): - if jeffyAuthority.PrivateKey() == nil { - vaultRecord, err := data.GetKey(ctx, jeffyAuthority.PublicKey().ToBase58()) - if err != nil { - return nil, err - } - - jeffyAuthority, err = NewAccountFromPrivateKeyString(vaultRecord.PrivateKey) - if err != nil { - return nil, err - } - } - - return &VmConfig{ - Authority: jeffyAuthority, - Vm: jeffyVmAccount, - Omnibus: jeffyVmOmnibusAccount, - Mint: mint, - }, nil - */ + case jeffyMintAccount.PublicKey().ToBase58(): + if jeffyAuthority.PrivateKey() == nil { + vaultRecord, err := data.GetKey(ctx, jeffyAuthority.PublicKey().ToBase58()) + if err != nil { + return nil, err + } + + jeffyAuthority, err = NewAccountFromPrivateKeyString(vaultRecord.PrivateKey) + if err != nil { + return nil, err + } + } + + return &VmConfig{ + Authority: jeffyAuthority, + Vm: jeffyVmAccount, + Omnibus: jeffyVmOmnibusAccount, + Mint: mint, + }, nil default: return nil, ErrUnsupportedMint } diff --git a/ocp/config/config.go b/ocp/config/config.go index bc80eb6..4e84007 100644 --- a/ocp/config/config.go +++ b/ocp/config/config.go @@ -23,12 +23,11 @@ const ( CoreMintVmAccountPublicKey = "JACkaKsm2Rd6TNJwH4UB7G6tHrWUATJPTgNNnRVsg4ip" CoreMintVmOmnibusPublicKey = "D8oUTXRvarxhx9cjYdFJqWAVj2rmzry58bS6JSTiQsv5" - // todo: replace with new Jeffy // todo: DB store to track VM per mint - JeffyMintPublicKey = "52MNGpgvydSwCtC2H4qeiZXZ1TxEuRVCRGa8LAfk2kSj" + JeffyMintPublicKey = "54ggcQ23uen5b9QXMAns99MQNTKn7iyzq4wvCW6e8r25" JeffyAuthorityPublicKey = "jfy1btcfsjSn2WCqLVaxiEjp4zgmemGyRsdCPbPwnZV" - JeffyVmAccountPublicKey = "Bii3UFB9DzPq6UxgewF5iv9h1Gi8ZnP6mr7PtocHGNta" - JeffyVmOmnibusPublicKey = "CQ5jni8XTXEcMFXS1ytNyTVbJBZHtHCzEtjBPowB3MLD" + JeffyVmAccountPublicKey = "8rwgUXsLSq1Pn51UJs4NGVA1cTkemwBgKyWPfFYgnm3B" + JeffyVmOmnibusPublicKey = "9XiqBPYSG2cBwpb8MqJeuFmLaQaAAr6gwikyBrPZDQ8R" ) var ( diff --git a/ocp/worker/currency/reserve.go b/ocp/worker/currency/reserve.go index b948d04..2201389 100644 --- a/ocp/worker/currency/reserve.go +++ b/ocp/worker/currency/reserve.go @@ -8,6 +8,7 @@ import ( "github.com/code-payments/ocp-server/metrics" "github.com/code-payments/ocp-server/ocp/common" + "github.com/code-payments/ocp-server/ocp/config" ocp_data "github.com/code-payments/ocp-server/ocp/data" "github.com/code-payments/ocp-server/ocp/data/currency" "github.com/code-payments/ocp-server/ocp/worker" @@ -34,7 +35,7 @@ func (p *reserveRuntime) Start(runtimeCtx context.Context, interval time.Duratio for { _, err := retry.Retry( func() error { - p.log.Debug("updating exchange rates") + p.log.Debug("updating reserves") provider := runtimeCtx.Value(metrics.ProviderContextKey).(metrics.Provider) trace := provider.StartTrace("currency_reserve_runtime") @@ -72,8 +73,8 @@ func (p *reserveRuntime) Start(runtimeCtx context.Context, interval time.Duratio // todo: Don't hardcode Jeffy and other Flipcash currencies func (p *reserveRuntime) UpdateAllLaunchpadCurrencyReserves(ctx context.Context) error { err1 := func() error { - jeffyMintAccount, _ := common.NewAccountFromPublicKeyString("todo") - jeffyVaultAccount, _ := common.NewAccountFromPublicKeyString("todo") + jeffyMintAccount, _ := common.NewAccountFromPublicKeyString(config.JeffyMintPublicKey) + jeffyVaultAccount, _ := common.NewAccountFromPublicKeyString("BMYftxDcbLDTzRCkLmQ9amwNgqsZ74A1wsd1gURum3Ep") var tokenAccount token.Account ai, err := p.data.GetBlockchainAccountInfo(ctx, jeffyVaultAccount.PublicKey().ToBase58(), solana.CommitmentFinalized) diff --git a/ocp/worker/geyser/handler.go b/ocp/worker/geyser/handler.go index 125dcb0..7f29bde 100644 --- a/ocp/worker/geyser/handler.go +++ b/ocp/worker/geyser/handler.go @@ -8,6 +8,7 @@ import ( "github.com/pkg/errors" indexerpb "github.com/code-payments/code-vm-indexer/generated/indexer/v1" + "github.com/code-payments/ocp-server/ocp/config" geyserpb "github.com/code-payments/ocp-server/ocp/worker/geyser/api/gen" "github.com/code-payments/ocp-server/ocp/common" @@ -85,7 +86,8 @@ func (h *TokenProgramAccountHandler) Handle(ctx context.Context, update *geyserp switch mintAccount.PublicKey().ToBase58() { - case common.CoreMintAccount.PublicKey().ToBase58(): + // todo: Don't hardcode Jeffy and other Flipcash currencies + case common.CoreMintAccount.PublicKey().ToBase58(), config.JeffyMintPublicKey: // Not an ATA, so filter it out. It cannot be a VM deposit ATA if bytes.Equal(tokenAccount.PublicKey().ToBytes(), ownerAccount.PublicKey().ToBytes()) { return nil diff --git a/ocp/worker/nonce/runtime.go b/ocp/worker/nonce/runtime.go index 8bd7938..d3e0f0b 100644 --- a/ocp/worker/nonce/runtime.go +++ b/ocp/worker/nonce/runtime.go @@ -11,6 +11,7 @@ import ( indexerpb "github.com/code-payments/code-vm-indexer/generated/indexer/v1" "github.com/code-payments/ocp-server/ocp/common" + "github.com/code-payments/ocp-server/ocp/config" ocp_data "github.com/code-payments/ocp-server/ocp/data" "github.com/code-payments/ocp-server/ocp/data/nonce" "github.com/code-payments/ocp-server/ocp/worker" @@ -69,6 +70,7 @@ func (p *runtime) Start(ctx context.Context, interval time.Duration) error { // todo: Dynamically detect VMs for _, vm := range []string{ common.CoreMintVmAccount.PublicKey().ToBase58(), + config.JeffyVmAccountPublicKey, } { for _, state := range []nonce.State{ nonce.StateReleased,