From 3597fc7b5859f830221b0f4dbe59bb6c797d060e Mon Sep 17 00:00:00 2001 From: matthiasmatt Date: Tue, 29 Oct 2024 17:32:48 +0100 Subject: [PATCH] feat: use ctx to get timestamp for query --- app/wasmext/stargate_query.go | 1 + proto/nibiru/oracle/v1/query.proto | 3 + .../contracts/IOracle.sol/IChainlink.json | 122 +++++++++++ .../contracts/IOracle.sol/IOracle.json | 16 +- x/evm/embeds/contracts/IOracle.sol | 44 +++- x/evm/precompile/oracle.go | 4 +- x/evm/precompile/oracle_test.go | 8 +- x/oracle/keeper/keeper.go | 21 +- x/oracle/keeper/querier.go | 4 +- x/oracle/types/query.pb.go | 189 +++++++++++------- 10 files changed, 311 insertions(+), 101 deletions(-) create mode 100644 x/evm/embeds/artifacts/contracts/IOracle.sol/IChainlink.json diff --git a/app/wasmext/stargate_query.go b/app/wasmext/stargate_query.go index 2d90b6d58..bd1567175 100644 --- a/app/wasmext/stargate_query.go +++ b/app/wasmext/stargate_query.go @@ -120,6 +120,7 @@ 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/proto/nibiru/oracle/v1/query.proto b/proto/nibiru/oracle/v1/query.proto index 5d2ec1d61..1ca087a5e 100644 --- a/proto/nibiru/oracle/v1/query.proto +++ b/proto/nibiru/oracle/v1/query.proto @@ -131,6 +131,9 @@ message QueryDatedExchangeRateResponse { // milliseconds since unix epoch int64 timestamp_ms = 2; + + // height of the block + uint64 height = 3; } // QueryExchangeRatesResponse is response type for the diff --git a/x/evm/embeds/artifacts/contracts/IOracle.sol/IChainlink.json b/x/evm/embeds/artifacts/contracts/IOracle.sol/IChainlink.json new file mode 100644 index 000000000..9125be661 --- /dev/null +++ b/x/evm/embeds/artifacts/contracts/IOracle.sol/IChainlink.json @@ -0,0 +1,122 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "IChainlink", + "sourceName": "contracts/IOracle.sol", + "abi": [ + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "description", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint80", + "name": "_roundId", + "type": "uint80" + } + ], + "name": "getRoundData", + "outputs": [ + { + "internalType": "uint80", + "name": "roundId", + "type": "uint80" + }, + { + "internalType": "int256", + "name": "answer", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "startedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAt", + "type": "uint256" + }, + { + "internalType": "uint80", + "name": "answeredInRound", + "type": "uint80" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "latestRoundData", + "outputs": [ + { + "internalType": "uint80", + "name": "roundId", + "type": "uint80" + }, + { + "internalType": "int256", + "name": "answer", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "startedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAt", + "type": "uint256" + }, + { + "internalType": "uint80", + "name": "answeredInRound", + "type": "uint80" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/x/evm/embeds/artifacts/contracts/IOracle.sol/IOracle.json b/x/evm/embeds/artifacts/contracts/IOracle.sol/IOracle.json index 39638bdae..887d9433c 100644 --- a/x/evm/embeds/artifacts/contracts/IOracle.sol/IOracle.json +++ b/x/evm/embeds/artifacts/contracts/IOracle.sol/IOracle.json @@ -14,9 +14,19 @@ "name": "queryExchangeRate", "outputs": [ { - "internalType": "string", - "name": "", - "type": "string" + "internalType": "uint256", + "name": "price", + "type": "uint256" + }, + { + "internalType": "uint64", + "name": "blockTimeMs", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "blockHeight", + "type": "uint64" } ], "stateMutability": "view", diff --git a/x/evm/embeds/contracts/IOracle.sol b/x/evm/embeds/contracts/IOracle.sol index 72b24d443..9bc49224d 100644 --- a/x/evm/embeds/contracts/IOracle.sol +++ b/x/evm/embeds/contracts/IOracle.sol @@ -6,12 +6,50 @@ interface IOracle { /// @notice Queries the dated exchange rate for a given pair /// @param pair The asset pair to query. For example, "ubtc:uusd" is the /// USD price of BTC and "unibi:uusd" is the USD price of NIBI. - /// @return The exchange rate (a decimal value) as a string and the block - /// at which it was cerated. + /// @return price The exchange rate for the given pair + /// @return blockTimeMs The block time in milliseconds when the price was + /// last updated + /// @return blockHeight The block height when the price was last updated /// @dev This function is view-only and does not modify state. function queryExchangeRate( string memory pair - ) external view returns (string memory, uint256); + ) + external + view + returns (uint256 price, uint64 blockTimeMs, uint64 blockHeight); +} + +// solhint-disable-next-line interface-starts-with-i +interface IChainlink { + function decimals() external view returns (uint8); + + function description() external view returns (string memory); + + function version() external view returns (uint256); + + function getRoundData( + uint80 _roundId + ) + external + view + returns ( + uint80 roundId, + int256 answer, + uint256 startedAt, + uint256 updatedAt, + uint80 answeredInRound + ); + + function latestRoundData() + external + view + returns ( + uint80 roundId, + int256 answer, + uint256 startedAt, + uint256 updatedAt, + uint80 answeredInRound + ); } address constant ORACLE_PRECOMPILE_ADDRESS = 0x0000000000000000000000000000000000000801; diff --git a/x/evm/precompile/oracle.go b/x/evm/precompile/oracle.go index 052ec424b..6cc2e6dc3 100644 --- a/x/evm/precompile/oracle.go +++ b/x/evm/precompile/oracle.go @@ -80,12 +80,12 @@ func (p precompileOracle) queryExchangeRate( return nil, err } - price, err := p.oracleKeeper.GetDatedExchangeRate(ctx, assetPair) + price, blockTime, blockHeight, err := p.oracleKeeper.GetDatedExchangeRate(ctx, assetPair) if err != nil { return nil, err } - return method.Outputs.Pack(price.String()) + return method.Outputs.Pack(price.BigInt(), uint64(blockTime), blockHeight) } func (p precompileOracle) decomposeQueryExchangeRateArgs(args []any) ( diff --git a/x/evm/precompile/oracle_test.go b/x/evm/precompile/oracle_test.go index b2bf6e364..fa07d72d6 100644 --- a/x/evm/precompile/oracle_test.go +++ b/x/evm/precompile/oracle_test.go @@ -1,7 +1,9 @@ package precompile_test import ( + "math/big" "testing" + "time" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" @@ -55,7 +57,9 @@ func (s *OracleSuite) TestOracle_HappyPath() { 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")) + input, err := embeds.SmartContract_Oracle.ABI.Pack("queryExchangeRate", "unibi:uusd") s.NoError(err) resp, _, err := deps.EvmKeeper.CallContractWithInput( @@ -68,7 +72,9 @@ func (s *OracleSuite) TestOracle_HappyPath() { s.NoError(err) // Check the response - s.Equal("exchange_rate:\"67000000000000000\" created_block:1 ", out[0].(string)) + s.Equal(out[0].(*big.Int), big.NewInt(67000000000000000)) + s.Equal(out[1].(uint64), uint64(69000)) + s.Equal(out[2].(uint64), uint64(69)) } } diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index 34e59ea8b..bbbf31ce9 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -187,21 +187,14 @@ func (k Keeper) GetExchangeRate(ctx sdk.Context, pair asset.Pair) (price sdk.Dec return } -func (k Keeper) GetDatedExchangeRate(ctx sdk.Context, pair asset.Pair) (exchangeRate types.PriceSnapshot, err error) { - iterator := k.PriceSnapshots.Iterate( - ctx, - collections.PairRange[asset.Pair, time.Time]{}. - Prefix(pair). - Descending(), - ) - defer iterator.Close() - - if iterator.Valid() { - exchangeRate = iterator.Value() - return exchangeRate, nil - } else { - return types.PriceSnapshot{}, types.ErrInvalidExchangeRate.Wrapf("no snapshots for pair %s", pair.String()) +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. diff --git a/x/oracle/keeper/querier.go b/x/oracle/keeper/querier.go index 8b862f9d9..3e57faa56 100644 --- a/x/oracle/keeper/querier.go +++ b/x/oracle/keeper/querier.go @@ -86,11 +86,11 @@ func (q querier) DatedExchangeRate(c context.Context, req *types.QueryExchangeRa } ctx := sdk.UnwrapSDKContext(c) - snapshot, err := q.Keeper.GetDatedExchangeRate(ctx, req.Pair) + price, blockTime, blockHeight, err := q.Keeper.GetDatedExchangeRate(ctx, req.Pair) if err != nil { return &types.QueryDatedExchangeRateResponse{}, err } - return &types.QueryDatedExchangeRateResponse{Price: snapshot.Price, TimestampMs: snapshot.TimestampMs}, nil + return &types.QueryDatedExchangeRateResponse{Price: price, TimestampMs: blockTime, Height: blockHeight}, nil } // ExchangeRates queries exchange rates of all pairs diff --git a/x/oracle/types/query.pb.go b/x/oracle/types/query.pb.go index a68647872..ab67f6a83 100644 --- a/x/oracle/types/query.pb.go +++ b/x/oracle/types/query.pb.go @@ -156,6 +156,8 @@ 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"` // milliseconds since unix epoch TimestampMs int64 `protobuf:"varint,2,opt,name=timestamp_ms,json=timestampMs,proto3" json:"timestamp_ms,omitempty"` + // height of the block + Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` } func (m *QueryDatedExchangeRateResponse) Reset() { *m = QueryDatedExchangeRateResponse{} } @@ -198,6 +200,13 @@ func (m *QueryDatedExchangeRateResponse) GetTimestampMs() int64 { return 0 } +func (m *QueryDatedExchangeRateResponse) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + // QueryExchangeRatesResponse is response type for the // Query/ExchangeRates RPC method. type QueryExchangeRatesResponse struct { @@ -1036,82 +1045,83 @@ func init() { func init() { proto.RegisterFile("nibiru/oracle/v1/query.proto", fileDescriptor_16aef2382d1249a8) } var fileDescriptor_16aef2382d1249a8 = []byte{ - // 1188 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x98, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0x3d, 0xfd, 0x91, 0xc2, 0x73, 0x1c, 0x9c, 0x21, 0x88, 0xd4, 0x4d, 0xec, 0x74, 0x69, - 0xa2, 0x34, 0x3f, 0x76, 0x49, 0x52, 0x15, 0x05, 0x8a, 0x20, 0x3f, 0xa8, 0x54, 0xd4, 0x40, 0x30, - 0x55, 0x84, 0x7a, 0xb1, 0x26, 0xeb, 0xa9, 0xb3, 0x22, 0xde, 0xdd, 0xee, 0x8c, 0x4d, 0xa3, 0xc2, - 0xa5, 0x02, 0x04, 0x37, 0x24, 0x84, 0xb8, 0x41, 0x2f, 0x48, 0x88, 0x33, 0x70, 0xe7, 0xd6, 0x63, - 0x25, 0x2e, 0x88, 0x43, 0x41, 0x09, 0x07, 0xc4, 0x5f, 0x81, 0x76, 0x66, 0xbc, 0xd9, 0xf5, 0x7a, - 0xe4,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0xae, 0x9f, - 0x0a, 0x8f, 0x49, 0xb5, 0x48, 0xba, 0x5a, 0x19, 0x15, 0x0d, 0x43, 0x74, 0x22, 0x3f, 0xe9, 0x3c, - 0x23, 0x3d, 0x32, 0x14, 0xa6, 0x0d, 0x38, 0x85, 0xd9, 0xb9, 0xc2, 0x83, 0x71, 0x8e, 0x76, 0x73, - 0x32, 0xe3, 0xba, 0x7a, 0xeb, 0xa2, 0xaf, 0x77, 0x9e, 0x44, 0xfb, 0xb6, 0x7a, 0x8f, 0xba, 0xaa, - 0xa9, 0x0d, 0xbd, 0x07, 0x23, 0xc7, 0x1b, 0x8a, 0x89, 0x3e, 0x9f, 0x71, 0x33, 0x3b, 0xc7, 0x3b, - 0x29, 0x90, 0x78, 0x07, 0x63, 0xa2, 0x57, 0xdf, 0x48, 0xeb, 0x03, 0x38, 0xd7, 0x33, 0xaa, 0xb0, - 0x6e, 0xc2, 0x33, 0x49, 0xac, 0x8e, 0xc8, 0x03, 0x70, 0x8d, 0x24, 0xb8, 0x98, 0x31, 0x06, 0x58, - 0xb4, 0xde, 0x26, 0x01, 0x69, 0x46, 0x40, 0x5b, 0xea, 0xc1, 0xec, 0xac, 0x2a, 0x90, 0xcb, 0x30, - 0xe4, 0x8b, 0x15, 0xa5, 0xcb, 0x78, 0xba, 0xbf, 0xfc, 0x42, 0x35, 0x53, 0xd9, 0xcb, 0xff, 0x14, - 0xe1, 0xb4, 0xa8, 0x87, 0xbf, 0x42, 0x30, 0x1c, 0x27, 0xc3, 0x73, 0xe9, 0x12, 0xba, 0x21, 0x5e, - 0x9a, 0xcf, 0x94, 0x2b, 0x59, 0x8d, 0x85, 0x7b, 0xbf, 0xfe, 0xf5, 0xe5, 0x89, 0x19, 0x7c, 0xc1, - 0xea, 0x76, 0x15, 0xd2, 0x38, 0x24, 0x06, 0x0f, 0xfe, 0x06, 0x41, 0x31, 0x31, 0x47, 0x3e, 0x20, - 0xfe, 0xff, 0xc7, 0xb6, 0x24, 0xd8, 0x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 0x05, 0xd6, 0x18, - 0x0f, 0xad, 0xc0, 0x3a, 0x5b, 0x61, 0x5c, 0x17, 0xd8, 0x57, 0xf1, 0xe6, 0x00, 0xd8, 0xa9, 0x41, - 0x8f, 0x7f, 0x44, 0x30, 0x9a, 0xf2, 0x06, 0x38, 0x2b, 0x14, 0xeb, 0xf7, 0x2c, 0x69, 0x6d, 0x87, - 0x71, 0x45, 0x6c, 0xe3, 0x32, 0xbe, 0xd4, 0x7f, 0x1b, 0x69, 0x7b, 0x82, 0x7f, 0x42, 0x50, 0x48, - 0xcc, 0x59, 0xed, 0x03, 0xd5, 0xcb, 0x71, 0x68, 0x1f, 0xa8, 0x9e, 0x86, 0xc2, 0xb8, 0x26, 0x50, - 0x37, 0xf0, 0x9a, 0x1e, 0xb5, 0xee, 0xf4, 0x55, 0x5c, 0xc8, 0xfd, 0x3d, 0x82, 0x91, 0xa4, 0x3f, - 0xc0, 0x99, 0x58, 0x22, 0xa1, 0x17, 0x33, 0x66, 0x2b, 0xf4, 0x55, 0x81, 0xbe, 0x82, 0x97, 0x1e, - 0x47, 0x65, 0x29, 0xf1, 0x87, 0x30, 0x24, 0x6d, 0x00, 0xbe, 0xa0, 0xe9, 0x99, 0x70, 0x1b, 0xa5, - 0xe9, 0x3e, 0x59, 0x8a, 0x68, 0x5a, 0x10, 0x55, 0xf0, 0xa4, 0xf6, 0x21, 0x13, 0xd6, 0xe3, 0xda, - 0x83, 0xc3, 0x32, 0x7a, 0x78, 0x58, 0x46, 0x7f, 0x1e, 0x96, 0xd1, 0x17, 0x47, 0xe5, 0xdc, 0xc3, - 0xa3, 0x72, 0xee, 0xb7, 0xa3, 0x72, 0xee, 0xa6, 0x95, 0xe1, 0xa7, 0x92, 0xaa, 0x29, 0x7e, 0xec, - 0xee, 0x0e, 0x89, 0x3f, 0x2c, 0xac, 0xfc, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x68, 0x3f, 0xbc, - 0xfd, 0x10, 0x00, 0x00, + // 1208 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x98, 0xcd, 0x6f, 0x1b, 0xc5, + 0x1b, 0xc7, 0x3d, 0x4d, 0x9a, 0xfe, 0x7e, 0x8f, 0xe3, 0xe0, 0x0c, 0x01, 0x5c, 0x37, 0xb1, 0xd3, + 0xa5, 0x89, 0xd2, 0xbc, 0xec, 0x92, 0xa4, 0x2a, 0x0a, 0x14, 0x41, 0x5e, 0xa8, 0x54, 0xd4, 0x40, + 0x30, 0x55, 0x84, 0x7a, 0xb1, 0x26, 0xeb, 0xe9, 0x66, 0x45, 0xbc, 0xbb, 0xdd, 0x19, 0x9b, 0x46, + 0x85, 0x4b, 0x05, 0x88, 0x23, 0x12, 0x42, 0xdc, 0xa0, 0x1c, 0x90, 0x10, 0x67, 0xe0, 0xce, 0xad, + 0xc7, 0x4a, 0x5c, 0x10, 0x87, 0x82, 0x12, 0x0e, 0x88, 0xbf, 0x02, 0xed, 0xec, 0x78, 0xb3, 0xeb, + 0xf5, 0xc8, 0x5b, 0x17, 0x4e, 0x6d, 0xe7, 0x99, 0x7d, 0x9e, 0xcf, 0xf3, 0xd5, 0xcc, 0x3c, 0x5f, + 0x17, 0x26, 0x1d, 0x7b, 0xcf, 0xf6, 0x5b, 0x86, 0xeb, 0x13, 0xf3, 0x80, 0x1a, 0xed, 0x65, 0xe3, + 0x76, 0x8b, 0xfa, 0x87, 0xba, 0xe7, 0xbb, 0xdc, 0xc5, 0xc5, 0x30, 0xaa, 0x87, 0x51, 0xbd, 0xbd, + 0x5c, 0x9e, 0xb0, 0x5c, 0xcb, 0x15, 0x41, 0x23, 0xf8, 0x5b, 0xb8, 0xaf, 0x3c, 0x69, 0xb9, 0xae, + 0x75, 0x40, 0x0d, 0xe2, 0xd9, 0x06, 0x71, 0x1c, 0x97, 0x13, 0x6e, 0xbb, 0x0e, 0x93, 0xd1, 0xa9, + 0x54, 0x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0x41, 0xb8, 0xeb, + 0xd7, 0x49, 0xa3, 0x21, 0xaf, 0x57, 0xad, 0x10, 0xad, 0xae, 0x37, 0x1a, 0xf1, 0x9b, 0xf2, 0x1a, + 0x4c, 0x29, 0x12, 0xca, 0x96, 0xaa, 0x90, 0xbf, 0x25, 0x62, 0xf1, 0x74, 0x10, 0x2e, 0x05, 0xb9, + 0xb4, 0x37, 0xa4, 0x54, 0xdb, 0x36, 0x63, 0x9b, 0x6e, 0xcb, 0xe1, 0xd4, 0x1f, 0x98, 0xe6, 0x15, + 0xa9, 0x6d, 0x22, 0x97, 0x04, 0x39, 0x0f, 0xa3, 0x4d, 0x9b, 0xb1, 0xba, 0x19, 0xae, 0x8b, 0x54, + 0xc3, 0xb5, 0x7c, 0xf3, 0x64, 0x6b, 0xa4, 0xce, 0xba, 0x65, 0xf9, 0x41, 0x1f, 0x74, 0xc7, 0xa7, + 0x81, 0x7a, 0x03, 0xf3, 0xdc, 0x43, 0x52, 0x9e, 0x74, 0x46, 0x49, 0x45, 0x60, 0x9c, 0x74, 0x62, + 0x75, 0x2f, 0x0c, 0x8a, 0xac, 0xf9, 0x15, 0x3d, 0x7d, 0x35, 0xa2, 0x34, 0xf1, 0x8b, 0x20, 0x53, + 0x6e, 0x0c, 0x07, 0xc7, 0xa4, 0x56, 0x24, 0x5d, 0xa5, 0xb4, 0xaa, 0x82, 0x21, 0x3a, 0x91, 0x1f, + 0x77, 0x9e, 0x97, 0x1e, 0x3b, 0x24, 0xa6, 0x09, 0x38, 0x85, 0xd9, 0xb9, 0xc2, 0x83, 0x71, 0x8e, + 0x77, 0x73, 0x32, 0xed, 0xba, 0x7c, 0x03, 0xa3, 0xaf, 0x77, 0x9f, 0x44, 0xfb, 0xb6, 0x7c, 0x8f, + 0xba, 0xb2, 0xc9, 0x86, 0xde, 0x85, 0xb1, 0x93, 0x86, 0x62, 0xa2, 0x2f, 0x64, 0x6c, 0x66, 0xf7, + 0xa4, 0x93, 0x02, 0x89, 0x57, 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0xd4, 0x4d, 0xbc, 0xae, 0x46, 0x6d, 0xd8, 0x7d, 0x15, 0x17, 0x72, 0x7f, 0x87, 0x60, + 0x2c, 0xe9, 0x0f, 0x70, 0x26, 0x96, 0x48, 0xe8, 0xa5, 0x8c, 0xbb, 0x25, 0xfa, 0x9a, 0x40, 0x5f, + 0xc5, 0xcb, 0x8f, 0xa3, 0x72, 0x28, 0xf1, 0x07, 0x30, 0x12, 0xda, 0x00, 0x7c, 0x41, 0x51, 0x33, + 0xe1, 0x36, 0xca, 0x33, 0x7d, 0x76, 0x49, 0xa2, 0x19, 0x41, 0x54, 0xc5, 0x53, 0xca, 0x87, 0x4c, + 0x58, 0x8f, 0x6b, 0x0f, 0x8e, 0x2a, 0xe8, 0xe1, 0x51, 0x05, 0xfd, 0x71, 0x54, 0x41, 0x9f, 0x1d, + 0x57, 0x72, 0x0f, 0x8f, 0x2b, 0xb9, 0x5f, 0x8f, 0x2b, 0xb9, 0x9b, 0x46, 0x86, 0x9f, 0x4a, 0x32, + 0xa7, 0xf8, 0x11, 0xbc, 0x37, 0x22, 0xfe, 0xc3, 0x61, 0xf5, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x37, 0x5a, 0x6e, 0x93, 0x15, 0x11, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1761,6 +1771,11 @@ func (m *QueryDatedExchangeRateResponse) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 + } if m.TimestampMs != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.TimestampMs)) i-- @@ -2409,6 +2424,9 @@ func (m *QueryDatedExchangeRateResponse) Size() (n int) { if m.TimestampMs != 0 { n += 1 + sovQuery(uint64(m.TimestampMs)) } + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } return n } @@ -2948,6 +2966,25 @@ func (m *QueryDatedExchangeRateResponse) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:])