diff --git a/go.mod b/go.mod index 58e6b13..745032f 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( filippo.io/edwards25519 v1.1.0 github.com/aws/aws-sdk-go-v2 v0.17.0 github.com/code-payments/code-vm-indexer v1.2.0 - github.com/code-payments/ocp-protobuf-api v0.4.0 + github.com/code-payments/ocp-protobuf-api v0.5.0 github.com/emirpasic/gods v1.12.0 github.com/envoyproxy/protoc-gen-validate v1.2.1 github.com/golang/protobuf v1.5.4 diff --git a/go.sum b/go.sum index a444984..8917c50 100644 --- a/go.sum +++ b/go.sum @@ -78,8 +78,8 @@ github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/code-payments/code-vm-indexer v1.2.0 h1:rSHpBMiT9BKgmKcXg/VIoi/h0t7jNxGx07Qz59m+6Q0= github.com/code-payments/code-vm-indexer v1.2.0/go.mod h1:vn91YN2qNqb+gGJeZe2+l+TNxVmEEiRHXXnIn2Y40h8= -github.com/code-payments/ocp-protobuf-api v0.4.0 h1:fexDlRbI/VNOc+VU7pF5fEc8wv7LJ6c+Een9OV+dHkE= -github.com/code-payments/ocp-protobuf-api v0.4.0/go.mod h1:tw6BooY5a8l6CtSZnKOruyKII0W04n89pcM4BizrgG8= +github.com/code-payments/ocp-protobuf-api v0.5.0 h1:ns3pztvgukRubQlJcuRxAiQmpmCqZimtkCA1pTFJpF8= +github.com/code-payments/ocp-protobuf-api v0.5.0/go.mod h1:tw6BooY5a8l6CtSZnKOruyKII0W04n89pcM4BizrgG8= github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6 h1:NmTXa/uVnDyp0TY5MKi197+3HWcnYWfnHGyaFthlnGw= github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= diff --git a/ocp/currency/validation.go b/ocp/currency/validation.go index a9f2701..1e0b1ba 100644 --- a/ocp/currency/validation.go +++ b/ocp/currency/validation.go @@ -209,7 +209,6 @@ func validateCurrencyLaunchpadClientExchangeData(ctx context.Context, log *zap.L log := log.With( zap.String("core_mint_sell_value", coreMintSellValueInUnits.Text('f', 10)), zap.String("potential_native_amount", potentialNativeAmount.Text('f', 10)), - zap.Uint64("found_core_mint_locked", reserveRecord.CoreMintLocked), zap.String("found_usd_rate", usdRate.Text('f', 10)), zap.String("found_other_rate", otherRate.Text('f', 10)), ) diff --git a/ocp/data/currency/model.go b/ocp/data/currency/model.go index 436a7ae..7b393ff 100644 --- a/ocp/data/currency/model.go +++ b/ocp/data/currency/model.go @@ -225,7 +225,6 @@ type ReserveRecord struct { Id uint64 Mint string SupplyFromBonding uint64 - CoreMintLocked uint64 Time time.Time } @@ -246,7 +245,6 @@ func (m *ReserveRecord) Clone() *ReserveRecord { Id: m.Id, Mint: m.Mint, SupplyFromBonding: m.SupplyFromBonding, - CoreMintLocked: m.CoreMintLocked, Time: m.Time, } } @@ -255,6 +253,5 @@ func (m *ReserveRecord) CopyTo(dst *ReserveRecord) { dst.Id = m.Id dst.Mint = m.Mint dst.SupplyFromBonding = m.SupplyFromBonding - dst.CoreMintLocked = m.CoreMintLocked dst.Time = m.Time } diff --git a/ocp/data/currency/postgres/model.go b/ocp/data/currency/postgres/model.go index f85021d..25f1b67 100644 --- a/ocp/data/currency/postgres/model.go +++ b/ocp/data/currency/postgres/model.go @@ -170,7 +170,6 @@ type reserveModel struct { ForTimestamp time.Time `db:"for_timestamp"` Mint string `db:"mint"` SupplyFromBonding uint64 `db:"supply_from_bonding"` - CoreMintLocked uint64 `db:"core_mint_locked"` } func toReserveModel(obj *currency.ReserveRecord) (*reserveModel, error) { @@ -184,7 +183,6 @@ func toReserveModel(obj *currency.ReserveRecord) (*reserveModel, error) { ForTimestamp: obj.Time.UTC(), Mint: obj.Mint, SupplyFromBonding: obj.SupplyFromBonding, - CoreMintLocked: obj.CoreMintLocked, }, nil } @@ -194,7 +192,6 @@ func fromReserveModel(obj *reserveModel) *currency.ReserveRecord { Time: obj.ForTimestamp.UTC(), Mint: obj.Mint, SupplyFromBonding: obj.SupplyFromBonding, - CoreMintLocked: obj.CoreMintLocked, } } @@ -280,14 +277,13 @@ func (m *reserveModel) dbSave(ctx context.Context, db *sqlx.DB) error { return pgutil.ExecuteInTx(ctx, db, sql.LevelDefault, func(tx *sqlx.Tx) error { err := tx.QueryRowxContext(ctx, `INSERT INTO `+reserveTableName+` - (for_date, for_timestamp, mint, supply_from_bonding, core_mint_locked) - VALUES ($1, $2, $3, $4, $5) - RETURNING id, for_date, for_timestamp, mint, supply_from_bonding, core_mint_locked`, + (for_date, for_timestamp, mint, supply_from_bonding) + VALUES ($1, $2, $3, $4) + RETURNING id, for_date, for_timestamp, mint, supply_from_bonding`, m.ForDate, m.ForTimestamp, m.Mint, m.SupplyFromBonding, - m.CoreMintLocked, ).StructScan(m) return pgutil.CheckUniqueViolation(err, currency.ErrExists) diff --git a/ocp/data/currency/postgres/store_test.go b/ocp/data/currency/postgres/store_test.go index b61a4c0..0208f30 100644 --- a/ocp/data/currency/postgres/store_test.go +++ b/ocp/data/currency/postgres/store_test.go @@ -72,7 +72,6 @@ const ( for_timestamp TIMESTAMP WITH TIME ZONE NOT NULL, mint TEXT NOT NULL, supply_from_bonding BIGINT NOT NULL, - core_mint_locked BIGINT NOT NULL, CONSTRAINT ocp__core_currencyreserve__uniq__timestamp__and__mint UNIQUE (for_timestamp, mint) ); diff --git a/ocp/data/currency/tests/tests.go b/ocp/data/currency/tests/tests.go index 32a1051..28d27bb 100644 --- a/ocp/data/currency/tests/tests.go +++ b/ocp/data/currency/tests/tests.go @@ -173,7 +173,6 @@ func testReserveRoundTrip(t *testing.T, s currency.Store) { expected := ¤cy.ReserveRecord{ Mint: "mint", SupplyFromBonding: 1, - CoreMintLocked: 2, Time: now, } require.NoError(t, s.PutReserveRecord(context.Background(), expected)) @@ -184,14 +183,12 @@ func testReserveRoundTrip(t *testing.T, s currency.Store) { require.NoError(t, err) assert.Equal(t, now.Unix(), actual.Time.Unix()) assert.Equal(t, actual.SupplyFromBonding, expected.SupplyFromBonding) - assert.Equal(t, actual.CoreMintLocked, expected.CoreMintLocked) actual, err = s.GetReserveAtTime(context.Background(), "mint", time.Date(2021, 01, 29, 14, 0, 5, 0, time.UTC)) require.NoError(t, err) assert.Equal(t, now.Unix(), actual.Time.Unix()) assert.Equal(t, actual.SupplyFromBonding, expected.SupplyFromBonding) - assert.Equal(t, actual.CoreMintLocked, expected.CoreMintLocked) tomorrow := time.Date(2021, 01, 30, 0, 0, 0, 0, time.UTC) actual, err = s.GetReserveAtTime(context.Background(), "mint", tomorrow) diff --git a/ocp/rpc/currency/server.go b/ocp/rpc/currency/server.go index 6d5c21c..7c147ca 100644 --- a/ocp/rpc/currency/server.go +++ b/ocp/rpc/currency/server.go @@ -178,7 +178,6 @@ func (s *currencyServer) GetMints(ctx context.Context, req *currencypb.GetMintsR MintVault: mintVaultAccount.ToProto(), CoreMintVault: coreMintVaultAccount.ToProto(), SupplyFromBonding: reserveRecord.SupplyFromBonding, - CoreMintLocked: reserveRecord.CoreMintLocked, SellFeeBps: uint32(metadataRecord.SellFeeBps), }, CreatedAt: timestamppb.New(metadataRecord.CreatedAt), diff --git a/ocp/worker/currency/reserve.go b/ocp/worker/currency/reserve.go index c61a2a6..b948d04 100644 --- a/ocp/worker/currency/reserve.go +++ b/ocp/worker/currency/reserve.go @@ -74,7 +74,6 @@ func (p *reserveRuntime) UpdateAllLaunchpadCurrencyReserves(ctx context.Context) err1 := func() error { jeffyMintAccount, _ := common.NewAccountFromPublicKeyString("todo") jeffyVaultAccount, _ := common.NewAccountFromPublicKeyString("todo") - coreMintVaultAccount, _ := common.NewAccountFromPublicKeyString("todo") var tokenAccount token.Account ai, err := p.data.GetBlockchainAccountInfo(ctx, jeffyVaultAccount.PublicKey().ToBase58(), solana.CommitmentFinalized) @@ -84,17 +83,9 @@ func (p *reserveRuntime) UpdateAllLaunchpadCurrencyReserves(ctx context.Context) tokenAccount.Unmarshal(ai.Data) jeffyVaultBalance := tokenAccount.Amount - ai, err = p.data.GetBlockchainAccountInfo(ctx, coreMintVaultAccount.PublicKey().ToBase58(), solana.CommitmentFinalized) - if err != nil { - return err - } - tokenAccount.Unmarshal(ai.Data) - coreMintVaultBalance := tokenAccount.Amount - return p.data.PutCurrencyReserve(ctx, ¤cy.ReserveRecord{ Mint: jeffyMintAccount.PublicKey().ToBase58(), SupplyFromBonding: currencycreator.DefaultMintMaxQuarkSupply - jeffyVaultBalance, - CoreMintLocked: coreMintVaultBalance, Time: time.Now(), }) }()