diff --git a/CHANGELOG.md b/CHANGELOG.md index bf07037ef..1084fb9de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -107,6 +107,12 @@ tests for race conditions within funtoken precompile - [#2111](https://github.com/NibiruChain/nibiru/pull/2111) - fix: e2e-evm-cron.yml - [#2114](https://github.com/NibiruChain/nibiru/pull/2114) - fix(evm): make gas cost zero in conditional bank keeper flow - [#2116](https://github.com/NibiruChain/nibiru/pull/2116) - fix(precompile-funtoken.go): Fixes a bug where the err != nil check is missing in the bankBalance precompile method +- [#2117](https://github.com/NibiruChain/nibiru/pull/2117) - fix(oracle): The +timestamps resulting from ctx.WithBlock* don't actually correspond to the block +header information from specified blocks in the chain's history, so the oracle +exchange rates need a way to correctly retrieve this information. This change +fixes that discrepency, giving the expected block timesamp for the EVM's oracle +precompiled contract. The change also simplifies and corrects the code in x/oracle. #### Nibiru EVM | Before Audit 1 - 2024-10-18 diff --git a/app/wasmext/stargate_query.go b/app/wasmext/stargate_query.go index bd1567175..2d90b6d58 100644 --- a/app/wasmext/stargate_query.go +++ b/app/wasmext/stargate_query.go @@ -120,7 +120,6 @@ func WasmAcceptedStargateQueries() wasmkeeper.AcceptedStargateQueries { // nibiru oracle "/nibiru.oracle.v1.Query/ExchangeRate": new(oracle.QueryExchangeRateResponse), - "/nibiru.oracle.v1.Query/DatedExchangeRate": new(oracle.QueryDatedExchangeRateResponse), "/nibiru.oracle.v1.Query/ExchangeRateTwap": new(oracle.QueryExchangeRateResponse), "/nibiru.oracle.v1.Query/ExchangeRates": new(oracle.QueryExchangeRatesResponse), "/nibiru.oracle.v1.Query/Actives": new(oracle.QueryActivesResponse), diff --git a/eth/rpc/backend/blocks_test.go b/eth/rpc/backend/blocks_test.go index 4bb5d6511..918bb8794 100644 --- a/eth/rpc/backend/blocks_test.go +++ b/eth/rpc/backend/blocks_test.go @@ -16,7 +16,9 @@ func (s *BackendSuite) TestBlockNumber() { latestHeight, _ := s.network.LatestHeight() resp, err := s.backend.BlockNumber() s.Require().NoError(err, resp) - s.Require().Equal(uint64(latestHeight), uint64(blockHeight)) + // Rather than checking exact equality, which might not be true due to + // latency. Add a cushion of 2 blocks. + s.Require().LessOrEqual(uint64(latestHeight)-uint64(blockHeight), uint64(2)) } func (s *BackendSuite) TestGetBlockByNumberr() { diff --git a/proto/nibiru/oracle/v1/oracle.proto b/proto/nibiru/oracle/v1/oracle.proto index 6978d3bc7..76378ff90 100644 --- a/proto/nibiru/oracle/v1/oracle.proto +++ b/proto/nibiru/oracle/v1/oracle.proto @@ -130,7 +130,7 @@ message ExchangeRateTuple { ]; } -message DatedPrice { +message ExchangeRateAtBlock { string exchange_rate = 1 [ (gogoproto.moretags) = "yaml:\"exchange_rate\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", @@ -138,6 +138,11 @@ message DatedPrice { ]; uint64 created_block = 2 [ (gogoproto.moretags) = "yaml:\"created_block\"" ]; + + // Block timestamp for the block where the oracle came to consensus for this + // price. This timestamp is a conventional Unix millisecond time, i.e. the + // number of milliseconds elapsed since January 1, 1970 UTC. + int64 block_timestamp_ms = 3 [ (gogoproto.moretags) = "yaml:\"block_timestamp_ms\"" ]; } // Rewards defines a credit object towards validators diff --git a/proto/nibiru/oracle/v1/query.proto b/proto/nibiru/oracle/v1/query.proto index 3be464a1a..925042721 100644 --- a/proto/nibiru/oracle/v1/query.proto +++ b/proto/nibiru/oracle/v1/query.proto @@ -10,7 +10,8 @@ option go_package = "github.com/NibiruChain/nibiru/v2/x/oracle/types"; // Query defines the gRPC querier service. service Query { - // ExchangeRate returns exchange rate of a pair + // ExchangeRate returns exchange rate of a pair along with the block height and + // block time that the exchange rate was set by the oracle module. rpc ExchangeRate(QueryExchangeRateRequest) returns (QueryExchangeRateResponse) { option (google.api.http).get = "/nibiru/oracle/v1beta1/exchange_rate"; @@ -22,12 +23,6 @@ service Query { option (google.api.http).get = "/nibiru/oracle/v1beta1/exchange_rate_twap"; } - // DatedExchangeRate returns latest price of a pair - rpc DatedExchangeRate(QueryExchangeRateRequest) - returns (QueryDatedExchangeRateResponse) { - option (google.api.http).get = "/nibiru/oracle/v1beta1/dated_exchange_rate"; - } - // ExchangeRates returns exchange rates of all pairs rpc ExchangeRates(QueryExchangeRatesRequest) returns (QueryExchangeRatesResponse) { @@ -114,20 +109,6 @@ message QueryExchangeRateResponse { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; -} - -// QueryExchangeRatesRequest is the request type for the Query/ExchangeRates RPC -// method. -message QueryExchangeRatesRequest { -} - -// QueryDatedExchangeRateResponse is the request type for the -// Query/DatedExchangeRate RPC method. -message QueryDatedExchangeRateResponse { - string price = 1 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; // Block timestamp for the block where the oracle came to consensus for this // price. This timestamp is a conventional Unix millisecond time, i.e. the @@ -138,6 +119,11 @@ message QueryDatedExchangeRateResponse { uint64 block_height = 3; } +// QueryExchangeRatesRequest is the request type for the Query/ExchangeRates RPC +// method. +message QueryExchangeRatesRequest { +} + // QueryExchangeRatesResponse is response type for the // Query/ExchangeRates RPC method. message QueryExchangeRatesResponse { diff --git a/x/evm/precompile/oracle.go b/x/evm/precompile/oracle.go index 17894da56..03c71352d 100644 --- a/x/evm/precompile/oracle.go +++ b/x/evm/precompile/oracle.go @@ -89,12 +89,16 @@ func (p precompileOracle) queryExchangeRate( return nil, err } - price, blockTime, blockHeight, err := p.oracleKeeper.GetDatedExchangeRate(ctx, assetPair) + priceAtBlock, err := p.oracleKeeper.ExchangeRates.Get(ctx, assetPair) if err != nil { return nil, err } - return method.Outputs.Pack(price.BigInt(), uint64(blockTime), blockHeight) + return method.Outputs.Pack( + priceAtBlock.ExchangeRate.BigInt(), + uint64(priceAtBlock.BlockTimestampMs), + priceAtBlock.CreatedBlock, + ) } func (p precompileOracle) parseQueryExchangeRateArgs(args []any) ( diff --git a/x/evm/precompile/oracle_test.go b/x/evm/precompile/oracle_test.go index 1051e12aa..6fad8af7f 100644 --- a/x/evm/precompile/oracle_test.go +++ b/x/evm/precompile/oracle_test.go @@ -1,6 +1,7 @@ package precompile_test import ( + "fmt" "math/big" "testing" "time" @@ -9,6 +10,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/suite" + "github.com/NibiruChain/nibiru/v2/x/evm" "github.com/NibiruChain/nibiru/v2/x/evm/embeds" "github.com/NibiruChain/nibiru/v2/x/evm/evmtest" "github.com/NibiruChain/nibiru/v2/x/evm/precompile" @@ -56,14 +58,12 @@ func (s *OracleSuite) TestOracle_FailToPackABI() { func (s *OracleSuite) TestOracle_HappyPath() { deps := evmtest.NewTestDeps() - - s.T().Log("Query exchange rate") - { - deps.Ctx = deps.Ctx.WithBlockTime(time.Unix(69, 420)).WithBlockHeight(69) - deps.App.OracleKeeper.SetPrice(deps.Ctx, "unibi:uusd", sdk.MustNewDecFromStr("0.067")) - - resp, err := deps.EvmKeeper.CallContract( - deps.Ctx, + runQuery := func(ctx sdk.Context) ( + resp *evm.MsgEthereumTxResponse, + err error, + ) { + return deps.EvmKeeper.CallContract( + ctx, embeds.SmartContract_Oracle.ABI, deps.Sender.EthAddr, &precompile.PrecompileAddr_Oracle, @@ -72,16 +72,47 @@ func (s *OracleSuite) TestOracle_HappyPath() { "queryExchangeRate", "unibi:uusd", ) + } + + s.T().Log("Query exchange rate") + { + // 69 seconds + 420 nanoseconds === 69000 milliseconds for the + // return value from the UnixMilli() function + deps.Ctx = deps.Ctx.WithBlockTime(time.Unix(69, 420)).WithBlockHeight(69) + deps.App.OracleKeeper.SetPrice(deps.Ctx, "unibi:uusd", sdk.MustNewDecFromStr("0.067")) + + resp, err := runQuery(deps.Ctx) s.NoError(err) // Check the response - out, err := embeds.SmartContract_Oracle.ABI.Unpack(string(precompile.OracleMethod_queryExchangeRate), resp.Ret) + out, err := embeds.SmartContract_Oracle.ABI.Unpack( + string(precompile.OracleMethod_queryExchangeRate), resp.Ret, + ) + s.NoError(err) + s.Equal(out[0].(*big.Int), big.NewInt(67_000_000_000_000_000)) + s.Equal(fmt.Sprintf("%d", out[1].(uint64)), "69000") + s.Equal(fmt.Sprintf("%d", out[2].(uint64)), "69") + } + + s.T().Log("Query from a later time") + { + secondsLater := deps.Ctx.BlockTime().Add(100 * time.Second) + resp, err := runQuery(deps.Ctx. + WithBlockTime(secondsLater). + WithBlockHeight(deps.Ctx.BlockHeight() + 50), + ) s.NoError(err) // Check the response - s.Equal(out[0].(*big.Int), big.NewInt(67000000000000000)) - s.Equal(out[1].(uint64), uint64(69000)) - s.Equal(out[2].(uint64), uint64(69)) + out, err := embeds.SmartContract_Oracle.ABI.Unpack( + string(precompile.OracleMethod_queryExchangeRate), resp.Ret, + ) + s.NoError(err) + // These terms should still be equal because the latest exchange rate + // has not changed. + s.Equal(out[0].(*big.Int), big.NewInt(67_000_000_000_000_000)) + s.Equal(fmt.Sprintf("%d", out[1].(uint64)), "69000") + s.Equal(fmt.Sprintf("%d", out[2].(uint64)), "69") } } diff --git a/x/oracle/genesis_test.go b/x/oracle/genesis_test.go index f0e1c9dfb..13ccdbf7f 100644 --- a/x/oracle/genesis_test.go +++ b/x/oracle/genesis_test.go @@ -17,7 +17,12 @@ func TestExportInitGenesis(t *testing.T) { input.OracleKeeper.Params.Set(input.Ctx, types.DefaultParams()) input.OracleKeeper.FeederDelegations.Insert(input.Ctx, keeper.ValAddrs[0], keeper.Addrs[1]) - input.OracleKeeper.ExchangeRates.Insert(input.Ctx, "pair1:pair2", types.DatedPrice{ExchangeRate: math.LegacyNewDec(123), CreatedBlock: 0}) + input.OracleKeeper.ExchangeRates.Insert(input.Ctx, "pair1:pair2", + types.ExchangeRateAtBlock{ + ExchangeRate: math.LegacyNewDec(123), + CreatedBlock: 0, + BlockTimestampMs: 0, + }) input.OracleKeeper.Prevotes.Insert(input.Ctx, keeper.ValAddrs[0], types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{123}, keeper.ValAddrs[0], uint64(2))) input.OracleKeeper.Votes.Insert(input.Ctx, keeper.ValAddrs[0], types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{{Pair: "foo", ExchangeRate: math.LegacyNewDec(123)}}, keeper.ValAddrs[0])) input.OracleKeeper.WhitelistedPairs.Insert(input.Ctx, "pair1:pair1") diff --git a/x/oracle/keeper/querier.go b/x/oracle/keeper/grpc_query.go similarity index 89% rename from x/oracle/keeper/querier.go rename to x/oracle/keeper/grpc_query.go index 6cc7fbd2b..4410fdc7f 100644 --- a/x/oracle/keeper/querier.go +++ b/x/oracle/keeper/grpc_query.go @@ -50,12 +50,15 @@ func (q querier) ExchangeRate(c context.Context, req *types.QueryExchangeRateReq } ctx := sdk.UnwrapSDKContext(c) - exchangeRate, err := q.Keeper.GetExchangeRate(ctx, req.Pair) + out, err := q.Keeper.ExchangeRates.Get(ctx, req.Pair) if err != nil { return nil, err } - - return &types.QueryExchangeRateResponse{ExchangeRate: exchangeRate}, nil + return &types.QueryExchangeRateResponse{ + ExchangeRate: out.ExchangeRate, + BlockTimestampMs: out.BlockTimestampMs, + BlockHeight: out.CreatedBlock, + }, nil } /* @@ -79,24 +82,6 @@ func (q querier) ExchangeRateTwap(c context.Context, req *types.QueryExchangeRat return &types.QueryExchangeRateResponse{ExchangeRate: twap}, nil } -// get the latest price snapshot from the oracle for a pair -func (q querier) DatedExchangeRate(c context.Context, req *types.QueryExchangeRateRequest) (response *types.QueryDatedExchangeRateResponse, err error) { - if _, err = q.ExchangeRate(c, req); err != nil { - return - } - - ctx := sdk.UnwrapSDKContext(c) - price, blockTime, blockHeight, err := q.Keeper.GetDatedExchangeRate(ctx, req.Pair) - if err != nil { - return &types.QueryDatedExchangeRateResponse{}, err - } - return &types.QueryDatedExchangeRateResponse{ - Price: price, - BlockTimestampMs: blockTime, - BlockHeight: blockHeight, - }, nil -} - // ExchangeRates queries exchange rates of all pairs func (q querier) ExchangeRates(c context.Context, _ *types.QueryExchangeRatesRequest) (*types.QueryExchangeRatesResponse, error) { ctx := sdk.UnwrapSDKContext(c) diff --git a/x/oracle/keeper/querier_test.go b/x/oracle/keeper/grpc_query_test.go similarity index 82% rename from x/oracle/keeper/querier_test.go rename to x/oracle/keeper/grpc_query_test.go index 45e39ccdc..c6ff2f4ad 100644 --- a/x/oracle/keeper/querier_test.go +++ b/x/oracle/keeper/grpc_query_test.go @@ -10,6 +10,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/NibiruChain/nibiru/v2/x/common/set" testutilevents "github.com/NibiruChain/nibiru/v2/x/common/testutil" "github.com/NibiruChain/nibiru/v2/x/common/asset" @@ -37,7 +38,15 @@ func TestQueryExchangeRate(t *testing.T) { querier := NewQuerier(input.OracleKeeper) rate := math.LegacyNewDec(1700) - input.OracleKeeper.ExchangeRates.Insert(input.Ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(input.Ctx.BlockHeight())}) + input.OracleKeeper.ExchangeRates.Insert( + input.Ctx, + asset.Registry.Pair(denoms.ETH, denoms.NUSD), + types.ExchangeRateAtBlock{ + ExchangeRate: rate, + CreatedBlock: uint64(input.Ctx.BlockHeight()), + BlockTimestampMs: input.Ctx.BlockTime().UnixMilli(), + }, + ) // empty request _, err := querier.ExchangeRate(ctx, nil) @@ -77,8 +86,24 @@ func TestQueryExchangeRates(t *testing.T) { querier := NewQuerier(input.OracleKeeper) rate := math.LegacyNewDec(1700) - input.OracleKeeper.ExchangeRates.Insert(input.Ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(input.Ctx.BlockHeight())}) - input.OracleKeeper.ExchangeRates.Insert(input.Ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(input.Ctx.BlockHeight())}) + input.OracleKeeper.ExchangeRates.Insert( + input.Ctx, + asset.Registry.Pair(denoms.BTC, denoms.NUSD), + types.ExchangeRateAtBlock{ + ExchangeRate: rate, + CreatedBlock: uint64(input.Ctx.BlockHeight()), + BlockTimestampMs: input.Ctx.BlockTime().UnixMilli(), + }, + ) + input.OracleKeeper.ExchangeRates.Insert( + input.Ctx, + asset.Registry.Pair(denoms.ETH, denoms.NUSD), + types.ExchangeRateAtBlock{ + ExchangeRate: rate, + CreatedBlock: uint64(input.Ctx.BlockHeight()), + BlockTimestampMs: input.Ctx.BlockTime().UnixMilli(), + }, + ) res, err := querier.ExchangeRates(ctx, &types.QueryExchangeRatesRequest{}) require.NoError(t, err) @@ -122,9 +147,12 @@ func TestQueryDatedExchangeRate(t *testing.T) { input := CreateTestFixture(t) querier := NewQuerier(input.OracleKeeper) - // Set initial block time and height initialTime := input.Ctx.BlockTime() initialHeight := input.Ctx.BlockHeight() + t.Logf("Set initial block time and height\ninitialTimeSeconds: %d, intialHeight: %d", + initialTime.Unix(), + initialHeight, + ) // Pair 1: BTC/NUSD pairBTC := asset.Registry.Pair(denoms.BTC, denoms.NUSD) @@ -148,11 +176,17 @@ func TestQueryDatedExchangeRate(t *testing.T) { }, ) - // Advance time and block height - input.Ctx = input.Ctx.WithBlockTime(initialTime.Add(1 * time.Second)). - WithBlockHeight(initialHeight + 1) + blockTime := initialTime.Add(1 * time.Second) + blockHeight := initialHeight + 1 + t.Logf("Advance time and block height\nblockTimeSeconds: %d, blockHeight: %d", + blockTime.Unix(), + blockHeight, + ) + input.Ctx = input.Ctx. + WithBlockTime(blockTime). + WithBlockHeight(blockHeight) - // --- Set first price for ETH/NUSD --- + t.Log("Set first price for ETH") input.OracleKeeper.SetPrice(input.Ctx, pairETH, rateETH1) testutilevents.RequireContainsTypedEvent( t, @@ -164,11 +198,17 @@ func TestQueryDatedExchangeRate(t *testing.T) { }, ) - // Advance time and block height - input.Ctx = input.Ctx.WithBlockTime(initialTime.Add(2 * time.Second)). - WithBlockHeight(initialHeight + 2) + blockTime = initialTime.Add(2 * time.Second) + blockHeight = initialHeight + 2 + t.Logf("Advance time and block height\nblockTimeSeconds: %d, blockHeight: %d", + blockTime.Unix(), + blockHeight, + ) + input.Ctx = input.Ctx. + WithBlockTime(blockTime). + WithBlockHeight(blockHeight) - // --- Set second price for BTC/NUSD --- + t.Log("Set second price for BTC") input.OracleKeeper.SetPrice(input.Ctx, pairBTC, rateBTC2) testutilevents.RequireContainsTypedEvent( t, @@ -180,11 +220,12 @@ func TestQueryDatedExchangeRate(t *testing.T) { }, ) - // Advance time and block height - input.Ctx = input.Ctx.WithBlockTime(initialTime.Add(3 * time.Second)). + t.Log("Advance time and block height") + input.Ctx = input.Ctx. + WithBlockTime(initialTime.Add(3 * time.Second)). WithBlockHeight(initialHeight + 3) - // --- Set second price for ETH/NUSD --- + t.Log("Set second price for ETH") input.OracleKeeper.SetPrice(input.Ctx, pairETH, rateETH2) testutilevents.RequireContainsTypedEvent( t, @@ -199,28 +240,33 @@ func TestQueryDatedExchangeRate(t *testing.T) { // Wrap context for querying ctx := sdk.WrapSDKContext(input.Ctx) - // --- Query latest snapshot for BTC/NUSD --- - resBTC, err := querier.DatedExchangeRate( + t.Log("Query latest snapshot for BTC") + resBTC, err := querier.ExchangeRate( ctx, &types.QueryExchangeRateRequest{Pair: pairBTC}, ) require.NoError(t, err) - require.Equal(t, rateBTC2, resBTC.Price) - require.Equal(t, input.Ctx.BlockTime().UnixMilli(), resBTC.BlockTimestampMs) + res := resBTC + require.Equal(t, rateBTC2.String(), resBTC.ExchangeRate.String()) + require.Equal(t, initialTime.Add(2*time.Second).UnixMilli(), res.BlockTimestampMs) + require.Equal(t, uint64(initialHeight+2), res.BlockHeight) - // --- Query latest snapshot for ETH/NUSD --- - resETH, err := querier.DatedExchangeRate( + t.Log("Query latest snapshot for ETH") + resETH, err := querier.ExchangeRate( ctx, &types.QueryExchangeRateRequest{Pair: pairETH}, ) require.NoError(t, err) - require.Equal(t, rateETH2, resETH.Price) - require.Equal(t, input.Ctx.BlockTime().UnixMilli(), resETH.BlockTimestampMs) - - // --- Query a pair with no snapshots (should return an error) --- - pairATOM := asset.Registry.Pair(denoms.ATOM, denoms.NUSD) - _, err = querier.DatedExchangeRate(ctx, &types.QueryExchangeRateRequest{Pair: pairATOM}) - require.Error(t, err) + res = resETH + require.Equal(t, rateETH2, res.ExchangeRate) + require.Equal(t, initialTime.Add(3*time.Second).UnixMilli(), res.BlockTimestampMs) + require.Equal(t, uint64(initialHeight+3), res.BlockHeight) + + t.Run("Query a pair with no snapshots (should return an error)", func(t *testing.T) { + pairATOM := asset.Registry.Pair(denoms.ATOM, denoms.NUSD) + _, err = querier.ExchangeRate(ctx, &types.QueryExchangeRateRequest{Pair: pairATOM}) + require.Error(t, err) + }) } func TestCalcTwap(t *testing.T) { @@ -312,20 +358,26 @@ func TestQueryActives(t *testing.T) { queryClient := NewQuerier(input.OracleKeeper) rate := math.LegacyNewDec(1700) - input.OracleKeeper.ExchangeRates.Insert(input.Ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(input.Ctx.BlockHeight())}) - input.OracleKeeper.ExchangeRates.Insert(input.Ctx, asset.Registry.Pair(denoms.NIBI, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(input.Ctx.BlockHeight())}) - input.OracleKeeper.ExchangeRates.Insert(input.Ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(input.Ctx.BlockHeight())}) + targetPairs := set.New[asset.Pair]() + for _, bankDenom := range []string{denoms.BTC, denoms.ETH, denoms.NIBI} { + pair := asset.Registry.Pair(bankDenom, denoms.NUSD) + targetPairs.Add(pair) + input.OracleKeeper.ExchangeRates.Insert( + input.Ctx, + pair, + types.ExchangeRateAtBlock{ + ExchangeRate: rate, + CreatedBlock: uint64(input.Ctx.BlockHeight()), + BlockTimestampMs: input.Ctx.BlockTime().UnixMilli(), + }, + ) + } res, err := queryClient.Actives(ctx, &types.QueryActivesRequest{}) require.NoError(t, err) - - targetPairs := []asset.Pair{ - asset.Registry.Pair(denoms.BTC, denoms.NUSD), - asset.Registry.Pair(denoms.ETH, denoms.NUSD), - asset.Registry.Pair(denoms.NIBI, denoms.NUSD), + for _, pair := range res.Actives { + require.True(t, targetPairs.Has(pair)) } - - require.Equal(t, targetPairs, res.Actives) } func TestQueryFeederDelegation(t *testing.T) { diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index bbbf31ce9..e7beb8026 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -35,7 +35,7 @@ type Keeper struct { // Module parameters Params collections.Item[types.Params] - ExchangeRates collections.Map[asset.Pair, types.DatedPrice] + ExchangeRates collections.Map[asset.Pair, types.ExchangeRateAtBlock] FeederDelegations collections.Map[sdk.ValAddress, sdk.AccAddress] MissCounters collections.Map[sdk.ValAddress, uint64] Prevotes collections.Map[sdk.ValAddress, types.AggregateExchangeRatePrevote] @@ -80,7 +80,7 @@ func NewKeeper( sudoKeeper: sudoKeeper, distrModuleName: distrName, Params: collections.NewItem(storeKey, 11, collections.ProtoValueEncoder[types.Params](cdc)), - ExchangeRates: collections.NewMap(storeKey, 1, asset.PairKeyEncoder, collections.ProtoValueEncoder[types.DatedPrice](cdc)), + ExchangeRates: collections.NewMap(storeKey, 1, asset.PairKeyEncoder, collections.ProtoValueEncoder[types.ExchangeRateAtBlock](cdc)), PriceSnapshots: collections.NewMap(storeKey, 10, collections.PairKeyEncoder(asset.PairKeyEncoder, collections.TimeKeyEncoder), collections.ProtoValueEncoder[types.PriceSnapshot](cdc)), FeederDelegations: collections.NewMap(storeKey, 2, collections.ValAddressKeyEncoder, collections.AccAddressValueEncoder), MissCounters: collections.NewMap(storeKey, 3, collections.ValAddressKeyEncoder, collections.Uint64ValueEncoder), @@ -168,7 +168,8 @@ func (k Keeper) GetExchangeRateTwap(ctx sdk.Context, pair asset.Pair) (price sdk for i, s := range snapshots { var nextTimestampMs int64 if i == len(snapshots)-1 { - // if we're at the last snapshot, then consider that price as ongoing until the current blocktime + // if we're at the last snapshot, then consider that price as ongoing + // until the current blocktime nextTimestampMs = ctx.BlockTime().UnixMilli() } else { nextTimestampMs = snapshots[i+1].TimestampMs @@ -181,37 +182,26 @@ func (k Keeper) GetExchangeRateTwap(ctx sdk.Context, pair asset.Pair) (price sdk return cumulativePrice.QuoInt64(ctx.BlockTime().UnixMilli() - firstTimestampMs), nil } -func (k Keeper) GetExchangeRate(ctx sdk.Context, pair asset.Pair) (price sdk.Dec, err error) { - exchangeRate, err := k.ExchangeRates.Get(ctx, pair) - price = exchangeRate.ExchangeRate - return -} - -func (k Keeper) GetDatedExchangeRate(ctx sdk.Context, pair asset.Pair) (price sdk.Dec, blockTimeMs int64, BlockHeight uint64, err error) { - exchangeRate, err := k.ExchangeRates.Get(ctx, pair) - if err != nil { - return - } - time := ctx.WithBlockHeight(int64(exchangeRate.CreatedBlock)).BlockTime() - - return exchangeRate.ExchangeRate, time.UnixMilli(), exchangeRate.CreatedBlock, nil -} - // SetPrice sets the price for a pair as well as the price snapshot. func (k Keeper) SetPrice(ctx sdk.Context, pair asset.Pair, price sdk.Dec) { - k.ExchangeRates.Insert(ctx, pair, types.DatedPrice{ExchangeRate: price, CreatedBlock: uint64(ctx.BlockHeight())}) + blockTimestampMs := ctx.BlockTime().UnixMilli() + k.ExchangeRates.Insert(ctx, pair, + types.ExchangeRateAtBlock{ + ExchangeRate: price, + CreatedBlock: uint64(ctx.BlockHeight()), + BlockTimestampMs: blockTimestampMs, + }) key := collections.Join(pair, ctx.BlockTime()) - timestampMs := ctx.BlockTime().UnixMilli() k.PriceSnapshots.Insert(ctx, key, types.PriceSnapshot{ Pair: pair, Price: price, - TimestampMs: timestampMs, + TimestampMs: blockTimestampMs, }) if err := ctx.EventManager().EmitTypedEvent(&types.EventPriceUpdate{ Pair: pair.String(), Price: price, - TimestampMs: timestampMs, + TimestampMs: blockTimestampMs, }); err != nil { ctx.Logger().Error("failed to emit OraclePriceUpdate", "pair", pair, "error", err) } diff --git a/x/oracle/keeper/test_utils.go b/x/oracle/keeper/test_utils.go index 692b52623..5b42f40f7 100644 --- a/x/oracle/keeper/test_utils.go +++ b/x/oracle/keeper/test_utils.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "cosmossdk.io/math" + sdkmath "cosmossdk.io/math" "github.com/NibiruChain/nibiru/v2/x/common/denoms" "github.com/NibiruChain/nibiru/v2/x/oracle/types" "github.com/NibiruChain/nibiru/v2/x/sudo" @@ -222,9 +222,7 @@ func CreateTestFixture(t *testing.T) TestFixture { distrKeeper.SetFeePool(ctx, distrtypes.InitialFeePool()) distrParams := distrtypes.DefaultParams() - distrParams.CommunityTax = math.LegacyNewDecWithPrec(2, 2) - distrParams.BaseProposerReward = math.LegacyNewDecWithPrec(1, 2) - distrParams.BonusProposerReward = math.LegacyNewDecWithPrec(4, 2) + distrParams.CommunityTax = sdkmath.LegacyNewDecWithPrec(2, 2) distrKeeper.SetParams(ctx, distrParams) stakingKeeper.SetHooks(stakingtypes.NewMultiStakingHooks(distrKeeper.Hooks())) @@ -283,12 +281,12 @@ func CreateTestFixture(t *testing.T) TestFixture { // NewTestMsgCreateValidator test msg creator func NewTestMsgCreateValidator( - address sdk.ValAddress, pubKey cryptotypes.PubKey, amt sdk.Int, + address sdk.ValAddress, pubKey cryptotypes.PubKey, amt sdkmath.Int, ) *stakingtypes.MsgCreateValidator { - commission := stakingtypes.NewCommissionRates(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec()) + commission := stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()) msg, _ := stakingtypes.NewMsgCreateValidator( address, pubKey, sdk.NewCoin(denoms.NIBI, amt), - stakingtypes.Description{}, commission, math.OneInt(), + stakingtypes.Description{}, commission, sdkmath.OneInt(), ) return msg @@ -312,7 +310,7 @@ func AllocateRewards(t *testing.T, input TestFixture, rewards sdk.Coins, votePer var ( testStakingAmt = sdk.TokensFromConsensusPower(10, sdk.DefaultPowerReduction) - testExchangeRate = math.LegacyNewDec(1700) + testExchangeRate = sdkmath.LegacyNewDec(1700) ) func Setup(t *testing.T) (TestFixture, types.MsgServer) { diff --git a/x/oracle/types/oracle.pb.go b/x/oracle/types/oracle.pb.go index 3ada32d99..2585900fd 100644 --- a/x/oracle/types/oracle.pb.go +++ b/x/oracle/types/oracle.pb.go @@ -260,23 +260,27 @@ func (m *ExchangeRateTuple) XXX_DiscardUnknown() { var xxx_messageInfo_ExchangeRateTuple proto.InternalMessageInfo -type DatedPrice struct { +type ExchangeRateAtBlock struct { ExchangeRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=exchange_rate,json=exchangeRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"exchange_rate" yaml:"exchange_rate"` CreatedBlock uint64 `protobuf:"varint,2,opt,name=created_block,json=createdBlock,proto3" json:"created_block,omitempty" yaml:"created_block"` + // Block timestamp for the block where the oracle came to consensus for this + // price. This timestamp is a conventional Unix millisecond time, i.e. the + // number of milliseconds elapsed since January 1, 1970 UTC. + BlockTimestampMs int64 `protobuf:"varint,3,opt,name=block_timestamp_ms,json=blockTimestampMs,proto3" json:"block_timestamp_ms,omitempty" yaml:"block_timestamp_ms"` } -func (m *DatedPrice) Reset() { *m = DatedPrice{} } -func (m *DatedPrice) String() string { return proto.CompactTextString(m) } -func (*DatedPrice) ProtoMessage() {} -func (*DatedPrice) Descriptor() ([]byte, []int) { +func (m *ExchangeRateAtBlock) Reset() { *m = ExchangeRateAtBlock{} } +func (m *ExchangeRateAtBlock) String() string { return proto.CompactTextString(m) } +func (*ExchangeRateAtBlock) ProtoMessage() {} +func (*ExchangeRateAtBlock) Descriptor() ([]byte, []int) { return fileDescriptor_43d45df86ea09ed4, []int{4} } -func (m *DatedPrice) XXX_Unmarshal(b []byte) error { +func (m *ExchangeRateAtBlock) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *DatedPrice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ExchangeRateAtBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_DatedPrice.Marshal(b, m, deterministic) + return xxx_messageInfo_ExchangeRateAtBlock.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -286,25 +290,32 @@ func (m *DatedPrice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *DatedPrice) XXX_Merge(src proto.Message) { - xxx_messageInfo_DatedPrice.Merge(m, src) +func (m *ExchangeRateAtBlock) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExchangeRateAtBlock.Merge(m, src) } -func (m *DatedPrice) XXX_Size() int { +func (m *ExchangeRateAtBlock) XXX_Size() int { return m.Size() } -func (m *DatedPrice) XXX_DiscardUnknown() { - xxx_messageInfo_DatedPrice.DiscardUnknown(m) +func (m *ExchangeRateAtBlock) XXX_DiscardUnknown() { + xxx_messageInfo_ExchangeRateAtBlock.DiscardUnknown(m) } -var xxx_messageInfo_DatedPrice proto.InternalMessageInfo +var xxx_messageInfo_ExchangeRateAtBlock proto.InternalMessageInfo -func (m *DatedPrice) GetCreatedBlock() uint64 { +func (m *ExchangeRateAtBlock) GetCreatedBlock() uint64 { if m != nil { return m.CreatedBlock } return 0 } +func (m *ExchangeRateAtBlock) GetBlockTimestampMs() int64 { + if m != nil { + return m.BlockTimestampMs + } + return 0 +} + // Rewards defines a credit object towards validators // which provide prices faithfully for different pairs. type Rewards struct { @@ -376,75 +387,77 @@ func init() { proto.RegisterType((*AggregateExchangeRatePrevote)(nil), "nibiru.oracle.v1.AggregateExchangeRatePrevote") proto.RegisterType((*AggregateExchangeRateVote)(nil), "nibiru.oracle.v1.AggregateExchangeRateVote") proto.RegisterType((*ExchangeRateTuple)(nil), "nibiru.oracle.v1.ExchangeRateTuple") - proto.RegisterType((*DatedPrice)(nil), "nibiru.oracle.v1.DatedPrice") + proto.RegisterType((*ExchangeRateAtBlock)(nil), "nibiru.oracle.v1.ExchangeRateAtBlock") proto.RegisterType((*Rewards)(nil), "nibiru.oracle.v1.Rewards") } func init() { proto.RegisterFile("nibiru/oracle/v1/oracle.proto", fileDescriptor_43d45df86ea09ed4) } var fileDescriptor_43d45df86ea09ed4 = []byte{ - // 977 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0x26, 0x4e, 0x1a, 0x8f, 0x93, 0x92, 0x4c, 0x53, 0xd8, 0x84, 0xe2, 0x0d, 0x53, 0xa9, - 0xca, 0x01, 0x76, 0x95, 0x50, 0x84, 0x88, 0xc4, 0x81, 0x6d, 0x08, 0x8a, 0x08, 0xc8, 0x1a, 0x55, - 0x20, 0x71, 0x59, 0xcd, 0xee, 0x4e, 0xec, 0x21, 0xbb, 0x3b, 0xd6, 0xcc, 0xda, 0x4e, 0x24, 0xc4, - 0x99, 0x63, 0x4f, 0x88, 0x63, 0xce, 0xdc, 0xb8, 0xf1, 0x27, 0xf4, 0x84, 0x7a, 0x44, 0x3d, 0x6c, - 0xab, 0xe4, 0x52, 0xc1, 0xcd, 0x7f, 0x01, 0x9a, 0xd9, 0x71, 0xbc, 0xc1, 0x3e, 0x34, 0x20, 0x4e, - 0xde, 0xf7, 0xbe, 0x99, 0xef, 0x7d, 0xef, 0xc7, 0xcc, 0x18, 0xbc, 0x93, 0xb1, 0x90, 0x89, 0xbe, - 0xc7, 0x05, 0x89, 0x12, 0xea, 0x0d, 0x76, 0xcc, 0x97, 0xdb, 0x13, 0x3c, 0xe7, 0x70, 0xb5, 0x84, - 0x5d, 0xe3, 0x1c, 0xec, 0x6c, 0xae, 0x77, 0x78, 0x87, 0x6b, 0xd0, 0x53, 0x5f, 0xe5, 0xba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 0x78, 0x1b, 0xcc, 0x31, 0xf3, 0x0e, 0xe3, 0x39, 0x16, 0xc3, - 0x77, 0xc1, 0x72, 0xe5, 0x0d, 0x96, 0x25, 0x31, 0x6e, 0x4e, 0x5e, 0x62, 0x09, 0x3f, 0x04, 0x0b, - 0xea, 0x71, 0x97, 0xf6, 0xbc, 0x9e, 0xcd, 0x0d, 0xb7, 0x4c, 0xc4, 0x55, 0xcf, 0xbf, 0x6b, 0x9e, - 0x7f, 0xf7, 0x11, 0x67, 0x99, 0x5f, 0x57, 0xc9, 0xe3, 0x72, 0xb5, 0x7f, 0xf8, 0xf4, 0xa2, 0x65, - 0x3d, 0xbb, 0x68, 0x59, 0x2f, 0x2f, 0x5a, 0xd6, 0x93, 0xcb, 0x56, 0xed, 0xd9, 0x65, 0xab, 0xf6, - 0xc7, 0x65, 0xab, 0xf6, 0xad, 0xf7, 0x1a, 0xb3, 0x60, 0xfe, 0xc2, 0xe8, 0x42, 0x85, 0x8b, 0xfa, - 0xda, 0xfd, 0xe0, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x89, 0xe7, 0x1a, 0xe9, 0xe0, 0x08, 0x00, + // 1009 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xf7, 0x26, 0x4e, 0x1a, 0x8f, 0x93, 0x92, 0x4c, 0x52, 0xd8, 0x84, 0xd6, 0x1b, 0xa6, 0x52, + 0x95, 0x03, 0xec, 0x2a, 0xa1, 0x08, 0x11, 0x89, 0x43, 0xb7, 0x21, 0x28, 0x6a, 0x8a, 0xa2, 0x51, + 0x04, 0x12, 0x97, 0xd5, 0x78, 0x77, 0x62, 0x0f, 0xf1, 0xee, 0x58, 0x3b, 0xe3, 0x38, 0x91, 0x10, + 0x67, 0x4e, 0xa8, 0x27, 0xc4, 0x31, 0x67, 0x6e, 0x7c, 0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, 0x4f, 0x03, + 0x4b, 0xc7, 0x7c, 0x3e, 0x12, 0xc9, 0x71, 0x20, 0xcf, 0xba, 0x54, 0xf8, 0x3b, 0x34, 0x1e, 0x14, + 0xde, 0x9d, 0x92, 0xa7, 0x2b, 0x34, 0x84, 0x17, 0x94, 0xe2, 0x70, 0x28, 0x43, 0x0a, 0xea, 0x39, + 0xed, 0x93, 0x3c, 0x89, 0x9a, 0x24, 0x4b, 0xdc, 0x69, 0xed, 0x6c, 0xe7, 0xc6, 0xce, 0x6c, 0x58, + 0x25, 0x28, 0x84, 0x81, 0x91, 0x42, 0x92, 0x25, 0xf0, 0x3b, 0x50, 0xeb, 0xb7, 0x99, 0xa4, 0x1d, + 0x26, 0xa4, 0x5b, 0x5d, 0x9f, 0xde, 0xa8, 0x85, 0xfb, 0x2f, 0x0b, 0xef, 0x61, 0xc9, 0xc1, 0x57, + 0xba, 0x48, 0x8f, 0xdb, 0x84, 0x65, 0x81, 0xad, 0xe7, 0xc9, 0x56, 0x70, 0x1a, 0xc4, 0x3c, 0x4d, + 0x79, 0x16, 0x10, 0x21, 0xa8, 0xf4, 0x0f, 0x08, 0xcb, 0x07, 0x85, 0xb7, 0x68, 0xdc, 0x5d, 0x41, + 0x22, 0x3c, 0x82, 0x57, 0x29, 0x14, 0x1d, 0x22, 0xda, 0xd1, 0x51, 0x4e, 0x62, 0x55, 0x3e, 0x77, + 0xe6, 0xbf, 0xa5, 0xf0, 0x3a, 0x1a, 0xc2, 0x0b, 0x5a, 0xb1, 0x6b, 0x65, 0xb8, 0x0d, 0xe6, 0xcd, + 0x8a, 0x3e, 0xcb, 0x12, 0xde, 0x77, 0x67, 0x75, 0xb1, 0xdf, 0x1b, 0x14, 0xde, 0x72, 0x79, 0xbf, + 0xb1, 0x22, 0x5c, 0xd7, 0xe2, 0x37, 0x5a, 0x82, 0x3f, 0x80, 0x95, 0x94, 0x65, 0xd1, 0x09, 0xe9, + 0xb0, 0x44, 0xf5, 0xc3, 0x10, 0xe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0xa3, 0xf2, 0x6d, 0xf0, 0x16, 0x1d, 0x66, 0x1f, 0x46, 0x3a, 0xeb, 0xcd, 0x59, + 0x3d, 0xcc, 0x3f, 0xfe, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xa2, 0x1f, 0x50, 0xdb, 0x36, 0x09, 0x00, 0x00, } @@ -751,7 +764,7 @@ func (m *ExchangeRateTuple) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *DatedPrice) Marshal() (dAtA []byte, err error) { +func (m *ExchangeRateAtBlock) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -761,16 +774,21 @@ func (m *DatedPrice) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *DatedPrice) MarshalTo(dAtA []byte) (int, error) { +func (m *ExchangeRateAtBlock) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *DatedPrice) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ExchangeRateAtBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if m.BlockTimestampMs != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.BlockTimestampMs)) + i-- + dAtA[i] = 0x18 + } if m.CreatedBlock != 0 { i = encodeVarintOracle(dAtA, i, uint64(m.CreatedBlock)) i-- @@ -938,7 +956,7 @@ func (m *ExchangeRateTuple) Size() (n int) { return n } -func (m *DatedPrice) Size() (n int) { +func (m *ExchangeRateAtBlock) Size() (n int) { if m == nil { return 0 } @@ -949,6 +967,9 @@ func (m *DatedPrice) Size() (n int) { if m.CreatedBlock != 0 { n += 1 + sovOracle(uint64(m.CreatedBlock)) } + if m.BlockTimestampMs != 0 { + n += 1 + sovOracle(uint64(m.BlockTimestampMs)) + } return n } @@ -1711,7 +1732,7 @@ func (m *ExchangeRateTuple) Unmarshal(dAtA []byte) error { } return nil } -func (m *DatedPrice) Unmarshal(dAtA []byte) error { +func (m *ExchangeRateAtBlock) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1734,10 +1755,10 @@ func (m *DatedPrice) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DatedPrice: wiretype end group for non-group") + return fmt.Errorf("proto: ExchangeRateAtBlock: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DatedPrice: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ExchangeRateAtBlock: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1793,6 +1814,25 @@ func (m *DatedPrice) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockTimestampMs", wireType) + } + m.BlockTimestampMs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockTimestampMs |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipOracle(dAtA[iNdEx:]) diff --git a/x/oracle/types/query.pb.go b/x/oracle/types/query.pb.go index 4149e28c4..9498fb7d9 100644 --- a/x/oracle/types/query.pb.go +++ b/x/oracle/types/query.pb.go @@ -77,6 +77,12 @@ var xxx_messageInfo_QueryExchangeRateRequest proto.InternalMessageInfo type QueryExchangeRateResponse struct { // exchange_rate defines the exchange rate of assets voted by validators ExchangeRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=exchange_rate,json=exchangeRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"exchange_rate"` + // Block timestamp for the block where the oracle came to consensus for this + // price. This timestamp is a conventional Unix millisecond time, i.e. the + // number of milliseconds elapsed since January 1, 1970 UTC. + BlockTimestampMs int64 `protobuf:"varint,2,opt,name=block_timestamp_ms,json=blockTimestampMs,proto3" json:"block_timestamp_ms,omitempty"` + // Block height when the oracle came to consensus for this price. + BlockHeight uint64 `protobuf:"varint,3,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` } func (m *QueryExchangeRateResponse) Reset() { *m = QueryExchangeRateResponse{} } @@ -112,6 +118,20 @@ func (m *QueryExchangeRateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryExchangeRateResponse proto.InternalMessageInfo +func (m *QueryExchangeRateResponse) GetBlockTimestampMs() int64 { + if m != nil { + return m.BlockTimestampMs + } + return 0 +} + +func (m *QueryExchangeRateResponse) GetBlockHeight() uint64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + // QueryExchangeRatesRequest is the request type for the Query/ExchangeRates RPC // method. type QueryExchangeRatesRequest struct { @@ -150,65 +170,6 @@ func (m *QueryExchangeRatesRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryExchangeRatesRequest proto.InternalMessageInfo -// QueryDatedExchangeRateResponse is the request type for the -// Query/DatedExchangeRate RPC method. -type QueryDatedExchangeRateResponse struct { - Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"` - // Block timestamp for the block where the oracle came to consensus for this - // price. This timestamp is a conventional Unix millisecond time, i.e. the - // number of milliseconds elapsed since January 1, 1970 UTC. - BlockTimestampMs int64 `protobuf:"varint,2,opt,name=block_timestamp_ms,json=blockTimestampMs,proto3" json:"block_timestamp_ms,omitempty"` - // Block height when the oracle came to consensus for this price. - BlockHeight uint64 `protobuf:"varint,3,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` -} - -func (m *QueryDatedExchangeRateResponse) Reset() { *m = QueryDatedExchangeRateResponse{} } -func (m *QueryDatedExchangeRateResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDatedExchangeRateResponse) ProtoMessage() {} -func (*QueryDatedExchangeRateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{3} -} -func (m *QueryDatedExchangeRateResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDatedExchangeRateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDatedExchangeRateResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryDatedExchangeRateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDatedExchangeRateResponse.Merge(m, src) -} -func (m *QueryDatedExchangeRateResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDatedExchangeRateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDatedExchangeRateResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDatedExchangeRateResponse proto.InternalMessageInfo - -func (m *QueryDatedExchangeRateResponse) GetBlockTimestampMs() int64 { - if m != nil { - return m.BlockTimestampMs - } - return 0 -} - -func (m *QueryDatedExchangeRateResponse) GetBlockHeight() uint64 { - if m != nil { - return m.BlockHeight - } - return 0 -} - // QueryExchangeRatesResponse is response type for the // Query/ExchangeRates RPC method. type QueryExchangeRatesResponse struct { @@ -221,7 +182,7 @@ func (m *QueryExchangeRatesResponse) Reset() { *m = QueryExchangeRatesRe func (m *QueryExchangeRatesResponse) String() string { return proto.CompactTextString(m) } func (*QueryExchangeRatesResponse) ProtoMessage() {} func (*QueryExchangeRatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{4} + return fileDescriptor_16aef2382d1249a8, []int{3} } func (m *QueryExchangeRatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -265,7 +226,7 @@ func (m *QueryActivesRequest) Reset() { *m = QueryActivesRequest{} } func (m *QueryActivesRequest) String() string { return proto.CompactTextString(m) } func (*QueryActivesRequest) ProtoMessage() {} func (*QueryActivesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{5} + return fileDescriptor_16aef2382d1249a8, []int{4} } func (m *QueryActivesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -305,7 +266,7 @@ func (m *QueryActivesResponse) Reset() { *m = QueryActivesResponse{} } func (m *QueryActivesResponse) String() string { return proto.CompactTextString(m) } func (*QueryActivesResponse) ProtoMessage() {} func (*QueryActivesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{6} + return fileDescriptor_16aef2382d1249a8, []int{5} } func (m *QueryActivesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -343,7 +304,7 @@ func (m *QueryVoteTargetsRequest) Reset() { *m = QueryVoteTargetsRequest func (m *QueryVoteTargetsRequest) String() string { return proto.CompactTextString(m) } func (*QueryVoteTargetsRequest) ProtoMessage() {} func (*QueryVoteTargetsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{7} + return fileDescriptor_16aef2382d1249a8, []int{6} } func (m *QueryVoteTargetsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -384,7 +345,7 @@ func (m *QueryVoteTargetsResponse) Reset() { *m = QueryVoteTargetsRespon func (m *QueryVoteTargetsResponse) String() string { return proto.CompactTextString(m) } func (*QueryVoteTargetsResponse) ProtoMessage() {} func (*QueryVoteTargetsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{8} + return fileDescriptor_16aef2382d1249a8, []int{7} } func (m *QueryVoteTargetsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -424,7 +385,7 @@ func (m *QueryFeederDelegationRequest) Reset() { *m = QueryFeederDelegat func (m *QueryFeederDelegationRequest) String() string { return proto.CompactTextString(m) } func (*QueryFeederDelegationRequest) ProtoMessage() {} func (*QueryFeederDelegationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{9} + return fileDescriptor_16aef2382d1249a8, []int{8} } func (m *QueryFeederDelegationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -464,7 +425,7 @@ func (m *QueryFeederDelegationResponse) Reset() { *m = QueryFeederDelega func (m *QueryFeederDelegationResponse) String() string { return proto.CompactTextString(m) } func (*QueryFeederDelegationResponse) ProtoMessage() {} func (*QueryFeederDelegationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{10} + return fileDescriptor_16aef2382d1249a8, []int{9} } func (m *QueryFeederDelegationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -511,7 +472,7 @@ func (m *QueryMissCounterRequest) Reset() { *m = QueryMissCounterRequest func (m *QueryMissCounterRequest) String() string { return proto.CompactTextString(m) } func (*QueryMissCounterRequest) ProtoMessage() {} func (*QueryMissCounterRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{11} + return fileDescriptor_16aef2382d1249a8, []int{10} } func (m *QueryMissCounterRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -551,7 +512,7 @@ func (m *QueryMissCounterResponse) Reset() { *m = QueryMissCounterRespon func (m *QueryMissCounterResponse) String() string { return proto.CompactTextString(m) } func (*QueryMissCounterResponse) ProtoMessage() {} func (*QueryMissCounterResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{12} + return fileDescriptor_16aef2382d1249a8, []int{11} } func (m *QueryMissCounterResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -598,7 +559,7 @@ func (m *QueryAggregatePrevoteRequest) Reset() { *m = QueryAggregatePrev func (m *QueryAggregatePrevoteRequest) String() string { return proto.CompactTextString(m) } func (*QueryAggregatePrevoteRequest) ProtoMessage() {} func (*QueryAggregatePrevoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{13} + return fileDescriptor_16aef2382d1249a8, []int{12} } func (m *QueryAggregatePrevoteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -639,7 +600,7 @@ func (m *QueryAggregatePrevoteResponse) Reset() { *m = QueryAggregatePre func (m *QueryAggregatePrevoteResponse) String() string { return proto.CompactTextString(m) } func (*QueryAggregatePrevoteResponse) ProtoMessage() {} func (*QueryAggregatePrevoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{14} + return fileDescriptor_16aef2382d1249a8, []int{13} } func (m *QueryAggregatePrevoteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -684,7 +645,7 @@ func (m *QueryAggregatePrevotesRequest) Reset() { *m = QueryAggregatePre func (m *QueryAggregatePrevotesRequest) String() string { return proto.CompactTextString(m) } func (*QueryAggregatePrevotesRequest) ProtoMessage() {} func (*QueryAggregatePrevotesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{15} + return fileDescriptor_16aef2382d1249a8, []int{14} } func (m *QueryAggregatePrevotesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -725,7 +686,7 @@ func (m *QueryAggregatePrevotesResponse) Reset() { *m = QueryAggregatePr func (m *QueryAggregatePrevotesResponse) String() string { return proto.CompactTextString(m) } func (*QueryAggregatePrevotesResponse) ProtoMessage() {} func (*QueryAggregatePrevotesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{16} + return fileDescriptor_16aef2382d1249a8, []int{15} } func (m *QueryAggregatePrevotesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -772,7 +733,7 @@ func (m *QueryAggregateVoteRequest) Reset() { *m = QueryAggregateVoteReq func (m *QueryAggregateVoteRequest) String() string { return proto.CompactTextString(m) } func (*QueryAggregateVoteRequest) ProtoMessage() {} func (*QueryAggregateVoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{17} + return fileDescriptor_16aef2382d1249a8, []int{16} } func (m *QueryAggregateVoteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -813,7 +774,7 @@ func (m *QueryAggregateVoteResponse) Reset() { *m = QueryAggregateVoteRe func (m *QueryAggregateVoteResponse) String() string { return proto.CompactTextString(m) } func (*QueryAggregateVoteResponse) ProtoMessage() {} func (*QueryAggregateVoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{18} + return fileDescriptor_16aef2382d1249a8, []int{17} } func (m *QueryAggregateVoteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -858,7 +819,7 @@ func (m *QueryAggregateVotesRequest) Reset() { *m = QueryAggregateVotesR func (m *QueryAggregateVotesRequest) String() string { return proto.CompactTextString(m) } func (*QueryAggregateVotesRequest) ProtoMessage() {} func (*QueryAggregateVotesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{19} + return fileDescriptor_16aef2382d1249a8, []int{18} } func (m *QueryAggregateVotesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -899,7 +860,7 @@ func (m *QueryAggregateVotesResponse) Reset() { *m = QueryAggregateVotes func (m *QueryAggregateVotesResponse) String() string { return proto.CompactTextString(m) } func (*QueryAggregateVotesResponse) ProtoMessage() {} func (*QueryAggregateVotesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{20} + return fileDescriptor_16aef2382d1249a8, []int{19} } func (m *QueryAggregateVotesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -943,7 +904,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{21} + return fileDescriptor_16aef2382d1249a8, []int{20} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -982,7 +943,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_16aef2382d1249a8, []int{22} + return fileDescriptor_16aef2382d1249a8, []int{21} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1022,7 +983,6 @@ func init() { proto.RegisterType((*QueryExchangeRateRequest)(nil), "nibiru.oracle.v1.QueryExchangeRateRequest") proto.RegisterType((*QueryExchangeRateResponse)(nil), "nibiru.oracle.v1.QueryExchangeRateResponse") proto.RegisterType((*QueryExchangeRatesRequest)(nil), "nibiru.oracle.v1.QueryExchangeRatesRequest") - proto.RegisterType((*QueryDatedExchangeRateResponse)(nil), "nibiru.oracle.v1.QueryDatedExchangeRateResponse") proto.RegisterType((*QueryExchangeRatesResponse)(nil), "nibiru.oracle.v1.QueryExchangeRatesResponse") proto.RegisterType((*QueryActivesRequest)(nil), "nibiru.oracle.v1.QueryActivesRequest") proto.RegisterType((*QueryActivesResponse)(nil), "nibiru.oracle.v1.QueryActivesResponse") @@ -1047,84 +1007,80 @@ func init() { func init() { proto.RegisterFile("nibiru/oracle/v1/query.proto", fileDescriptor_16aef2382d1249a8) } var fileDescriptor_16aef2382d1249a8 = []byte{ - // 1218 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x98, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0x3d, 0x4d, 0x9a, 0xc2, 0x73, 0x1c, 0x9c, 0x21, 0x08, 0xd7, 0x4d, 0xec, 0x74, 0x69, - 0xa2, 0x34, 0x3f, 0x76, 0x49, 0x52, 0x15, 0x05, 0x8a, 0x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 0x72, - 0x28, 0xf1, 0x87, 0x30, 0x12, 0xda, 0x00, 0x7c, 0x41, 0xd1, 0x33, 0xe6, 0x36, 0x8a, 0x33, 0x27, - 0x64, 0x49, 0xa2, 0x19, 0x41, 0x54, 0xc6, 0x53, 0xca, 0x87, 0x4c, 0x58, 0x8f, 0x6b, 0x0f, 0x0e, - 0x4b, 0xe8, 0xe1, 0x61, 0x09, 0xfd, 0x79, 0x58, 0x42, 0x9f, 0x1f, 0x95, 0x32, 0x0f, 0x8f, 0x4a, - 0x99, 0xdf, 0x8e, 0x4a, 0x99, 0x1b, 0x46, 0x8a, 0x9f, 0x4a, 0xb2, 0xa6, 0xf8, 0x69, 0x5c, 0x1b, - 0x11, 0x7f, 0x86, 0x58, 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, 0xb7, 0xc9, 0xcd, 0x87, 0x2b, 0x11, - 0x00, 0x00, + // 1166 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x97, 0xcf, 0x6f, 0x1b, 0x45, + 0x1b, 0xc7, 0x3d, 0x4d, 0xde, 0xf4, 0xe5, 0x71, 0x9c, 0x3a, 0x43, 0x10, 0xae, 0x9b, 0xd8, 0xe9, + 0xd2, 0x44, 0x69, 0x93, 0xec, 0x92, 0xa4, 0x2a, 0x0a, 0x14, 0x41, 0x7e, 0x50, 0x51, 0xd4, 0x40, + 0x30, 0x51, 0x84, 0x7a, 0xb1, 0xc6, 0xeb, 0xe9, 0x66, 0x55, 0x7b, 0xd7, 0xdd, 0x19, 0x9b, 0x46, + 0x85, 0x4b, 0x05, 0x88, 0x23, 0x12, 0x42, 0xdc, 0xa0, 0x17, 0x24, 0xc4, 0x19, 0xb8, 0x97, 0x53, + 0x8f, 0x95, 0xb8, 0x20, 0x0e, 0x05, 0x25, 0x1c, 0xf8, 0x33, 0xd0, 0xce, 0x8e, 0xd7, 0xbb, 0x5e, + 0x8f,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a2, 0xd2, 0xcb, 0xff, 0xff, 0xec, 0x41, 0x39, 0xf3, 0xd7, + 0x83, 0x72, 0x46, 0x7b, 0x88, 0xe0, 0xec, 0x80, 0xc6, 0xac, 0xe5, 0x3a, 0x8c, 0xe2, 0xf7, 0x20, + 0x47, 0xe5, 0x7a, 0xd5, 0x23, 0x9c, 0x4a, 0x04, 0x5d, 0x22, 0xcc, 0x47, 0x10, 0xe4, 0x7c, 0xc1, + 0x9f, 0x65, 0x56, 0xbf, 0x6d, 0xf0, 0xc3, 0x16, 0x65, 0xfa, 0x36, 0x35, 0x2b, 0xe3, 0x34, 0x52, + 0x1c, 0x2f, 0x01, 0xae, 0x35, 0x5c, 0xf3, 0x76, 0x95, 0xdb, 0x4d, 0xca, 0x38, 0x69, 0xb6, 0xaa, + 0x4d, 0x56, 0x38, 0x35, 0x8b, 0x16, 0x46, 0x2a, 0x79, 0x11, 0xd9, 0xeb, 0x06, 0x76, 0x18, 0x3e, + 0x0f, 0xe3, 0x41, 0xf6, 0x01, 0xb5, 0xad, 0x03, 0x5e, 0x18, 0x99, 0x45, 0x0b, 0xa3, 0x95, 0xac, + 0x58, 0x7b, 0x53, 0x2c, 0x69, 0xe7, 0x06, 0x8c, 0xc0, 0xa4, 0x78, 0xda, 0xc7, 0x08, 0x8a, 0x83, + 0xa2, 0x72, 0xc2, 0x5b, 0x30, 0x11, 0x9b, 0x90, 0x15, 0xd0, 0xec, 0xc8, 0x42, 0x76, 0xf5, 0x05, + 0xbd, 0x7f, 0x57, 0xe8, 0xd1, 0x02, 0x7b, 0xed, 0x56, 0x83, 0x6e, 0x16, 0x7d, 0x1d, 0xbe, 0xff, + 0xbd, 0x8c, 0x13, 0x21, 0x56, 0xc9, 0x45, 0x67, 0x66, 0xda, 0x73, 0xf0, 0xac, 0xa0, 0xd8, 0x30, + 0xb9, 0xdd, 0xe9, 0xd1, 0x39, 0x30, 0x15, 0x5f, 0x96, 0x58, 0xfb, 0x70, 0x9a, 0x04, 0x4b, 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x6e, 0xe5, 0x17, 0xd3, 0x3f, 0x20, 0xc7, 0xb8, 0x2a, 0xc6, 0xb8, 0x82, + 0x2f, 0x9f, 0x3c, 0x46, 0xd2, 0xf6, 0xf1, 0x8f, 0x08, 0x72, 0x31, 0xff, 0x52, 0x5e, 0x50, 0x83, + 0x9c, 0x5c, 0x79, 0x41, 0x0d, 0x34, 0x6a, 0xed, 0xba, 0x40, 0xdd, 0xc2, 0x1b, 0x6a, 0xd4, 0xba, + 0x7d, 0xa2, 0xe2, 0x42, 0xee, 0xef, 0x10, 0x4c, 0xc4, 0x7d, 0x17, 0xa7, 0x62, 0x09, 0x85, 0x5e, + 0x4e, 0x99, 0x2d, 0xd1, 0xd7, 0x05, 0xfa, 0x1a, 0x5e, 0xf9, 0x27, 0x2a, 0x07, 0x12, 0x7f, 0x08, + 0x63, 0x81, 0xbd, 0xe2, 0x0b, 0x8a, 0x9e, 0x31, 0x17, 0x2f, 0xce, 0x9d, 0x90, 0x25, 0x89, 0xe6, + 0x04, 0x51, 0x19, 0xcf, 0x28, 0x2f, 0x32, 0x61, 0xe9, 0xd7, 0x1f, 0x1d, 0x95, 0xd0, 0xe3, 0xa3, + 0x12, 0xfa, 0xe3, 0xa8, 0x84, 0x3e, 0x3f, 0x2e, 0x65, 0x1e, 0x1f, 0x97, 0x32, 0xbf, 0x1e, 0x97, + 0x32, 0x37, 0x8d, 0x14, 0x9f, 0x20, 0xb2, 0xa6, 0xf8, 0x2c, 0xad, 0x8d, 0x89, 0xcf, 0xee, 0xb5, + 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x14, 0xd6, 0x3e, 0x1e, 0x1b, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1139,12 +1095,11 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // ExchangeRate returns exchange rate of a pair + // ExchangeRate returns exchange rate of a pair along with the block height and + // block time that the exchange rate was set by the oracle module. ExchangeRate(ctx context.Context, in *QueryExchangeRateRequest, opts ...grpc.CallOption) (*QueryExchangeRateResponse, error) // ExchangeRateTwap returns twap exchange rate of a pair ExchangeRateTwap(ctx context.Context, in *QueryExchangeRateRequest, opts ...grpc.CallOption) (*QueryExchangeRateResponse, error) - // DatedExchangeRate returns latest price of a pair - DatedExchangeRate(ctx context.Context, in *QueryExchangeRateRequest, opts ...grpc.CallOption) (*QueryDatedExchangeRateResponse, error) // ExchangeRates returns exchange rates of all pairs ExchangeRates(ctx context.Context, in *QueryExchangeRatesRequest, opts ...grpc.CallOption) (*QueryExchangeRatesResponse, error) // Actives returns all active pairs @@ -1193,15 +1148,6 @@ func (c *queryClient) ExchangeRateTwap(ctx context.Context, in *QueryExchangeRat return out, nil } -func (c *queryClient) DatedExchangeRate(ctx context.Context, in *QueryExchangeRateRequest, opts ...grpc.CallOption) (*QueryDatedExchangeRateResponse, error) { - out := new(QueryDatedExchangeRateResponse) - err := c.cc.Invoke(ctx, "/nibiru.oracle.v1.Query/DatedExchangeRate", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) ExchangeRates(ctx context.Context, in *QueryExchangeRatesRequest, opts ...grpc.CallOption) (*QueryExchangeRatesResponse, error) { out := new(QueryExchangeRatesResponse) err := c.cc.Invoke(ctx, "/nibiru.oracle.v1.Query/ExchangeRates", in, out, opts...) @@ -1294,12 +1240,11 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . // QueryServer is the server API for Query service. type QueryServer interface { - // ExchangeRate returns exchange rate of a pair + // ExchangeRate returns exchange rate of a pair along with the block height and + // block time that the exchange rate was set by the oracle module. ExchangeRate(context.Context, *QueryExchangeRateRequest) (*QueryExchangeRateResponse, error) // ExchangeRateTwap returns twap exchange rate of a pair ExchangeRateTwap(context.Context, *QueryExchangeRateRequest) (*QueryExchangeRateResponse, error) - // DatedExchangeRate returns latest price of a pair - DatedExchangeRate(context.Context, *QueryExchangeRateRequest) (*QueryDatedExchangeRateResponse, error) // ExchangeRates returns exchange rates of all pairs ExchangeRates(context.Context, *QueryExchangeRatesRequest) (*QueryExchangeRatesResponse, error) // Actives returns all active pairs @@ -1332,9 +1277,6 @@ func (*UnimplementedQueryServer) ExchangeRate(ctx context.Context, req *QueryExc func (*UnimplementedQueryServer) ExchangeRateTwap(ctx context.Context, req *QueryExchangeRateRequest) (*QueryExchangeRateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ExchangeRateTwap not implemented") } -func (*UnimplementedQueryServer) DatedExchangeRate(ctx context.Context, req *QueryExchangeRateRequest) (*QueryDatedExchangeRateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DatedExchangeRate not implemented") -} func (*UnimplementedQueryServer) ExchangeRates(ctx context.Context, req *QueryExchangeRatesRequest) (*QueryExchangeRatesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ExchangeRates not implemented") } @@ -1406,24 +1348,6 @@ func _Query_ExchangeRateTwap_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } -func _Query_DatedExchangeRate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryExchangeRateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DatedExchangeRate(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/nibiru.oracle.v1.Query/DatedExchangeRate", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DatedExchangeRate(ctx, req.(*QueryExchangeRateRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_ExchangeRates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryExchangeRatesRequest) if err := dec(in); err != nil { @@ -1616,10 +1540,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "ExchangeRateTwap", Handler: _Query_ExchangeRateTwap_Handler, }, - { - MethodName: "DatedExchangeRate", - Handler: _Query_DatedExchangeRate_Handler, - }, { MethodName: "ExchangeRates", Handler: _Query_ExchangeRates_Handler, @@ -1718,6 +1638,16 @@ func (m *QueryExchangeRateResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l + if m.BlockHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BlockHeight)) + i-- + dAtA[i] = 0x18 + } + if m.BlockTimestampMs != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BlockTimestampMs)) + i-- + dAtA[i] = 0x10 + } { size := m.ExchangeRate.Size() i -= size @@ -1754,49 +1684,6 @@ func (m *QueryExchangeRatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *QueryDatedExchangeRateResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryDatedExchangeRateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDatedExchangeRateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.BlockHeight != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.BlockHeight)) - i-- - dAtA[i] = 0x18 - } - if m.BlockTimestampMs != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.BlockTimestampMs)) - i-- - dAtA[i] = 0x10 - } - { - size := m.Price.Size() - i -= size - if _, err := m.Price.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - func (m *QueryExchangeRatesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2404,32 +2291,21 @@ func (m *QueryExchangeRateResponse) Size() (n int) { _ = l l = m.ExchangeRate.Size() n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryExchangeRatesRequest) Size() (n int) { - if m == nil { - return 0 + if m.BlockTimestampMs != 0 { + n += 1 + sovQuery(uint64(m.BlockTimestampMs)) + } + if m.BlockHeight != 0 { + n += 1 + sovQuery(uint64(m.BlockHeight)) } - var l int - _ = l return n } -func (m *QueryDatedExchangeRateResponse) Size() (n int) { +func (m *QueryExchangeRatesRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.Price.Size() - n += 1 + l + sovQuery(uint64(l)) - if m.BlockTimestampMs != 0 { - n += 1 + sovQuery(uint64(m.BlockTimestampMs)) - } - if m.BlockHeight != 0 { - n += 1 + sovQuery(uint64(m.BlockHeight)) - } return n } @@ -2816,56 +2692,44 @@ func (m *QueryExchangeRateResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockTimestampMs", wireType) } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryExchangeRatesRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery + m.BlockTimestampMs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockTimestampMs |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - if iNdEx >= l { - return io.ErrUnexpectedEOF + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + m.BlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryExchangeRatesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryExchangeRatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -2887,7 +2751,7 @@ func (m *QueryExchangeRatesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDatedExchangeRateResponse) Unmarshal(dAtA []byte) error { +func (m *QueryExchangeRatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2910,84 +2774,12 @@ func (m *QueryDatedExchangeRateResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDatedExchangeRateResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryExchangeRatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDatedExchangeRateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryExchangeRatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Price.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockTimestampMs", wireType) - } - m.BlockTimestampMs = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlockTimestampMs |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) - } - m.BlockHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlockHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/oracle/types/query.pb.gw.go b/x/oracle/types/query.pb.gw.go index c9436368d..f8af1a4f8 100644 --- a/x/oracle/types/query.pb.gw.go +++ b/x/oracle/types/query.pb.gw.go @@ -105,42 +105,6 @@ func local_request_Query_ExchangeRateTwap_0(ctx context.Context, marshaler runti } -var ( - filter_Query_DatedExchangeRate_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_DatedExchangeRate_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryExchangeRateRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DatedExchangeRate_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.DatedExchangeRate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_DatedExchangeRate_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryExchangeRateRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DatedExchangeRate_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.DatedExchangeRate(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_ExchangeRates_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryExchangeRatesRequest var metadata runtime.ServerMetadata @@ -517,29 +481,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_DatedExchangeRate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_DatedExchangeRate_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_DatedExchangeRate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_ExchangeRates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -851,26 +792,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_DatedExchangeRate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_DatedExchangeRate_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_DatedExchangeRate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_ExchangeRates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1079,8 +1000,6 @@ var ( pattern_Query_ExchangeRateTwap_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"nibiru", "oracle", "v1beta1", "exchange_rate_twap"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_DatedExchangeRate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"nibiru", "oracle", "v1beta1", "dated_exchange_rate"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_ExchangeRates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"nibiru", "oracle", "v1beta1", "pairs", "exchange_rates"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Actives_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"nibiru", "oracle", "v1beta1", "pairs", "actives"}, "", runtime.AssumeColonVerbOpt(false))) @@ -1107,8 +1026,6 @@ var ( forward_Query_ExchangeRateTwap_0 = runtime.ForwardResponseMessage - forward_Query_DatedExchangeRate_0 = runtime.ForwardResponseMessage - forward_Query_ExchangeRates_0 = runtime.ForwardResponseMessage forward_Query_Actives_0 = runtime.ForwardResponseMessage