diff --git a/.github/workflows/buf_breaking.yml b/.github/workflows/buf_breaking.yml deleted file mode 100644 index 00a14ed3..00000000 --- a/.github/workflows/buf_breaking.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Proto Breaking - -on: - pull_request: - branches: [ main ] - paths: - - proto/** - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: bufbuild/buf-setup-action@v1 - with: - version: "1.39.0" - # Run breaking change detection for Protobuf sources against the current - # `main` branch, 'proto' subdirectory - - uses: bufbuild/buf-breaking-action@v1 - with: - input: proto - against: https://github.com/skip-mev/connect.git#branch=main,ref=HEAD~1,subdir=proto diff --git a/.github/workflows/buf_push.yml b/.github/workflows/buf_push.yml deleted file mode 100644 index 3c3304f9..00000000 --- a/.github/workflows/buf_push.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: BSR Push - -on: - # Apply to pushes on 'main' branch that affect the 'proto' directory - push: - branches: - - main - paths: - - proto/** -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: bufbuild/buf-setup-action@v1 - with: - version: "1.39.0" - - uses: bufbuild/buf-push-action@v1 - with: - input: proto - buf_token: ${{ secrets.BUF_TOKEN }} diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml new file mode 100644 index 00000000..2c82ff47 --- /dev/null +++ b/.github/workflows/proto.yml @@ -0,0 +1,33 @@ +name: Protobuf +# Runs buf (https://buf.build/) checks and pushes to BSR +# PR: runs lint, format, and breaking change detection +# Push to main/tags: pushes to BSR +# Delete branch/tag: archives corresponding BSR labels + +on: + push: + branches: + - main + tags: + - 'v*' + pull_request: + paths: + - "proto/**" + - ".github/workflows/proto.yml" + delete: + +permissions: + contents: read + pull-requests: write + +jobs: + buf-build: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v6 + - uses: bufbuild/buf-action@v1 + with: + input: proto + token: ${{ secrets.BUF_TOKEN }} + # breaking defaults to PR-only; not set explicitly to avoid running on push events diff --git a/Makefile b/Makefile index 9b81bef5..704bd2de 100644 --- a/Makefile +++ b/Makefile @@ -213,7 +213,7 @@ test-cover: tidy ### Protobuf ### ############################################################################### -protoVer=0.15.1 +protoVer=0.16.0 protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) diff --git a/proto/buf.yaml b/proto/buf.yaml index 883e9ec9..3784922f 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -1,5 +1,6 @@ +# This module represents buf.build/initia-labs/connect version: v1 -name: buf.build/skip-mev/connect +name: buf.build/initia-labs/connect deps: - buf.build/cosmos/cosmos-proto @@ -11,12 +12,16 @@ breaking: - FILE lint: use: - - DEFAULT + - STANDARD - COMMENTS - FILE_LOWER_SNAKE_CASE except: - SERVICE_SUFFIX - RPC_REQUEST_STANDARD_NAME + - RPC_RESPONSE_STANDARD_NAME - COMMENT_FIELD - FIELD_LOWER_SNAKE_CASE - PACKAGE_DIRECTORY_MATCH + # excluded to avoid breaking changes on existing enum values + - ENUM_VALUE_PREFIX + - ENUM_ZERO_VALUE_SUFFIX diff --git a/proto/connect/marketmap/module/v2/module.proto b/proto/connect/marketmap/module/v2/module.proto index f1821332..be05e38c 100644 --- a/proto/connect/marketmap/module/v2/module.proto +++ b/proto/connect/marketmap/module/v2/module.proto @@ -6,9 +6,7 @@ import "cosmos/app/v1alpha1/module.proto"; // Module is the config object of the builder module. message Module { - option (cosmos.app.v1alpha1.module) = { - go_import : "github.com/skip-mev/connect/v2/x/marketmap" - }; + option (cosmos.app.v1alpha1.module) = {go_import: "github.com/skip-mev/connect/v2/x/marketmap"}; // Authority defines the custom module authority. If not set, defaults to the // governance module. @@ -18,4 +16,4 @@ message Module { // of module names which provide a marketmap hooks instance. If no order is // provided, then hooks will be applied in alphabetical order of module names. repeated string hooks_order = 2; -} \ No newline at end of file +} diff --git a/proto/connect/marketmap/v2/genesis.proto b/proto/connect/marketmap/v2/genesis.proto index f45dfd21..0a6cb916 100644 --- a/proto/connect/marketmap/v2/genesis.proto +++ b/proto/connect/marketmap/v2/genesis.proto @@ -1,9 +1,9 @@ syntax = "proto3"; package connect.marketmap.v2; -import "gogoproto/gogo.proto"; import "connect/marketmap/v2/market.proto"; import "connect/marketmap/v2/params.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/skip-mev/connect/v2/x/marketmap/types"; @@ -11,7 +11,7 @@ option go_package = "github.com/skip-mev/connect/v2/x/marketmap/types"; message GenesisState { // MarketMap defines the global set of market configurations for all providers // and markets. - MarketMap market_map = 1 [ (gogoproto.nullable) = false ]; + MarketMap market_map = 1 [(gogoproto.nullable) = false]; // LastUpdated is the last block height that the market map was updated. // This field can be used as an optimization for clients checking if there @@ -19,5 +19,5 @@ message GenesisState { uint64 last_updated = 2; // Params are the parameters for the x/marketmap module. - Params params = 3 [ (gogoproto.nullable) = false ]; + Params params = 3 [(gogoproto.nullable) = false]; } diff --git a/proto/connect/marketmap/v2/market.proto b/proto/connect/marketmap/v2/market.proto index f376310a..47cc8aa8 100644 --- a/proto/connect/marketmap/v2/market.proto +++ b/proto/connect/marketmap/v2/market.proto @@ -1,10 +1,10 @@ syntax = "proto3"; package connect.marketmap.v2; -option go_package = "github.com/skip-mev/connect/v2/x/marketmap/types"; - -import "gogoproto/gogo.proto"; import "connect/types/v2/currency_pair.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/skip-mev/connect/v2/x/marketmap/types"; // Market encapsulates a Ticker and its provider-specific configuration. message Market { @@ -14,10 +14,10 @@ message Market { // Ticker represents a price feed for a given asset pair i.e. BTC/USD. The // price feed is scaled to a number of decimal places and has a minimum number // of providers required to consider the ticker valid. - Ticker ticker = 1 [ (gogoproto.nullable) = false ]; + Ticker ticker = 1 [(gogoproto.nullable) = false]; // ProviderConfigs is the list of provider-specific configs for this Market. - repeated ProviderConfig provider_configs = 2 [ (gogoproto.nullable) = false ]; + repeated ProviderConfig provider_configs = 2 [(gogoproto.nullable) = false]; } // Ticker represents a price feed for a given asset pair i.e. BTC/USD. The price @@ -28,8 +28,7 @@ message Ticker { option (gogoproto.stringer) = false; // CurrencyPair is the currency pair for this ticker. - connect.types.v2.CurrencyPair currency_pair = 1 - [ (gogoproto.nullable) = false ]; + connect.types.v2.CurrencyPair currency_pair = 1 [(gogoproto.nullable) = false]; // Decimals is the number of decimal places for the ticker. The number of // decimal places is used to convert the price to a human-readable format. @@ -48,6 +47,7 @@ message Ticker { string metadata_JSON = 15; } +// ProviderConfig defines the configuration for a given provider. message ProviderConfig { // Name corresponds to the name of the provider for which the configuration is // being set. @@ -80,5 +80,5 @@ message MarketMap { // Markets is the full list of tickers and their associated configurations // to be stored on-chain. - map markets = 1 [ (gogoproto.nullable) = false ]; + map markets = 1 [(gogoproto.nullable) = false]; } diff --git a/proto/connect/marketmap/v2/query.proto b/proto/connect/marketmap/v2/query.proto index 5ffaeace..05f90bf0 100644 --- a/proto/connect/marketmap/v2/query.proto +++ b/proto/connect/marketmap/v2/query.proto @@ -1,11 +1,11 @@ syntax = "proto3"; package connect.marketmap.v2; -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "connect/types/v2/currency_pair.proto"; import "connect/marketmap/v2/market.proto"; import "connect/marketmap/v2/params.proto"; +import "connect/types/v2/currency_pair.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; option go_package = "github.com/skip-mev/connect/v2/x/marketmap/types"; @@ -15,39 +15,29 @@ service Query { // module. NOTE: the value returned by this query is not safe for on-chain // code. rpc MarketMap(MarketMapRequest) returns (MarketMapResponse) { - option (google.api.http) = { - get : "/connect/marketmap/v2/marketmap" - }; + option (google.api.http) = {get: "/connect/marketmap/v2/marketmap"}; } - // Market returns all stored in the x/marketmap + // Markets returns all markets stored in the x/marketmap // module as a sorted list. rpc Markets(MarketsRequest) returns (MarketsResponse) { - option (google.api.http) = { - get : "/connect/marketmap/v2/markets" - }; + option (google.api.http) = {get: "/connect/marketmap/v2/markets"}; } // Market returns a market stored in the x/marketmap // module. rpc Market(MarketRequest) returns (MarketResponse) { - option (google.api.http) = { - get : "/connect/marketmap/v2/market" - }; + option (google.api.http) = {get: "/connect/marketmap/v2/market"}; } // LastUpdated returns the last height the market map was updated at. rpc LastUpdated(LastUpdatedRequest) returns (LastUpdatedResponse) { - option (google.api.http) = { - get : "/connect/marketmap/v2/last_updated" - }; + option (google.api.http) = {get: "/connect/marketmap/v2/last_updated"}; } // Params returns the current x/marketmap module parameters. rpc Params(ParamsRequest) returns (ParamsResponse) { - option (google.api.http) = { - get : "/connect/marketmap/v2/params" - }; + option (google.api.http) = {get: "/connect/marketmap/v2/params"}; } } @@ -59,7 +49,7 @@ message MarketMapRequest {} message MarketMapResponse { // MarketMap defines the global set of market configurations for all providers // and markets. - MarketMap market_map = 1 [ (gogoproto.nullable) = false ]; + MarketMap market_map = 1 [(gogoproto.nullable) = false]; // LastUpdated is the last block height that the market map was updated. // This field can be used as an optimization for clients checking if there @@ -76,7 +66,7 @@ message MarketsRequest {} // MarketsResponse is the query response for the Markets query. message MarketsResponse { // Markets is a sorted list of all markets in the module. - repeated Market markets = 1 [ (gogoproto.nullable) = false ]; + repeated Market markets = 1 [(gogoproto.nullable) = false]; } // MarketRequest is the query request for the Market query. @@ -84,21 +74,22 @@ message MarketsResponse { message MarketRequest { // CurrencyPair is the currency pair associated with the market being // requested. - connect.types.v2.CurrencyPair currency_pair = 1 - [ (gogoproto.nullable) = false ]; + connect.types.v2.CurrencyPair currency_pair = 1 [(gogoproto.nullable) = false]; } // MarketResponse is the query response for the Market query. message MarketResponse { // Market is the configuration of a single market to be price-fetched for. - Market market = 1 [ (gogoproto.nullable) = false ]; + Market market = 1 [(gogoproto.nullable) = false]; } // ParamsRequest is the request type for the Query/Params RPC method. message ParamsRequest {} // ParamsResponse is the response type for the Query/Params RPC method. -message ParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; } +message ParamsResponse { + Params params = 1 [(gogoproto.nullable) = false]; +} // LastUpdatedRequest is the request type for the Query/LastUpdated RPC // method. @@ -106,4 +97,6 @@ message LastUpdatedRequest {} // LastUpdatedResponse is the response type for the Query/LastUpdated RPC // method. -message LastUpdatedResponse { uint64 last_updated = 1; } \ No newline at end of file +message LastUpdatedResponse { + uint64 last_updated = 1; +} diff --git a/proto/connect/marketmap/v2/tx.proto b/proto/connect/marketmap/v2/tx.proto index 294ed9d0..e86b7de5 100644 --- a/proto/connect/marketmap/v2/tx.proto +++ b/proto/connect/marketmap/v2/tx.proto @@ -1,12 +1,12 @@ syntax = "proto3"; package connect.marketmap.v2; -import "cosmos/msg/v1/msg.proto"; -import "gogoproto/gogo.proto"; -import "cosmos_proto/cosmos.proto"; import "amino/amino.proto"; import "connect/marketmap/v2/market.proto"; import "connect/marketmap/v2/params.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/skip-mev/connect/v2/x/marketmap/types"; @@ -26,8 +26,7 @@ service Msg { // RemoveMarketAuthorities defines a method for removing market authorities // from the x/marketmap module. the signer must be the admin. - rpc RemoveMarketAuthorities(MsgRemoveMarketAuthorities) - returns (MsgRemoveMarketAuthoritiesResponse); + rpc RemoveMarketAuthorities(MsgRemoveMarketAuthorities) returns (MsgRemoveMarketAuthoritiesResponse); // UpsertMarkets wraps both Create / Update markets into a single message. // Specifically if a market does not exist it will be created, otherwise it @@ -50,11 +49,11 @@ message MsgUpsertMarkets { // Authority is the signer of this transaction. This authority must be // authorized by the module to execute the message. - string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // CreateMarkets is the list of all markets to be created for the given // transaction. - repeated Market markets = 2 [ (gogoproto.nullable) = false ]; + repeated Market markets = 2 [(gogoproto.nullable) = false]; } // MsgUpsertMarketsResponse is the response from the UpsertMarkets API in the @@ -64,7 +63,7 @@ message MsgUpsertMarketsResponse { // UpdatedMarkets is a map between the ticker and whether the market was // updated. // Deprecated: This field will be empty in all responses. - map market_updates = 1 [ deprecated = true ]; + map market_updates = 1 [deprecated = true]; } // MsgCreateMarkets defines a message carrying a payload for creating markets in @@ -77,14 +76,14 @@ message MsgCreateMarkets { // Authority is the signer of this transaction. This authority must be // authorized by the module to execute the message. - string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // CreateMarkets is the list of all markets to be created for the given // transaction. - repeated Market create_markets = 2 [ (gogoproto.nullable) = false ]; + repeated Market create_markets = 2 [(gogoproto.nullable) = false]; } -// MsgUpdateMarketMapResponse is the response message for MsgUpdateMarketMap. +// MsgCreateMarketsResponse is the response message for MsgCreateMarkets. message MsgCreateMarketsResponse {} // MsgUpdateMarkets defines a message carrying a payload for updating the @@ -97,11 +96,11 @@ message MsgUpdateMarkets { // Authority is the signer of this transaction. This authority must be // authorized by the module to execute the message. - string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // UpdateMarkets is the list of all markets to be updated for the given // transaction. - repeated Market update_markets = 2 [ (gogoproto.nullable) = false ]; + repeated Market update_markets = 2 [(gogoproto.nullable) = false]; } // MsgUpdateMarketsResponse is the response message for MsgUpdateMarkets. @@ -113,10 +112,10 @@ message MsgParams { option (cosmos.msg.v1.signer) = "authority"; // Params defines the new parameters for the x/marketmap module. - Params params = 1 [ (gogoproto.nullable) = false ]; + Params params = 1 [(gogoproto.nullable) = false]; // Authority defines the authority that is updating the x/marketmap module // parameters. - string authority = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string authority = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } // MsgParamsResponse defines the Msg/Params response type. @@ -133,7 +132,7 @@ message MsgRemoveMarketAuthorities { // Admin defines the authority that is the x/marketmap // Admin account. This account is set in the module parameters. - string admin = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string admin = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } // MsgRemoveMarketAuthoritiesResponse defines the @@ -147,7 +146,7 @@ message MsgRemoveMarkets { // Authority is the signer of this transaction. This authority must be // authorized by the module to execute the message. - string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // Markets is the list of markets to remove. repeated string markets = 2; diff --git a/proto/connect/oracle/module/v2/module.proto b/proto/connect/oracle/module/v2/module.proto index e1a7ed5d..311caf80 100644 --- a/proto/connect/oracle/module/v2/module.proto +++ b/proto/connect/oracle/module/v2/module.proto @@ -6,11 +6,9 @@ import "cosmos/app/v1alpha1/module.proto"; // Module is the config object of the builder module. message Module { - option (cosmos.app.v1alpha1.module) = { - go_import : "github.com/skip-mev/connect/v2/x/oracle" - }; + option (cosmos.app.v1alpha1.module) = {go_import: "github.com/skip-mev/connect/v2/x/oracle"}; // Authority defines the custom module authority. If not set, defaults to the // governance module. string authority = 1; -} \ No newline at end of file +} diff --git a/proto/connect/oracle/v2/genesis.proto b/proto/connect/oracle/v2/genesis.proto index e6953e7a..6514e788 100644 --- a/proto/connect/oracle/v2/genesis.proto +++ b/proto/connect/oracle/v2/genesis.proto @@ -1,12 +1,12 @@ syntax = "proto3"; package connect.oracle.v2; -option go_package = "github.com/skip-mev/connect/v2/x/oracle/types"; - +import "connect/types/v2/currency_pair.proto"; +import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; -import "cosmos_proto/cosmos.proto"; -import "connect/types/v2/currency_pair.proto"; + +option go_package = "github.com/skip-mev/connect/v2/x/oracle/types"; // QuotePrice is the representation of the aggregated prices for a CurrencyPair, // where price represents the price of Base in terms of Quote @@ -20,8 +20,10 @@ message QuotePrice { // BlockTimestamp tracks the block height associated with this price update. // We include block timestamp alongside the price to ensure that smart // contracts and applications are not utilizing stale oracle prices - google.protobuf.Timestamp block_timestamp = 2 - [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + google.protobuf.Timestamp block_timestamp = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; // BlockHeight is height of block mentioned above uint64 block_height = 3; @@ -32,7 +34,7 @@ message QuotePrice { message CurrencyPairState { // QuotePrice is the latest price for a currency-pair, notice this value can // be null in the case that no price exists for the currency-pair - QuotePrice price = 1 [ (gogoproto.nullable) = true ]; + QuotePrice price = 1 [(gogoproto.nullable) = true]; // Nonce is the number of updates this currency-pair has received uint64 nonce = 2; @@ -45,11 +47,10 @@ message CurrencyPairState { // CurrencyPair. message CurrencyPairGenesis { // The CurrencyPair to be added to module state - connect.types.v2.CurrencyPair currency_pair = 1 - [ (gogoproto.nullable) = false ]; + connect.types.v2.CurrencyPair currency_pair = 1 [(gogoproto.nullable) = false]; // A genesis price if one exists (note this will be empty, unless it results // from forking the state of this module) - QuotePrice currency_pair_price = 2 [ (gogoproto.nullable) = true ]; + QuotePrice currency_pair_price = 2 [(gogoproto.nullable) = true]; // nonce is the nonce (number of updates) for the CP (same case as above, // likely 0 unless it results from fork of module) uint64 nonce = 3; @@ -63,8 +64,7 @@ message GenesisState { // CurrencyPairGenesis is the set of CurrencyPairGeneses for the module. I.e // the starting set of CurrencyPairs for the module + information regarding // their latest update. - repeated CurrencyPairGenesis currency_pair_genesis = 1 - [ (gogoproto.nullable) = false ]; + repeated CurrencyPairGenesis currency_pair_genesis = 1 [(gogoproto.nullable) = false]; // NextID is the next ID to be used for a CurrencyPair uint64 next_id = 2; diff --git a/proto/connect/oracle/v2/query.proto b/proto/connect/oracle/v2/query.proto index 10cf7476..95bf52df 100644 --- a/proto/connect/oracle/v2/query.proto +++ b/proto/connect/oracle/v2/query.proto @@ -1,66 +1,60 @@ syntax = "proto3"; package connect.oracle.v2; -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; + import "connect/oracle/v2/genesis.proto"; import "connect/types/v2/currency_pair.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; option go_package = "github.com/skip-mev/connect/v2/x/oracle/types"; // Query is the query service for the x/oracle module. service Query { // Get all the currency pairs the x/oracle module is tracking price-data for. - rpc GetAllCurrencyPairs(GetAllCurrencyPairsRequest) - returns (GetAllCurrencyPairsResponse) { - option (google.api.http) = { - get : "/connect/oracle/v2/get_all_tickers" - }; - }; + rpc GetAllCurrencyPairs(GetAllCurrencyPairsRequest) returns (GetAllCurrencyPairsResponse) { + option (google.api.http) = {get: "/connect/oracle/v2/get_all_tickers"}; + } // Given a CurrencyPair (or its identifier) return the latest QuotePrice for // that CurrencyPair. rpc GetPrice(GetPriceRequest) returns (GetPriceResponse) { - option (google.api.http) = { - get : "/connect/oracle/v2/get_price" - }; - }; + option (google.api.http) = {get: "/connect/oracle/v2/get_price"}; + } + // GetPrices returns the prices for the given currency pairs. rpc GetPrices(GetPricesRequest) returns (GetPricesResponse) { - option (google.api.http) = { - get : "/connect/oracle/v2/get_prices" - }; + option (google.api.http) = {get: "/connect/oracle/v2/get_prices"}; } // Get the mapping of currency pair ID -> currency pair. This is useful for // indexers that have access to the ID of a currency pair, but no way to get // the underlying currency pair from it. - rpc GetCurrencyPairMapping(GetCurrencyPairMappingRequest) - returns (GetCurrencyPairMappingResponse) { + rpc GetCurrencyPairMapping(GetCurrencyPairMappingRequest) returns (GetCurrencyPairMappingResponse) { option (google.api.http) = { - get : "/connect/oracle/v2/get_currency_pair_mapping" - additional_bindings : [] + get: "/connect/oracle/v2/get_currency_pair_mapping" + additional_bindings: [] }; } // Get the mapping of currency pair ID <-> currency pair as a list. This is // useful for indexers that have access to the ID of a currency pair, but no // way to get the underlying currency pair from it. - rpc GetCurrencyPairMappingList(GetCurrencyPairMappingListRequest) - returns (GetCurrencyPairMappingListResponse) { + rpc GetCurrencyPairMappingList(GetCurrencyPairMappingListRequest) returns (GetCurrencyPairMappingListResponse) { option (google.api.http) = { - get : "/connect/oracle/v2/get_currency_pair_mapping_list" - additional_bindings : [] + get: "/connect/oracle/v2/get_currency_pair_mapping_list" + additional_bindings: [] }; } } +// GetAllCurrencyPairsRequest is the request type for the GetAllCurrencyPairs +// RPC method. message GetAllCurrencyPairsRequest {} // GetAllCurrencyPairsResponse returns all CurrencyPairs that the module is // currently tracking. message GetAllCurrencyPairsResponse { - repeated connect.types.v2.CurrencyPair currency_pairs = 1 - [ (gogoproto.nullable) = false ]; + repeated connect.types.v2.CurrencyPair currency_pairs = 1 [(gogoproto.nullable) = false]; } // GetPriceRequest takes an identifier for the @@ -75,7 +69,7 @@ message GetPriceRequest { message GetPriceResponse { // QuotePrice represents the quote-price for the CurrencyPair given in // GetPriceRequest (possibly nil if no update has been made) - QuotePrice price = 1 [ (gogoproto.nullable) = true ]; + QuotePrice price = 1 [(gogoproto.nullable) = true]; // nonce represents the nonce for the CurrencyPair if it exists in state uint64 nonce = 2; // decimals represents the number of decimals that the quote-price is @@ -87,12 +81,14 @@ message GetPriceResponse { // GetPricesRequest takes an identifier for the CurrencyPair // in the format base/quote. -message GetPricesRequest { repeated string currency_pair_ids = 1; } +message GetPricesRequest { + repeated string currency_pair_ids = 1; +} // GetPricesResponse is the response from the GetPrices grpc method exposed from // the x/oracle query service. message GetPricesResponse { - repeated GetPriceResponse prices = 1 [ (gogoproto.nullable) = false ]; + repeated GetPriceResponse prices = 1 [(gogoproto.nullable) = false]; } // GetCurrencyPairMappingRequest is the GetCurrencyPairMapping request type. @@ -102,24 +98,23 @@ message GetCurrencyPairMappingRequest {} message GetCurrencyPairMappingResponse { // currency_pair_mapping is a mapping of the id representing the currency pair // to the currency pair itself. - map currency_pair_mapping = 1 - [ (gogoproto.nullable) = false ]; + map currency_pair_mapping = 1 [(gogoproto.nullable) = false]; } // GetCurrencyPairMappingRequest is the GetCurrencyPairMapping request type. message GetCurrencyPairMappingListRequest {} +// CurrencyPairMapping defines a mapping between an ID and a CurrencyPair. message CurrencyPairMapping { // ID is the unique identifier for this currency pair string. uint64 id = 1; // CurrencyPair is the human-readable representation of the currency pair. - connect.types.v2.CurrencyPair currency_pair = 2 - [ (gogoproto.nullable) = false ]; + connect.types.v2.CurrencyPair currency_pair = 2 [(gogoproto.nullable) = false]; } // GetCurrencyPairMappingResponse is the GetCurrencyPairMapping response type. message GetCurrencyPairMappingListResponse { // mappings is a list of the id representing the currency pair // to the currency pair itself. - repeated CurrencyPairMapping mappings = 1 [ (gogoproto.nullable) = false ]; + repeated CurrencyPairMapping mappings = 1 [(gogoproto.nullable) = false]; } diff --git a/proto/connect/oracle/v2/tx.proto b/proto/connect/oracle/v2/tx.proto index 2af9f608..fc3057be 100644 --- a/proto/connect/oracle/v2/tx.proto +++ b/proto/connect/oracle/v2/tx.proto @@ -1,12 +1,11 @@ syntax = "proto3"; package connect.oracle.v2; -import "connect/oracle/v2/genesis.proto"; -import "cosmos_proto/cosmos.proto"; -import "cosmos/msg/v1/msg.proto"; import "amino/amino.proto"; -import "gogoproto/gogo.proto"; import "connect/types/v2/currency_pair.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/skip-mev/connect/v2/x/oracle/types"; @@ -17,14 +16,12 @@ service Msg { // AddCurrencyPairs will be used only by governance to update the set of // available CurrencyPairs. Given a set of CurrencyPair objects, update // the available currency pairs in the module . - rpc AddCurrencyPairs(MsgAddCurrencyPairs) - returns (MsgAddCurrencyPairsResponse); + rpc AddCurrencyPairs(MsgAddCurrencyPairs) returns (MsgAddCurrencyPairsResponse); // RemoveCurrencyPairs will be used explicitly by governance to remove the // given set of currency-pairs from the module's state. Thus these // CurrencyPairs will no longer have price-data available from this module. - rpc RemoveCurrencyPairs(MsgRemoveCurrencyPairs) - returns (MsgRemoveCurrencyPairsResponse); + rpc RemoveCurrencyPairs(MsgRemoveCurrencyPairs) returns (MsgRemoveCurrencyPairsResponse); } // Given an authority + a set of CurrencyPairs, the x/oracle module will @@ -39,13 +36,14 @@ message MsgAddCurrencyPairs { // authority is the address of the account that is authorized to update the // x/oracle's CurrencyPairs - string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // set of CurrencyPairs to be added to the module (+ prices if they are to be // set) - repeated connect.types.v2.CurrencyPair currency_pairs = 2 - [ (gogoproto.nullable) = false ]; + repeated connect.types.v2.CurrencyPair currency_pairs = 2 [(gogoproto.nullable) = false]; } +// MsgAddCurrencyPairsResponse is the response type for the AddCurrencyPairs +// RPC method. message MsgAddCurrencyPairsResponse {} // Given an authority + a set of CurrencyPairIDs, the x/oracle module's message @@ -61,11 +59,13 @@ message MsgRemoveCurrencyPairs { // authority is the address of the account that is authorized to update the // x/oracle's CurrencyPairs - string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // currency_pair_ids are the stringified representation of a currency-pairs // (base/quote) to be removed from the module's state repeated string currency_pair_ids = 2; } +// MsgRemoveCurrencyPairsResponse is the response type for the +// RemoveCurrencyPairs RPC method. message MsgRemoveCurrencyPairsResponse {} diff --git a/proto/connect/service/v2/oracle.proto b/proto/connect/service/v2/oracle.proto index 6d8c5115..0ccf0c84 100644 --- a/proto/connect/service/v2/oracle.proto +++ b/proto/connect/service/v2/oracle.proto @@ -1,11 +1,10 @@ syntax = "proto3"; package connect.service.v2; +import "connect/marketmap/v2/market.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "google/protobuf/timestamp.proto"; -import "cosmos_proto/cosmos.proto"; -import "connect/marketmap/v2/market.proto"; option go_package = "github.com/skip-mev/connect/v2/service/servers/oracle/types"; @@ -13,25 +12,19 @@ option go_package = "github.com/skip-mev/connect/v2/service/servers/oracle/types service Oracle { // Prices defines a method for fetching the latest prices. rpc Prices(QueryPricesRequest) returns (QueryPricesResponse) { - option (google.api.http) = { - get : "/connect/oracle/v2/prices" - }; + option (google.api.http) = {get: "/connect/oracle/v2/prices"}; } // MarketMap defines a method for fetching the latest market map // configuration. rpc MarketMap(QueryMarketMapRequest) returns (QueryMarketMapResponse) { - option (google.api.http) = { - get : "/connect/oracle/v2/marketmap" - }; + option (google.api.http) = {get: "/connect/oracle/v2/marketmap"}; } // Version defines a method for fetching the current version of the oracle // service. rpc Version(QueryVersionRequest) returns (QueryVersionResponse) { - option (google.api.http) = { - get : "/connect/oracle/v2/version" - }; + option (google.api.http) = {get: "/connect/oracle/v2/version"}; } } @@ -41,11 +34,13 @@ message QueryPricesRequest {} // QueryPricesResponse defines the response type for the Prices method. message QueryPricesResponse { // Prices defines the list of prices. - map prices = 1 [ (gogoproto.nullable) = false ]; + map prices = 1 [(gogoproto.nullable) = false]; // Timestamp defines the timestamp of the prices. - google.protobuf.Timestamp timestamp = 2 - [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + google.protobuf.Timestamp timestamp = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; // Version defines the version of the oracle service that provided the prices. string version = 3; @@ -67,4 +62,4 @@ message QueryVersionRequest {} message QueryVersionResponse { // Version defines the current version of the oracle service. string version = 1; -} \ No newline at end of file +}