From a1d833cde898464e67dc48d1b195d2e4f12ba643 Mon Sep 17 00:00:00 2001 From: godlin Date: Thu, 7 Dec 2023 14:00:26 +0100 Subject: [PATCH] Featured Osmosis Enhanced Starter --- Osmosis/osmosis-starter-enhanced/.gitignore | 59 +++++ Osmosis/osmosis-starter-enhanced/LICENSE | 21 ++ Osmosis/osmosis-starter-enhanced/README.md | 94 +++++++ .../docker-compose.yml | 64 +++++ .../docker/load-extensions.sh | 5 + .../docker/pg-Dockerfile | 12 + Osmosis/osmosis-starter-enhanced/package.json | 38 +++ Osmosis/osmosis-starter-enhanced/project.ts | 100 +++++++ .../proto/cosmos/base/v1beta1/coin.proto | 43 ++++ .../cosmos/base/abci/v1beta1/abci.proto | 144 +++++++++++ .../cosmos/cosmos/base/kv/v1beta1/kv.proto | 17 ++ .../base/query/v1beta1/pagination.proto | 55 ++++ .../base/reflection/v1beta1/reflection.proto | 44 ++++ .../base/reflection/v2alpha1/reflection.proto | 218 ++++++++++++++++ .../base/snapshots/v1beta1/snapshot.proto | 57 ++++ .../base/store/v1beta1/commit_info.proto | 29 +++ .../cosmos/base/store/v1beta1/listening.proto | 16 ++ .../base/tendermint/v1beta1/query.proto | 138 ++++++++++ .../cosmos/cosmos/base/v1beta1/coin.proto | 40 +++ .../proto/cosmos/gov/v1beta1/genesis.proto | 26 ++ .../proto/cosmos/gov/v1beta1/gov.proto | 200 ++++++++++++++ .../proto/cosmos/gov/v1beta1/query.proto | 190 ++++++++++++++ .../proto/cosmos/gov/v1beta1/tx.proto | 99 +++++++ .../proto/cosmos/slashing/v1beta1/gogo.proto | 144 +++++++++++ .../proto/cosmos/slashing/v1beta1/msg.proto | 22 ++ .../proto/cosmos/slashing/v1beta1/query.proto | 64 +++++ .../cosmos/slashing/v1beta1/slashing.proto | 45 ++++ .../proto/cosmos/slashing/v1beta1/tx.proto | 30 +++ .../proto/osmosis/gamm/v1beta1/tx.proto | 243 ++++++++++++++++++ .../poolmanager/v1beta1/swap_route.proto | 38 +++ .../osmosis-starter-enhanced/schema.graphql | 40 +++ Osmosis/osmosis-starter-enhanced/src/index.ts | 2 + .../src/mappings/mappingHandlers.ts | 131 ++++++++++ .../osmosis-starter-enhanced/tsconfig.json | 20 ++ 34 files changed, 2488 insertions(+) create mode 100644 Osmosis/osmosis-starter-enhanced/.gitignore create mode 100644 Osmosis/osmosis-starter-enhanced/LICENSE create mode 100644 Osmosis/osmosis-starter-enhanced/README.md create mode 100644 Osmosis/osmosis-starter-enhanced/docker-compose.yml create mode 100644 Osmosis/osmosis-starter-enhanced/docker/load-extensions.sh create mode 100644 Osmosis/osmosis-starter-enhanced/docker/pg-Dockerfile create mode 100644 Osmosis/osmosis-starter-enhanced/package.json create mode 100644 Osmosis/osmosis-starter-enhanced/project.ts create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/base/v1beta1/coin.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/abci/v1beta1/abci.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/kv/v1beta1/kv.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/query/v1beta1/pagination.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/reflection/v1beta1/reflection.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/reflection/v2alpha1/reflection.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/snapshots/v1beta1/snapshot.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/store/v1beta1/commit_info.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/store/v1beta1/listening.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/tendermint/v1beta1/query.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/v1beta1/coin.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/gov/v1beta1/genesis.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/gov/v1beta1/gov.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/gov/v1beta1/query.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/gov/v1beta1/tx.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/gogo.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/msg.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/query.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/slashing.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/tx.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/osmosis/gamm/v1beta1/tx.proto create mode 100644 Osmosis/osmosis-starter-enhanced/proto/osmosis/poolmanager/v1beta1/swap_route.proto create mode 100644 Osmosis/osmosis-starter-enhanced/schema.graphql create mode 100644 Osmosis/osmosis-starter-enhanced/src/index.ts create mode 100644 Osmosis/osmosis-starter-enhanced/src/mappings/mappingHandlers.ts create mode 100644 Osmosis/osmosis-starter-enhanced/tsconfig.json diff --git a/Osmosis/osmosis-starter-enhanced/.gitignore b/Osmosis/osmosis-starter-enhanced/.gitignore new file mode 100644 index 000000000..af37ddbf4 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/.gitignore @@ -0,0 +1,59 @@ + +# These are some examples of commonly ignored file patterns. +# You should customize this list as applicable to your project. +# Learn more about .gitignore: +# https://www.atlassian.com/git/tutorials/saving-changes/gitignore + +# Node artifact files +node_modules/ +dist/ + +# lock files +yarn.lock +package-lock.json + +# Compiled Java class files +*.class + +# Compiled Python bytecode +*.py[cod] + +# Log files +*.log + +# Package files +*.jar + +# Generated files +target/ +dist/ +src/types +project.yaml + +# JetBrains IDE +.idea/ + +# Unit test reports +TEST*.xml + +# Generated by MacOS +.DS_Store + +# Generated by Windows +Thumbs.db + +# Applications +*.app +*.exe +*.war + +# Large media files +*.mp4 +*.tiff +*.avi +*.flv +*.mov +*.wmv + +.data +dist diff --git a/Osmosis/osmosis-starter-enhanced/LICENSE b/Osmosis/osmosis-starter-enhanced/LICENSE new file mode 100644 index 000000000..76e70ccd3 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/LICENSE @@ -0,0 +1,21 @@ +MIT LICENSE + +Copyright 2020-2021 SubQuery Pte Ltd authors & contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Osmosis/osmosis-starter-enhanced/README.md b/Osmosis/osmosis-starter-enhanced/README.md new file mode 100644 index 000000000..7ebebe22e --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/README.md @@ -0,0 +1,94 @@ +# SubQuery - Enhanced Example Project for Osmosis + +[SubQuery](https://subquery.network) is a fast, flexible, and reliable open-source data indexer that provides you with custom APIs for your web3 project across all of our supported networks. To learn about how to get started with SubQuery, [visit our docs](https://academy.subquery.network). + +**This SubQuery project indexes all swaps on Osmosis' on chain DEX** + +## Start + +First, install SubQuery CLI globally on your terminal by using NPM `npm install -g @subql/cli` + +You can either clone this GitHub repo, or use the `subql` CLI to bootstrap a clean project in the network of your choosing by running `subql init` and following the prompts. + +Don't forget to install dependencies with `npm install` or `yarn install`! + +## Editing your SubQuery project + +Although this is a working example SubQuery project, you can edit the SubQuery project by changing the following files: + +- The project manifest in `project.ts` defines the key project configuration and mapping handler filters +- The GraphQL Schema (`schema.graphql`) defines the shape of the resulting data that you are using SubQuery to index +- The Mapping functions in `src/mappings/` directory are typescript functions that handle transformation logic + +SubQuery supports various layer-1 blockchain networks and provides [dedicated quick start guides](https://academy.subquery.network/quickstart/quickstart.html) as well as [detailed technical documentation](https://academy.subquery.network/build/introduction.html) for each of them. + +## Run your project + +_If you get stuck, find out how to get help below._ + +The simplest way to run your project is by running `yarn dev` or `npm run-script dev`. This does all of the following: + +1. `yarn codegen` - Generates types from the GraphQL schema definition and contract ABIs and saves them in the `/src/types` directory. This must be done after each change to the `schema.graphql` file or the contract ABIs +2. `yarn build` - Builds and packages the SubQuery project into the `/dist` directory +3. `docker-compose pull && docker-compose up` - Runs a Docker container with an indexer, PostgeSQL DB, and a query service. This requires [Docker to be installed](https://docs.docker.com/engine/install) and running locally. The configuration for this container is set from your `docker-compose.yml` + +You can observe the three services start, and once all are running (it may take a few minutes on your first start), please open your browser and head to [http://localhost:3000](http://localhost:3000) - you should see a GraphQL playground showing with the schemas ready to query. [Read the docs for more information](https://academy.subquery.network/run_publish/run.html) or [explore the possible service configuration for running SubQuery](https://academy.subquery.network/run_publish/references.html). + +## Query your project + +For this project, you can try to query with the following GraphQL code to get a taste of how it works. + +```graphql +query { + swaps { + nodes { + id + direction + sender + direction + txHash + blockHeight + message + tokenInDenom + tokenOutDenom + tokenInAmount + tokenOutAmount + tokenOutMin + tokenInMax + datetime + swapRoutes { + nodes { + id + poolId + swapId + tokenInDenom + tokenOutDenom + } + } + } + } +} +``` + +You can explore the different possible queries and entities to help you with GraphQL using the documentation draw on the right. + +## Publish your project + +SubQuery is open-source, meaning you have the freedom to run it in the following three ways: + +- Locally on your own computer (or a cloud provider of your choosing), [view the instructions on how to run SubQuery Locally](https://academy.subquery.network/run_publish/run.html) +- By publishing it to our enterprise-level [Managed Service](https://managedservice.subquery.network), where we'll host your SubQuery project in production ready services for mission critical data with zero-downtime blue/green deployments. We even have a generous free tier. [Find out how](https://academy.subquery.network/run_publish/publish.html) +- [Coming Soon] By publishing it to the decentralised [SubQuery Network](https://subquery.network/network), the most open, performant, reliable, and scalable data service for dApp developers. The SubQuery Network indexes and services data to the global community in an incentivised and verifiable way + +## What Next? + +Take a look at some of our advanced features to take your project to the next level! + +- [**Multi-chain indexing support**](https://academy.subquery.network/build/multi-chain.html) - SubQuery allows you to index data from across different layer-1 networks into the same database, this allows you to query a single endpoint to get data for all supported networks. +- [**Dynamic Data Sources**](https://academy.subquery.network/build/dynamicdatasources.html) - When you want to index factory contracts, for example on a DEX or generative NFT project. +- [**Project Optimisation Advice**](https://academy.subquery.network/build/optimisation.html) - Some common tips on how to tweak your project to maximise performance. +- [**GraphQL Subscriptions**](https://academy.subquery.network/run_publish/subscription.html) - Build more reactive front end applications that subscribe to changes in your SubQuery project. + +## Need Help? + +The fastest way to get support is by [searching our documentation](https://academy.subquery.network), or by [joining our discord](https://discord.com/invite/subquery) and messaging us in the `#technical-support` channel. diff --git a/Osmosis/osmosis-starter-enhanced/docker-compose.yml b/Osmosis/osmosis-starter-enhanced/docker-compose.yml new file mode 100644 index 000000000..c4d169883 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/docker-compose.yml @@ -0,0 +1,64 @@ +version: "3" + +services: + postgres: + build: + context: . + dockerfile: ./docker/pg-Dockerfile + ports: + - 5432:5432 + volumes: + - .data/postgres:/var/lib/postgresql/data + environment: + POSTGRES_PASSWORD: postgres + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 5s + timeout: 5s + retries: 5 + + subquery-node: + image: subquerynetwork/subql-node-cosmos:latest + depends_on: + "postgres": + condition: service_healthy + restart: always + environment: + DB_USER: postgres + DB_PASS: postgres + DB_DATABASE: postgres + DB_HOST: postgres + DB_PORT: 5432 + volumes: + - ./:/app + command: + - ${SUB_COMMAND:-} # set SUB_COMMAND env variable to "test" to run tests + - -f=/app + - --db-schema=app + - --unfinalized-blocks=true + healthcheck: + test: ["CMD", "curl", "-f", "http://subquery-node:3000/ready"] + interval: 3s + timeout: 5s + retries: 10 + + graphql-engine: + image: onfinality/subql-query:latest + ports: + - 3000:3000 + depends_on: + "postgres": + condition: service_healthy + "subquery-node": + condition: service_healthy + restart: always + environment: + DB_USER: postgres + DB_PASS: postgres + DB_DATABASE: postgres + DB_HOST: postgres + DB_PORT: 5432 + command: + - --name=app + - --playground + - --indexer=http://subquery-node:3000 diff --git a/Osmosis/osmosis-starter-enhanced/docker/load-extensions.sh b/Osmosis/osmosis-starter-enhanced/docker/load-extensions.sh new file mode 100644 index 000000000..6d33f8638 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/docker/load-extensions.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <=3.0.0", + }, + query: { + name: "@subql/query", + version: "*", + }, + }, + schema: { + file: "./schema.graphql", + }, + network: { + /* The genesis hash of the network (hash of block 0) */ + chainId: "osmosis-1", + /** + * These endpoint(s) should be non-pruned archive nodes + * Public nodes may be rate limited, which can affect indexing speed + * When developing your project we suggest getting a private API key + * We suggest providing an array of endpoints for increased speed and reliability + */ + endpoint: ["https://rpc.osmosis.zone:443"], + chaintypes: new Map([ + [ + "osmosis.gamm.v1beta1", + { + file: "./proto/osmosis/gamm/v1beta1/tx.proto", + messages: [ + "MsgSwapExactAmountIn", + "MsgSwapExactAmountOut", + "MsgJoinSwapShareAmountOut", + ], + }, + ], + [ + " osmosis.poolmanager.v1beta1", + { + file: "./proto/osmosis/poolmanager/v1beta1/swap_route.proto", + messages: ["SwapAmountOutRoute", "SwapAmountInRoute"], + }, + ], + [ + "cosmos.base.v1beta1", + { + file: "./proto/cosmos/base/v1beta1/coin.proto", + messages: ["Coin"], + }, + ], + ]), + }, + dataSources: [ + { + kind: CosmosDatasourceKind.Runtime, + startBlock: 12670353, + mapping: { + file: "./dist/index.js", + handlers: [ + { + handler: "handleMsgSwapExactAmountIn", + kind: CosmosHandlerKind.Message, + filter: { + type: "/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", + }, + }, + { + handler: "handleMsgSwapExactAmountOut", + kind: CosmosHandlerKind.Message, + filter: { + type: "/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", + }, + }, + { + handler: "handleMsgJoinSwapShareAmountOut", + kind: CosmosHandlerKind.Message, + filter: { + type: "/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", + }, + }, + ], + }, + }, + ], +}; + +// Must set default to the project instance +export default project; diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/base/v1beta1/coin.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/base/v1beta1/coin.proto new file mode 100644 index 000000000..69e67e099 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/base/v1beta1/coin.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; +package cosmos.base.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/types"; +option (gogoproto.goproto_stringer_all) = false; +option (gogoproto.stringer_all) = false; + +// Coin defines a token with a denomination and an amount. +// +// NOTE: The amount field is an Int which implements the custom method +// signatures required by gogoproto. +message Coin { + option (gogoproto.equal) = true; + + string denom = 1; + string amount = 2 + [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; +} + +// DecCoin defines a token with a denomination and a decimal amount. +// +// NOTE: The amount field is an Dec which implements the custom method +// signatures required by gogoproto. +message DecCoin { + option (gogoproto.equal) = true; + + string denom = 1; + string amount = 2 + [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; +} + +// IntProto defines a Protobuf wrapper around an Int object. +message IntProto { + string int = 1 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; +} + +// DecProto defines a Protobuf wrapper around a Dec object. +message DecProto { + string dec = 1 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; +} diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/abci/v1beta1/abci.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/abci/v1beta1/abci.proto new file mode 100644 index 000000000..e24ae7bd5 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/abci/v1beta1/abci.proto @@ -0,0 +1,144 @@ +syntax = "proto3"; +package cosmos.base.abci.v1beta1; + +import "gogoproto/gogo.proto"; +import "tendermint/abci/types.proto"; +import "google/protobuf/any.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/types"; +option (gogoproto.goproto_stringer_all) = false; + +// TxResponse defines a structure containing relevant tx data and metadata. The +// tags are stringified and the log is JSON decoded. +message TxResponse { + option (gogoproto.goproto_getters) = false; + // The block height + int64 height = 1; + // The transaction hash. + string txhash = 2 [(gogoproto.customname) = "TxHash"]; + // Namespace for the Code + string codespace = 3; + // Response code. + uint32 code = 4; + // Result bytes, if any. + string data = 5; + // The output of the application's logger (raw string). May be + // non-deterministic. + string raw_log = 6; + // The output of the application's logger (typed). May be non-deterministic. + repeated ABCIMessageLog logs = 7 [(gogoproto.castrepeated) = "ABCIMessageLogs", (gogoproto.nullable) = false]; + // Additional information. May be non-deterministic. + string info = 8; + // Amount of gas requested for transaction. + int64 gas_wanted = 9; + // Amount of gas consumed by transaction. + int64 gas_used = 10; + // The request transaction bytes. + google.protobuf.Any tx = 11; + // Time of the previous block. For heights > 1, it's the weighted median of + // the timestamps of the valid votes in the block.LastCommit. For height == 1, + // it's genesis time. + string timestamp = 12; + // Events defines all the events emitted by processing a transaction. Note, + // these events include those emitted by processing all the messages and those + // emitted from the ante handler. Whereas Logs contains the events, with + // additional metadata, emitted only by processing the messages. + // + // Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 + repeated tendermint.abci.Event events = 13 [(gogoproto.nullable) = false]; +} + +// ABCIMessageLog defines a structure containing an indexed tx ABCI message log. +message ABCIMessageLog { + option (gogoproto.stringer) = true; + + uint32 msg_index = 1; + string log = 2; + + // Events contains a slice of Event objects that were emitted during some + // execution. + repeated StringEvent events = 3 [(gogoproto.castrepeated) = "StringEvents", (gogoproto.nullable) = false]; +} + +// StringEvent defines en Event object wrapper where all the attributes +// contain key/value pairs that are strings instead of raw bytes. +message StringEvent { + option (gogoproto.stringer) = true; + + string type = 1; + repeated Attribute attributes = 2 [(gogoproto.nullable) = false]; +} + +// Attribute defines an attribute wrapper where the key and value are +// strings instead of raw bytes. +message Attribute { + string key = 1; + string value = 2; +} + +// GasInfo defines tx execution gas context. +message GasInfo { + // GasWanted is the maximum units of work we allow this tx to perform. + uint64 gas_wanted = 1 [(gogoproto.moretags) = "yaml:\"gas_wanted\""]; + + // GasUsed is the amount of gas actually consumed. + uint64 gas_used = 2 [(gogoproto.moretags) = "yaml:\"gas_used\""]; +} + +// Result is the union of ResponseFormat and ResponseCheckTx. +message Result { + option (gogoproto.goproto_getters) = false; + + // Data is any data returned from message or handler execution. It MUST be + // length prefixed in order to separate data from multiple message executions. + bytes data = 1; + + // Log contains the log information from message or handler execution. + string log = 2; + + // Events contains a slice of Event objects that were emitted during message + // or handler execution. + repeated tendermint.abci.Event events = 3 [(gogoproto.nullable) = false]; +} + +// SimulationResponse defines the response generated when a transaction is +// successfully simulated. +message SimulationResponse { + GasInfo gas_info = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + Result result = 2; +} + +// MsgData defines the data returned in a Result object during message +// execution. +message MsgData { + option (gogoproto.stringer) = true; + + string msg_type = 1; + bytes data = 2; +} + +// TxMsgData defines a list of MsgData. A transaction will have a MsgData object +// for each message. +message TxMsgData { + option (gogoproto.stringer) = true; + + repeated MsgData data = 1; +} + +// SearchTxsResult defines a structure for querying txs pageable +message SearchTxsResult { + option (gogoproto.stringer) = true; + + // Count of all txs + uint64 total_count = 1 [(gogoproto.moretags) = "yaml:\"total_count\"", (gogoproto.jsontag) = "total_count"]; + // Count of txs in current page + uint64 count = 2; + // Index of current page, start from 1 + uint64 page_number = 3 [(gogoproto.moretags) = "yaml:\"page_number\"", (gogoproto.jsontag) = "page_number"]; + // Count of total pages + uint64 page_total = 4 [(gogoproto.moretags) = "yaml:\"page_total\"", (gogoproto.jsontag) = "page_total"]; + // Max count txs per page + uint64 limit = 5; + // List of txs in current page + repeated TxResponse txs = 6; +} diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/kv/v1beta1/kv.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/kv/v1beta1/kv.proto new file mode 100644 index 000000000..4e9b8d285 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/kv/v1beta1/kv.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package cosmos.base.kv.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/types/kv"; + +// Pairs defines a repeated slice of Pair objects. +message Pairs { + repeated Pair pairs = 1 [(gogoproto.nullable) = false]; +} + +// Pair defines a key/value bytes tuple. +message Pair { + bytes key = 1; + bytes value = 2; +} diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/query/v1beta1/pagination.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/query/v1beta1/pagination.proto new file mode 100644 index 000000000..cd5eb066d --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/query/v1beta1/pagination.proto @@ -0,0 +1,55 @@ +syntax = "proto3"; +package cosmos.base.query.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/types/query"; + +// PageRequest is to be embedded in gRPC request messages for efficient +// pagination. Ex: +// +// message SomeRequest { +// Foo some_parameter = 1; +// PageRequest pagination = 2; +// } +message PageRequest { + // key is a value returned in PageResponse.next_key to begin + // querying the next page most efficiently. Only one of offset or key + // should be set. + bytes key = 1; + + // offset is a numeric offset that can be used when key is unavailable. + // It is less efficient than using key. Only one of offset or key should + // be set. + uint64 offset = 2; + + // limit is the total number of results to be returned in the result page. + // If left empty it will default to a value to be set by each app. + uint64 limit = 3; + + // count_total is set to true to indicate that the result set should include + // a count of the total number of items available for pagination in UIs. + // count_total is only respected when offset is used. It is ignored when key + // is set. + bool count_total = 4; + + // reverse is set to true if results are to be returned in the descending order. + // + // Since: cosmos-sdk 0.43 + bool reverse = 5; +} + +// PageResponse is to be embedded in gRPC response messages where the +// corresponding request message has used PageRequest. +// +// message SomeResponse { +// repeated Bar results = 1; +// PageResponse page = 2; +// } +message PageResponse { + // next_key is the key to be passed to PageRequest.key to + // query the next page most efficiently + bytes next_key = 1; + + // total is total number of results available if PageRequest.count_total + // was set, its value is undefined otherwise + uint64 total = 2; +} diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/reflection/v1beta1/reflection.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/reflection/v1beta1/reflection.proto new file mode 100644 index 000000000..22670e72b --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/reflection/v1beta1/reflection.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; +package cosmos.base.reflection.v1beta1; + +import "google/api/annotations.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/reflection"; + +// ReflectionService defines a service for interface reflection. +service ReflectionService { + // ListAllInterfaces lists all the interfaces registered in the interface + // registry. + rpc ListAllInterfaces(ListAllInterfacesRequest) returns (ListAllInterfacesResponse) { + option (google.api.http).get = "/cosmos/base/reflection/v1beta1/interfaces"; + }; + + // ListImplementations list all the concrete types that implement a given + // interface. + rpc ListImplementations(ListImplementationsRequest) returns (ListImplementationsResponse) { + option (google.api.http).get = "/cosmos/base/reflection/v1beta1/interfaces/" + "{interface_name}/implementations"; + }; +} + +// ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. +message ListAllInterfacesRequest {} + +// ListAllInterfacesResponse is the response type of the ListAllInterfaces RPC. +message ListAllInterfacesResponse { + // interface_names is an array of all the registered interfaces. + repeated string interface_names = 1; +} + +// ListImplementationsRequest is the request type of the ListImplementations +// RPC. +message ListImplementationsRequest { + // interface_name defines the interface to query the implementations for. + string interface_name = 1; +} + +// ListImplementationsResponse is the response type of the ListImplementations +// RPC. +message ListImplementationsResponse { + repeated string implementation_message_names = 1; +} diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/reflection/v2alpha1/reflection.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/reflection/v2alpha1/reflection.proto new file mode 100644 index 000000000..d5b048558 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/reflection/v2alpha1/reflection.proto @@ -0,0 +1,218 @@ +// Since: cosmos-sdk 0.43 +syntax = "proto3"; +package cosmos.base.reflection.v2alpha1; + +import "google/api/annotations.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/server/grpc/reflection/v2alpha1"; + +// AppDescriptor describes a cosmos-sdk based application +message AppDescriptor { + // AuthnDescriptor provides information on how to authenticate transactions on the application + // NOTE: experimental and subject to change in future releases. + AuthnDescriptor authn = 1; + // chain provides the chain descriptor + ChainDescriptor chain = 2; + // codec provides metadata information regarding codec related types + CodecDescriptor codec = 3; + // configuration provides metadata information regarding the sdk.Config type + ConfigurationDescriptor configuration = 4; + // query_services provides metadata information regarding the available queriable endpoints + QueryServicesDescriptor query_services = 5; + // tx provides metadata information regarding how to send transactions to the given application + TxDescriptor tx = 6; +} + +// TxDescriptor describes the accepted transaction type +message TxDescriptor { + // fullname is the protobuf fullname of the raw transaction type (for instance the tx.Tx type) + // it is not meant to support polymorphism of transaction types, it is supposed to be used by + // reflection clients to understand if they can handle a specific transaction type in an application. + string fullname = 1; + // msgs lists the accepted application messages (sdk.Msg) + repeated MsgDescriptor msgs = 2; +} + +// AuthnDescriptor provides information on how to sign transactions without relying +// on the online RPCs GetTxMetadata and CombineUnsignedTxAndSignatures +message AuthnDescriptor { + // sign_modes defines the supported signature algorithm + repeated SigningModeDescriptor sign_modes = 1; +} + +// SigningModeDescriptor provides information on a signing flow of the application +// NOTE(fdymylja): here we could go as far as providing an entire flow on how +// to sign a message given a SigningModeDescriptor, but it's better to think about +// this another time +message SigningModeDescriptor { + // name defines the unique name of the signing mode + string name = 1; + // number is the unique int32 identifier for the sign_mode enum + int32 number = 2; + // authn_info_provider_method_fullname defines the fullname of the method to call to get + // the metadata required to authenticate using the provided sign_modes + string authn_info_provider_method_fullname = 3; +} + +// ChainDescriptor describes chain information of the application +message ChainDescriptor { + // id is the chain id + string id = 1; +} + +// CodecDescriptor describes the registered interfaces and provides metadata information on the types +message CodecDescriptor { + // interfaces is a list of the registerted interfaces descriptors + repeated InterfaceDescriptor interfaces = 1; +} + +// InterfaceDescriptor describes the implementation of an interface +message InterfaceDescriptor { + // fullname is the name of the interface + string fullname = 1; + // interface_accepting_messages contains information regarding the proto messages which contain the interface as + // google.protobuf.Any field + repeated InterfaceAcceptingMessageDescriptor interface_accepting_messages = 2; + // interface_implementers is a list of the descriptors of the interface implementers + repeated InterfaceImplementerDescriptor interface_implementers = 3; +} + +// InterfaceImplementerDescriptor describes an interface implementer +message InterfaceImplementerDescriptor { + // fullname is the protobuf queryable name of the interface implementer + string fullname = 1; + // type_url defines the type URL used when marshalling the type as any + // this is required so we can provide type safe google.protobuf.Any marshalling and + // unmarshalling, making sure that we don't accept just 'any' type + // in our interface fields + string type_url = 2; +} + +// InterfaceAcceptingMessageDescriptor describes a protobuf message which contains +// an interface represented as a google.protobuf.Any +message InterfaceAcceptingMessageDescriptor { + // fullname is the protobuf fullname of the type containing the interface + string fullname = 1; + // field_descriptor_names is a list of the protobuf name (not fullname) of the field + // which contains the interface as google.protobuf.Any (the interface is the same, but + // it can be in multiple fields of the same proto message) + repeated string field_descriptor_names = 2; +} + +// ConfigurationDescriptor contains metadata information on the sdk.Config +message ConfigurationDescriptor { + // bech32_account_address_prefix is the account address prefix + string bech32_account_address_prefix = 1; +} + +// MsgDescriptor describes a cosmos-sdk message that can be delivered with a transaction +message MsgDescriptor { + // msg_type_url contains the TypeURL of a sdk.Msg. + string msg_type_url = 1; +} + +// ReflectionService defines a service for application reflection. +service ReflectionService { + // GetAuthnDescriptor returns information on how to authenticate transactions in the application + // NOTE: this RPC is still experimental and might be subject to breaking changes or removal in + // future releases of the cosmos-sdk. + rpc GetAuthnDescriptor(GetAuthnDescriptorRequest) returns (GetAuthnDescriptorResponse) { + option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/authn"; + } + // GetChainDescriptor returns the description of the chain + rpc GetChainDescriptor(GetChainDescriptorRequest) returns (GetChainDescriptorResponse) { + option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/chain"; + }; + // GetCodecDescriptor returns the descriptor of the codec of the application + rpc GetCodecDescriptor(GetCodecDescriptorRequest) returns (GetCodecDescriptorResponse) { + option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/codec"; + } + // GetConfigurationDescriptor returns the descriptor for the sdk.Config of the application + rpc GetConfigurationDescriptor(GetConfigurationDescriptorRequest) returns (GetConfigurationDescriptorResponse) { + option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/configuration"; + } + // GetQueryServicesDescriptor returns the available gRPC queryable services of the application + rpc GetQueryServicesDescriptor(GetQueryServicesDescriptorRequest) returns (GetQueryServicesDescriptorResponse) { + option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/query_services"; + } + // GetTxDescriptor returns information on the used transaction object and available msgs that can be used + rpc GetTxDescriptor(GetTxDescriptorRequest) returns (GetTxDescriptorResponse) { + option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/tx_descriptor"; + } +} + +// GetAuthnDescriptorRequest is the request used for the GetAuthnDescriptor RPC +message GetAuthnDescriptorRequest {} +// GetAuthnDescriptorResponse is the response returned by the GetAuthnDescriptor RPC +message GetAuthnDescriptorResponse { + // authn describes how to authenticate to the application when sending transactions + AuthnDescriptor authn = 1; +} + +// GetChainDescriptorRequest is the request used for the GetChainDescriptor RPC +message GetChainDescriptorRequest {} +// GetChainDescriptorResponse is the response returned by the GetChainDescriptor RPC +message GetChainDescriptorResponse { + // chain describes application chain information + ChainDescriptor chain = 1; +} + +// GetCodecDescriptorRequest is the request used for the GetCodecDescriptor RPC +message GetCodecDescriptorRequest {} +// GetCodecDescriptorResponse is the response returned by the GetCodecDescriptor RPC +message GetCodecDescriptorResponse { + // codec describes the application codec such as registered interfaces and implementations + CodecDescriptor codec = 1; +} + +// GetConfigurationDescriptorRequest is the request used for the GetConfigurationDescriptor RPC +message GetConfigurationDescriptorRequest {} +// GetConfigurationDescriptorResponse is the response returned by the GetConfigurationDescriptor RPC +message GetConfigurationDescriptorResponse { + // config describes the application's sdk.Config + ConfigurationDescriptor config = 1; +} + +// GetQueryServicesDescriptorRequest is the request used for the GetQueryServicesDescriptor RPC +message GetQueryServicesDescriptorRequest {} +// GetQueryServicesDescriptorResponse is the response returned by the GetQueryServicesDescriptor RPC +message GetQueryServicesDescriptorResponse { + // queries provides information on the available queryable services + QueryServicesDescriptor queries = 1; +} + +// GetTxDescriptorRequest is the request used for the GetTxDescriptor RPC +message GetTxDescriptorRequest {} +// GetTxDescriptorResponse is the response returned by the GetTxDescriptor RPC +message GetTxDescriptorResponse { + // tx provides information on msgs that can be forwarded to the application + // alongside the accepted transaction protobuf type + TxDescriptor tx = 1; +} + +// QueryServicesDescriptor contains the list of cosmos-sdk queriable services +message QueryServicesDescriptor { + // query_services is a list of cosmos-sdk QueryServiceDescriptor + repeated QueryServiceDescriptor query_services = 1; +} + +// QueryServiceDescriptor describes a cosmos-sdk queryable service +message QueryServiceDescriptor { + // fullname is the protobuf fullname of the service descriptor + string fullname = 1; + // is_module describes if this service is actually exposed by an application's module + bool is_module = 2; + // methods provides a list of query service methods + repeated QueryMethodDescriptor methods = 3; +} + +// QueryMethodDescriptor describes a queryable method of a query service +// no other info is provided beside method name and tendermint queryable path +// because it would be redundant with the grpc reflection service +message QueryMethodDescriptor { + // name is the protobuf name (not fullname) of the method + string name = 1; + // full_query_path is the path that can be used to query + // this method via tendermint abci.Query + string full_query_path = 2; +} diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/snapshots/v1beta1/snapshot.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/snapshots/v1beta1/snapshot.proto new file mode 100644 index 000000000..6dcc4a933 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/snapshots/v1beta1/snapshot.proto @@ -0,0 +1,57 @@ +syntax = "proto3"; +package cosmos.base.snapshots.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/snapshots/types"; + +// Snapshot contains Tendermint state sync snapshot info. +message Snapshot { + uint64 height = 1; + uint32 format = 2; + uint32 chunks = 3; + bytes hash = 4; + Metadata metadata = 5 [(gogoproto.nullable) = false]; +} + +// Metadata contains SDK-specific snapshot metadata. +message Metadata { + repeated bytes chunk_hashes = 1; // SHA-256 chunk hashes +} + +// SnapshotItem is an item contained in a rootmulti.Store snapshot. +message SnapshotItem { + // item is the specific type of snapshot item. + oneof item { + SnapshotStoreItem store = 1; + SnapshotIAVLItem iavl = 2 [(gogoproto.customname) = "IAVL"]; + SnapshotExtensionMeta extension = 3; + SnapshotExtensionPayload extension_payload = 4; + } +} + +// SnapshotStoreItem contains metadata about a snapshotted store. +message SnapshotStoreItem { + string name = 1; +} + +// SnapshotIAVLItem is an exported IAVL node. +message SnapshotIAVLItem { + bytes key = 1; + bytes value = 2; + // version is block height + int64 version = 3; + // height is depth of the tree. + int32 height = 4; +} + +// SnapshotExtensionMeta contains metadata about an external snapshotter. +message SnapshotExtensionMeta { + string name = 1; + uint32 format = 2; +} + +// SnapshotExtensionPayload contains payloads of an external snapshotter. +message SnapshotExtensionPayload { + bytes payload = 1; +} diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/store/v1beta1/commit_info.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/store/v1beta1/commit_info.proto new file mode 100644 index 000000000..98a33d30e --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/store/v1beta1/commit_info.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; +package cosmos.base.store.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/store/types"; + +// CommitInfo defines commit information used by the multi-store when committing +// a version/height. +message CommitInfo { + int64 version = 1; + repeated StoreInfo store_infos = 2 [(gogoproto.nullable) = false]; +} + +// StoreInfo defines store-specific commit information. It contains a reference +// between a store name and the commit ID. +message StoreInfo { + string name = 1; + CommitID commit_id = 2 [(gogoproto.nullable) = false]; +} + +// CommitID defines the committment information when a specific store is +// committed. +message CommitID { + option (gogoproto.goproto_stringer) = false; + + int64 version = 1; + bytes hash = 2; +} diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/store/v1beta1/listening.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/store/v1beta1/listening.proto new file mode 100644 index 000000000..359997109 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/store/v1beta1/listening.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package cosmos.base.store.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/store/types"; + +// StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) +// It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and +// Deletes +// +// Since: cosmos-sdk 0.43 +message StoreKVPair { + string store_key = 1; // the store key for the KVStore this pair originates from + bool delete = 2; // true indicates a delete operation, false indicates a set operation + bytes key = 3; + bytes value = 4; +} diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/tendermint/v1beta1/query.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/tendermint/v1beta1/query.proto new file mode 100644 index 000000000..1aeb6bc58 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/tendermint/v1beta1/query.proto @@ -0,0 +1,138 @@ +syntax = "proto3"; +package cosmos.base.tendermint.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "google/api/annotations.proto"; +import "tendermint/p2p/types.proto"; +import "tendermint/types/block.proto"; +import "tendermint/types/types.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/tmservice"; + +// Service defines the gRPC querier service for tendermint queries. +service Service { + // GetNodeInfo queries the current node info. + rpc GetNodeInfo(GetNodeInfoRequest) returns (GetNodeInfoResponse) { + option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/node_info"; + } + // GetSyncing queries node syncing. + rpc GetSyncing(GetSyncingRequest) returns (GetSyncingResponse) { + option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/syncing"; + } + // GetLatestBlock returns the latest block. + rpc GetLatestBlock(GetLatestBlockRequest) returns (GetLatestBlockResponse) { + option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/blocks/latest"; + } + // GetBlockByHeight queries block for given height. + rpc GetBlockByHeight(GetBlockByHeightRequest) returns (GetBlockByHeightResponse) { + option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/blocks/{height}"; + } + + // GetLatestValidatorSet queries latest validator-set. + rpc GetLatestValidatorSet(GetLatestValidatorSetRequest) returns (GetLatestValidatorSetResponse) { + option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/validatorsets/latest"; + } + // GetValidatorSetByHeight queries validator-set at a given height. + rpc GetValidatorSetByHeight(GetValidatorSetByHeightRequest) returns (GetValidatorSetByHeightResponse) { + option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/validatorsets/{height}"; + } +} + +// GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. +message GetValidatorSetByHeightRequest { + int64 height = 1; + // pagination defines an pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method. +message GetValidatorSetByHeightResponse { + int64 block_height = 1; + repeated Validator validators = 2; + // pagination defines an pagination for the response. + cosmos.base.query.v1beta1.PageResponse pagination = 3; +} + +// GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight RPC method. +message GetLatestValidatorSetRequest { + // pagination defines an pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method. +message GetLatestValidatorSetResponse { + int64 block_height = 1; + repeated Validator validators = 2; + // pagination defines an pagination for the response. + cosmos.base.query.v1beta1.PageResponse pagination = 3; +} + +// Validator is the type for the validator-set. +message Validator { + string address = 1; + google.protobuf.Any pub_key = 2; + int64 voting_power = 3; + int64 proposer_priority = 4; +} + +// GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight RPC method. +message GetBlockByHeightRequest { + int64 height = 1; +} + +// GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method. +message GetBlockByHeightResponse { + .tendermint.types.BlockID block_id = 1; + .tendermint.types.Block block = 2; +} + +// GetLatestBlockRequest is the request type for the Query/GetLatestBlock RPC method. +message GetLatestBlockRequest {} + +// GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC method. +message GetLatestBlockResponse { + .tendermint.types.BlockID block_id = 1; + .tendermint.types.Block block = 2; +} + +// GetSyncingRequest is the request type for the Query/GetSyncing RPC method. +message GetSyncingRequest {} + +// GetSyncingResponse is the response type for the Query/GetSyncing RPC method. +message GetSyncingResponse { + bool syncing = 1; +} + +// GetNodeInfoRequest is the request type for the Query/GetNodeInfo RPC method. +message GetNodeInfoRequest {} + +// GetNodeInfoResponse is the request type for the Query/GetNodeInfo RPC method. +message GetNodeInfoResponse { + .tendermint.p2p.NodeInfo default_node_info = 1; + VersionInfo application_version = 2; +} + +// VersionInfo is the type for the GetNodeInfoResponse message. +message VersionInfo { + string name = 1; + string app_name = 2; + string version = 3; + string git_commit = 4; + string build_tags = 5; + string go_version = 6; + repeated Module build_deps = 7; + // Since: cosmos-sdk 0.43 + string cosmos_sdk_version = 8; +} + +// Module is the type for VersionInfo +message Module { + // module path + string path = 1; + // module version + string version = 2; + // checksum + string sum = 3; +} diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/v1beta1/coin.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/v1beta1/coin.proto new file mode 100644 index 000000000..fab75284b --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/cosmos/base/v1beta1/coin.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; +package cosmos.base.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/types"; +option (gogoproto.goproto_stringer_all) = false; +option (gogoproto.stringer_all) = false; + +// Coin defines a token with a denomination and an amount. +// +// NOTE: The amount field is an Int which implements the custom method +// signatures required by gogoproto. +message Coin { + option (gogoproto.equal) = true; + + string denom = 1; + string amount = 2 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; +} + +// DecCoin defines a token with a denomination and a decimal amount. +// +// NOTE: The amount field is an Dec which implements the custom method +// signatures required by gogoproto. +message DecCoin { + option (gogoproto.equal) = true; + + string denom = 1; + string amount = 2 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; +} + +// IntProto defines a Protobuf wrapper around an Int object. +message IntProto { + string int = 1 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; +} + +// DecProto defines a Protobuf wrapper around a Dec object. +message DecProto { + string dec = 1 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; +} diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/gov/v1beta1/genesis.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/gov/v1beta1/genesis.proto new file mode 100644 index 000000000..4dd9df6bf --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/gov/v1beta1/genesis.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package cosmos.gov.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos/gov/v1beta1/gov.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; + +// GenesisState defines the gov module's genesis state. +message GenesisState { + // starting_proposal_id is the ID of the starting proposal. + uint64 starting_proposal_id = 1 [(gogoproto.moretags) = "yaml:\"starting_proposal_id\""]; + // deposits defines all the deposits present at genesis. + repeated Deposit deposits = 2 [(gogoproto.castrepeated) = "Deposits", (gogoproto.nullable) = false]; + // votes defines all the votes present at genesis. + repeated Vote votes = 3 [(gogoproto.castrepeated) = "Votes", (gogoproto.nullable) = false]; + // proposals defines all the proposals present at genesis. + repeated Proposal proposals = 4 [(gogoproto.castrepeated) = "Proposals", (gogoproto.nullable) = false]; + // params defines all the paramaters of related to deposit. + DepositParams deposit_params = 5 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"deposit_params\""]; + // params defines all the paramaters of related to voting. + VotingParams voting_params = 6 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_params\""]; + // params defines all the paramaters of related to tally. + TallyParams tally_params = 7 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"tally_params\""]; +} \ No newline at end of file diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/gov/v1beta1/gov.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/gov/v1beta1/gov.proto new file mode 100644 index 000000000..a2df1bd1b --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/gov/v1beta1/gov.proto @@ -0,0 +1,200 @@ +syntax = "proto3"; +package cosmos.gov.v1beta1; + +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; +option (gogoproto.goproto_stringer_all) = false; +option (gogoproto.stringer_all) = false; +option (gogoproto.goproto_getters_all) = false; + +// VoteOption enumerates the valid vote options for a given governance proposal. +enum VoteOption { + option (gogoproto.goproto_enum_prefix) = false; + + // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + VOTE_OPTION_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "OptionEmpty"]; + // VOTE_OPTION_YES defines a yes vote option. + VOTE_OPTION_YES = 1 [(gogoproto.enumvalue_customname) = "OptionYes"]; + // VOTE_OPTION_ABSTAIN defines an abstain vote option. + VOTE_OPTION_ABSTAIN = 2 [(gogoproto.enumvalue_customname) = "OptionAbstain"]; + // VOTE_OPTION_NO defines a no vote option. + VOTE_OPTION_NO = 3 [(gogoproto.enumvalue_customname) = "OptionNo"]; + // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + VOTE_OPTION_NO_WITH_VETO = 4 [(gogoproto.enumvalue_customname) = "OptionNoWithVeto"]; +} + +// WeightedVoteOption defines a unit of vote for vote split. +// +// Since: cosmos-sdk 0.43 +message WeightedVoteOption { + VoteOption option = 1; + string weight = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"weight\"" + ]; +} + +// TextProposal defines a standard text proposal whose changes need to be +// manually updated in case of approval. +message TextProposal { + option (cosmos_proto.implements_interface) = "Content"; + + option (gogoproto.equal) = true; + + string title = 1; + string description = 2; +} + +// Deposit defines an amount deposited by an account address to an active +// proposal. +message Deposit { + option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; + + uint64 proposal_id = 1 [(gogoproto.moretags) = "yaml:\"proposal_id\""]; + string depositor = 2; + repeated cosmos.base.v1beta1.Coin amount = 3 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// Proposal defines the core field members of a governance proposal. +message Proposal { + option (gogoproto.equal) = true; + + uint64 proposal_id = 1 [(gogoproto.jsontag) = "id", (gogoproto.moretags) = "yaml:\"id\""]; + google.protobuf.Any content = 2 [(cosmos_proto.accepts_interface) = "Content"]; + ProposalStatus status = 3 [(gogoproto.moretags) = "yaml:\"proposal_status\""]; + TallyResult final_tally_result = 4 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"final_tally_result\""]; + google.protobuf.Timestamp submit_time = 5 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"submit_time\""]; + google.protobuf.Timestamp deposit_end_time = 6 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"deposit_end_time\""]; + repeated cosmos.base.v1beta1.Coin total_deposit = 7 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"total_deposit\"" + ]; + google.protobuf.Timestamp voting_start_time = 8 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_start_time\""]; + google.protobuf.Timestamp voting_end_time = 9 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_end_time\""]; +} + +// ProposalStatus enumerates the valid statuses of a proposal. +enum ProposalStatus { + option (gogoproto.goproto_enum_prefix) = false; + + // PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. + PROPOSAL_STATUS_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "StatusNil"]; + // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + // period. + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1 [(gogoproto.enumvalue_customname) = "StatusDepositPeriod"]; + // PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + // period. + PROPOSAL_STATUS_VOTING_PERIOD = 2 [(gogoproto.enumvalue_customname) = "StatusVotingPeriod"]; + // PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + // passed. + PROPOSAL_STATUS_PASSED = 3 [(gogoproto.enumvalue_customname) = "StatusPassed"]; + // PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + // been rejected. + PROPOSAL_STATUS_REJECTED = 4 [(gogoproto.enumvalue_customname) = "StatusRejected"]; + // PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + // failed. + PROPOSAL_STATUS_FAILED = 5 [(gogoproto.enumvalue_customname) = "StatusFailed"]; +} + +// TallyResult defines a standard tally for a governance proposal. +message TallyResult { + option (gogoproto.equal) = true; + + string yes = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; + string abstain = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; + string no = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; + string no_with_veto = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"no_with_veto\"" + ]; +} + +// Vote defines a vote on a governance proposal. +// A Vote consists of a proposal ID, the voter, and the vote option. +message Vote { + option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; + + uint64 proposal_id = 1 [(gogoproto.moretags) = "yaml:\"proposal_id\""]; + string voter = 2; + // Deprecated: Prefer to use `options` instead. This field is set in queries + // if and only if `len(options) == 1` and that option has weight 1. In all + // other cases, this field will default to VOTE_OPTION_UNSPECIFIED. + VoteOption option = 3 [deprecated = true]; + // Since: cosmos-sdk 0.43 + repeated WeightedVoteOption options = 4 [(gogoproto.nullable) = false]; +} + +// DepositParams defines the params for deposits on governance proposals. +message DepositParams { + // Minimum deposit for a proposal to enter voting period. + repeated cosmos.base.v1beta1.Coin min_deposit = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"min_deposit\"", + (gogoproto.jsontag) = "min_deposit,omitempty" + ]; + + // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + // months. + google.protobuf.Duration max_deposit_period = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "max_deposit_period,omitempty", + (gogoproto.moretags) = "yaml:\"max_deposit_period\"" + ]; +} + +// VotingParams defines the params for voting on governance proposals. +message VotingParams { + // Length of the voting period. + google.protobuf.Duration voting_period = 1 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "voting_period,omitempty", + (gogoproto.moretags) = "yaml:\"voting_period\"" + ]; +} + +// TallyParams defines the params for tallying votes on governance proposals. +message TallyParams { + // Minimum percentage of total stake needed to vote for a result to be + // considered valid. + bytes quorum = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "quorum,omitempty" + ]; + + // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. + bytes threshold = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "threshold,omitempty" + ]; + + // Minimum value of Veto votes to Total votes ratio for proposal to be + // vetoed. Default value: 1/3. + bytes veto_threshold = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "veto_threshold,omitempty", + (gogoproto.moretags) = "yaml:\"veto_threshold\"" + ]; +} \ No newline at end of file diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/gov/v1beta1/query.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/gov/v1beta1/query.proto new file mode 100644 index 000000000..232d9e9ca --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/gov/v1beta1/query.proto @@ -0,0 +1,190 @@ +syntax = "proto3"; +package cosmos.gov.v1beta1; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/gov/v1beta1/gov.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; + +// Query defines the gRPC querier service for gov module +service Query { + // Proposal queries proposal details based on ProposalID. + rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse) { + option (google.api.http).get = "/cosmos/gov/v1beta1/proposals/{proposal_id}"; + } + + // Proposals queries all proposals based on given status. + rpc Proposals(QueryProposalsRequest) returns (QueryProposalsResponse) { + option (google.api.http).get = "/cosmos/gov/v1beta1/proposals"; + } + + // Vote queries voted information based on proposalID, voterAddr. + rpc Vote(QueryVoteRequest) returns (QueryVoteResponse) { + option (google.api.http).get = "/cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter}"; + } + + // Votes queries votes of a given proposal. + rpc Votes(QueryVotesRequest) returns (QueryVotesResponse) { + option (google.api.http).get = "/cosmos/gov/v1beta1/proposals/{proposal_id}/votes"; + } + + // Params queries all parameters of the gov module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/gov/v1beta1/params/{params_type}"; + } + + // Deposit queries single deposit information based proposalID, depositAddr. + rpc Deposit(QueryDepositRequest) returns (QueryDepositResponse) { + option (google.api.http).get = "/cosmos/gov/v1beta1/proposals/{proposal_id}/deposits/{depositor}"; + } + + // Deposits queries all deposits of a single proposal. + rpc Deposits(QueryDepositsRequest) returns (QueryDepositsResponse) { + option (google.api.http).get = "/cosmos/gov/v1beta1/proposals/{proposal_id}/deposits"; + } + + // TallyResult queries the tally of a proposal vote. + rpc TallyResult(QueryTallyResultRequest) returns (QueryTallyResultResponse) { + option (google.api.http).get = "/cosmos/gov/v1beta1/proposals/{proposal_id}/tally"; + } +} + +// QueryProposalRequest is the request type for the Query/Proposal RPC method. +message QueryProposalRequest { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; +} + +// QueryProposalResponse is the response type for the Query/Proposal RPC method. +message QueryProposalResponse { + Proposal proposal = 1 [(gogoproto.nullable) = false]; +} + +// QueryProposalsRequest is the request type for the Query/Proposals RPC method. +message QueryProposalsRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // proposal_status defines the status of the proposals. + ProposalStatus proposal_status = 1; + + // voter defines the voter address for the proposals. + string voter = 2; + + // depositor defines the deposit addresses from the proposals. + string depositor = 3; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 4; +} + +// QueryProposalsResponse is the response type for the Query/Proposals RPC +// method. +message QueryProposalsResponse { + repeated Proposal proposals = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryVoteRequest is the request type for the Query/Vote RPC method. +message QueryVoteRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; + + // voter defines the oter address for the proposals. + string voter = 2; +} + +// QueryVoteResponse is the response type for the Query/Vote RPC method. +message QueryVoteResponse { + // vote defined the queried vote. + Vote vote = 1 [(gogoproto.nullable) = false]; +} + +// QueryVotesRequest is the request type for the Query/Votes RPC method. +message QueryVotesRequest { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryVotesResponse is the response type for the Query/Votes RPC method. +message QueryVotesResponse { + // votes defined the queried votes. + repeated Vote votes = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryParamsRequest is the request type for the Query/Params RPC method. +message QueryParamsRequest { + // params_type defines which parameters to query for, can be one of "voting", + // "tallying" or "deposit". + string params_type = 1; +} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + // voting_params defines the parameters related to voting. + VotingParams voting_params = 1 [(gogoproto.nullable) = false]; + // deposit_params defines the parameters related to deposit. + DepositParams deposit_params = 2 [(gogoproto.nullable) = false]; + // tally_params defines the parameters related to tally. + TallyParams tally_params = 3 [(gogoproto.nullable) = false]; +} + +// QueryDepositRequest is the request type for the Query/Deposit RPC method. +message QueryDepositRequest { + option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; + + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; + + // depositor defines the deposit addresses from the proposals. + string depositor = 2; +} + +// QueryDepositResponse is the response type for the Query/Deposit RPC method. +message QueryDepositResponse { + // deposit defines the requested deposit. + Deposit deposit = 1 [(gogoproto.nullable) = false]; +} + +// QueryDepositsRequest is the request type for the Query/Deposits RPC method. +message QueryDepositsRequest { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryDepositsResponse is the response type for the Query/Deposits RPC method. +message QueryDepositsResponse { + repeated Deposit deposits = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryTallyResultRequest is the request type for the Query/Tally RPC method. +message QueryTallyResultRequest { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; +} + +// QueryTallyResultResponse is the response type for the Query/Tally RPC method. +message QueryTallyResultResponse { + // tally defines the requested tally. + TallyResult tally = 1 [(gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/gov/v1beta1/tx.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/gov/v1beta1/tx.proto new file mode 100644 index 000000000..eb08f3c68 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/gov/v1beta1/tx.proto @@ -0,0 +1,99 @@ +syntax = "proto3"; +package cosmos.gov.v1beta1; + +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/gov/v1beta1/gov.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; + +// Msg defines the bank Msg service. +service Msg { + // SubmitProposal defines a method to create new proposal given a content. + rpc SubmitProposal(MsgSubmitProposal) returns (MsgSubmitProposalResponse); + + // Vote defines a method to add a vote on a specific proposal. + rpc Vote(MsgVote) returns (MsgVoteResponse); + + // VoteWeighted defines a method to add a weighted vote on a specific proposal. + // + // Since: cosmos-sdk 0.43 + rpc VoteWeighted(MsgVoteWeighted) returns (MsgVoteWeightedResponse); + + // Deposit defines a method to add deposit on a specific proposal. + rpc Deposit(MsgDeposit) returns (MsgDepositResponse); +} + +// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary +// proposal Content. +message MsgSubmitProposal { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = false; + option (gogoproto.goproto_getters) = false; + + google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "Content"]; + repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"initial_deposit\"" + ]; + string proposer = 3; +} + +// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. +message MsgSubmitProposalResponse { + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (gogoproto.moretags) = "yaml:\"proposal_id\""]; +} + +// MsgVote defines a message to cast a vote. +message MsgVote { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = false; + option (gogoproto.goproto_getters) = false; + + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (gogoproto.moretags) = "yaml:\"proposal_id\""]; + string voter = 2; + VoteOption option = 3; +} + +// MsgVoteResponse defines the Msg/Vote response type. +message MsgVoteResponse {} + +// MsgVoteWeighted defines a message to cast a vote. +// +// Since: cosmos-sdk 0.43 +message MsgVoteWeighted { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = false; + option (gogoproto.goproto_getters) = false; + + uint64 proposal_id = 1 [(gogoproto.moretags) = "yaml:\"proposal_id\""]; + string voter = 2; + repeated WeightedVoteOption options = 3 [(gogoproto.nullable) = false]; +} + +// MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. +// +// Since: cosmos-sdk 0.43 +message MsgVoteWeightedResponse {} + +// MsgDeposit defines a message to submit a deposit to an existing proposal. +message MsgDeposit { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = false; + option (gogoproto.goproto_getters) = false; + + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (gogoproto.moretags) = "yaml:\"proposal_id\""]; + string depositor = 2; + repeated cosmos.base.v1beta1.Coin amount = 3 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// MsgDepositResponse defines the Msg/Deposit response type. +message MsgDepositResponse {} \ No newline at end of file diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/gogo.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/gogo.proto new file mode 100644 index 000000000..8947d90aa --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/gogo.proto @@ -0,0 +1,144 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto2"; +package gogoproto; + +import "google/protobuf/descriptor.proto"; + +option java_package = "com.google.protobuf"; +option java_outer_classname = "GoGoProtos"; +option go_package = "github.com/gogo/protobuf/gogoproto"; + +extend google.protobuf.EnumOptions { + optional bool goproto_enum_prefix = 62001; + optional bool goproto_enum_stringer = 62021; + optional bool enum_stringer = 62022; + optional string enum_customname = 62023; + optional bool enumdecl = 62024; +} + +extend google.protobuf.EnumValueOptions { + optional string enumvalue_customname = 66001; +} + +extend google.protobuf.FileOptions { + optional bool goproto_getters_all = 63001; + optional bool goproto_enum_prefix_all = 63002; + optional bool goproto_stringer_all = 63003; + optional bool verbose_equal_all = 63004; + optional bool face_all = 63005; + optional bool gostring_all = 63006; + optional bool populate_all = 63007; + optional bool stringer_all = 63008; + optional bool onlyone_all = 63009; + + optional bool equal_all = 63013; + optional bool description_all = 63014; + optional bool testgen_all = 63015; + optional bool benchgen_all = 63016; + optional bool marshaler_all = 63017; + optional bool unmarshaler_all = 63018; + optional bool stable_marshaler_all = 63019; + + optional bool sizer_all = 63020; + + optional bool goproto_enum_stringer_all = 63021; + optional bool enum_stringer_all = 63022; + + optional bool unsafe_marshaler_all = 63023; + optional bool unsafe_unmarshaler_all = 63024; + + optional bool goproto_extensions_map_all = 63025; + optional bool goproto_unrecognized_all = 63026; + optional bool gogoproto_import = 63027; + optional bool protosizer_all = 63028; + optional bool compare_all = 63029; + optional bool typedecl_all = 63030; + optional bool enumdecl_all = 63031; + + optional bool goproto_registration = 63032; + optional bool messagename_all = 63033; + + optional bool goproto_sizecache_all = 63034; + optional bool goproto_unkeyed_all = 63035; +} + +extend google.protobuf.MessageOptions { + optional bool goproto_getters = 64001; + optional bool goproto_stringer = 64003; + optional bool verbose_equal = 64004; + optional bool face = 64005; + optional bool gostring = 64006; + optional bool populate = 64007; + optional bool stringer = 67008; + optional bool onlyone = 64009; + + optional bool equal = 64013; + optional bool description = 64014; + optional bool testgen = 64015; + optional bool benchgen = 64016; + optional bool marshaler = 64017; + optional bool unmarshaler = 64018; + optional bool stable_marshaler = 64019; + + optional bool sizer = 64020; + + optional bool unsafe_marshaler = 64023; + optional bool unsafe_unmarshaler = 64024; + + optional bool goproto_extensions_map = 64025; + optional bool goproto_unrecognized = 64026; + + optional bool protosizer = 64028; + optional bool compare = 64029; + + optional bool typedecl = 64030; + + optional bool messagename = 64033; + + optional bool goproto_sizecache = 64034; + optional bool goproto_unkeyed = 64035; +} + +extend google.protobuf.FieldOptions { + optional bool nullable = 65001; + optional bool embed = 65002; + optional string customtype = 65003; + optional string customname = 65004; + optional string jsontag = 65005; + optional string moretags = 65006; + optional string casttype = 65007; + optional string castkey = 65008; + optional string castvalue = 65009; + + optional bool stdtime = 65010; + optional bool stdduration = 65011; + optional bool wktpointer = 65012; + +} \ No newline at end of file diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/msg.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/msg.proto new file mode 100644 index 000000000..89bdf3129 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/msg.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +package cosmos.msg.v1; + +import "google/protobuf/descriptor.proto"; + +// TODO(fdymylja): once we fully migrate to protov2 the go_package needs to be updated. +// We need this right now because gogoproto codegen needs to import the extension. +option go_package = "github.com/cosmos/cosmos-sdk/types/msgservice"; + +extend google.protobuf.MessageOptions { + // signer must be used in cosmos messages in order + // to signal to external clients which fields in a + // given cosmos message must be filled with signer + // information (address). + // The field must be the protobuf name of the message + // field extended with this MessageOption. + // The field must either be of string kind, or of message + // kind in case the signer information is contained within + // a message inside the cosmos message. + repeated string signer = 11110000; +} \ No newline at end of file diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/query.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/query.proto new file mode 100644 index 000000000..bd1ee0c30 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/query.proto @@ -0,0 +1,64 @@ +syntax = "proto3"; +package cosmos.slashing.v1beta1; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/slashing/v1beta1/slashing.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types"; + +// Query provides defines the gRPC querier service +service Query { + // Params queries the parameters of slashing module + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/slashing/v1beta1/params"; + } + + // SigningInfo queries the signing info of given cons address + rpc SigningInfo(QuerySigningInfoRequest) returns (QuerySigningInfoResponse) { + option (google.api.http).get = "/cosmos/slashing/v1beta1/signing_infos/{cons_address}"; + } + + // SigningInfos queries signing info of all validators + rpc SigningInfos(QuerySigningInfosRequest) returns (QuerySigningInfosResponse) { + option (google.api.http).get = "/cosmos/slashing/v1beta1/signing_infos"; + } +} + +// QueryParamsRequest is the request type for the Query/Params RPC method +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method +message QueryParamsResponse { + Params params = 1 [(gogoproto.nullable) = false]; +} + +// QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC +// method +message QuerySigningInfoRequest { + // cons_address is the address to query signing info of + string cons_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC +// method +message QuerySigningInfoResponse { + // val_signing_info is the signing info of requested val cons address + ValidatorSigningInfo val_signing_info = 1 [(gogoproto.nullable) = false]; +} + +// QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC +// method +message QuerySigningInfosRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QuerySigningInfosResponse is the response type for the Query/SigningInfos RPC +// method +message QuerySigningInfosResponse { + // info is the signing info of all validators + repeated cosmos.slashing.v1beta1.ValidatorSigningInfo info = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} \ No newline at end of file diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/slashing.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/slashing.proto new file mode 100644 index 000000000..081dc5abe --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/slashing.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; +package cosmos.slashing.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types"; +option (gogoproto.equal_all) = true; + +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "cosmos_proto/cosmos.proto"; + +// ValidatorSigningInfo defines a validator's signing info for monitoring their +// liveness activity. +message ValidatorSigningInfo { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // Height at which validator was first a candidate OR was unjailed + int64 start_height = 2; + // Index which is incremented each time the validator was a bonded + // in a block and may have signed a precommit or not. This in conjunction with the + // `SignedBlocksWindow` param determines the index in the `MissedBlocksBitArray`. + int64 index_offset = 3; + // Timestamp until which the validator is jailed due to liveness downtime. + google.protobuf.Timestamp jailed_until = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + // Whether or not a validator has been tombstoned (killed out of validator set). It is set + // once the validator commits an equivocation or for any other configured misbehiavor. + bool tombstoned = 5; + // A counter kept to avoid unnecessary array reads. + // Note that `Sum(MissedBlocksBitArray)` always equals `MissedBlocksCounter`. + int64 missed_blocks_counter = 6; +} + +// Params represents the parameters used for by the slashing module. +message Params { + int64 signed_blocks_window = 1; + bytes min_signed_per_window = 2 + [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + google.protobuf.Duration downtime_jail_duration = 3 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; + bytes slash_fraction_double_sign = 4 + [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + bytes slash_fraction_downtime = 5 + [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/tx.proto b/Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/tx.proto new file mode 100644 index 000000000..12595a67a --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/cosmos/slashing/v1beta1/tx.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package cosmos.slashing.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types"; +option (gogoproto.equal_all) = true; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; + +// Msg defines the slashing Msg service. +service Msg { + // Unjail defines a method for unjailing a jailed validator, thus returning + // them into the bonded validator set, so they can begin receiving provisions + // and rewards again. + rpc Unjail(MsgUnjail) returns (MsgUnjailResponse); +} + +// MsgUnjail defines the Msg/Unjail request type +message MsgUnjail { + option (cosmos.msg.v1.signer) = "validator_addr"; + + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = true; + + string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.jsontag) = "address"]; +} + +// MsgUnjailResponse defines the Msg/Unjail response type +message MsgUnjailResponse {} \ No newline at end of file diff --git a/Osmosis/osmosis-starter-enhanced/proto/osmosis/gamm/v1beta1/tx.proto b/Osmosis/osmosis-starter-enhanced/proto/osmosis/gamm/v1beta1/tx.proto new file mode 100644 index 000000000..e82f01cf5 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/osmosis/gamm/v1beta1/tx.proto @@ -0,0 +1,243 @@ +syntax = "proto3"; +package osmosis.gamm.v1beta1; + +import "gogoproto/gogo.proto"; +import "amino/amino.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "osmosis/poolmanager/v1beta1/swap_route.proto"; + +option go_package = "github.com/osmosis-labs/osmosis/v15/x/gamm/types"; + +service Msg { + rpc JoinPool(MsgJoinPool) returns (MsgJoinPoolResponse); + rpc ExitPool(MsgExitPool) returns (MsgExitPoolResponse); + rpc SwapExactAmountIn(MsgSwapExactAmountIn) + returns (MsgSwapExactAmountInResponse); + rpc SwapExactAmountOut(MsgSwapExactAmountOut) + returns (MsgSwapExactAmountOutResponse); + rpc JoinSwapExternAmountIn(MsgJoinSwapExternAmountIn) + returns (MsgJoinSwapExternAmountInResponse); + rpc JoinSwapShareAmountOut(MsgJoinSwapShareAmountOut) + returns (MsgJoinSwapShareAmountOutResponse); + rpc ExitSwapExternAmountOut(MsgExitSwapExternAmountOut) + returns (MsgExitSwapExternAmountOutResponse); + rpc ExitSwapShareAmountIn(MsgExitSwapShareAmountIn) + returns (MsgExitSwapShareAmountInResponse); +} + +// ===================== MsgJoinPool +// This is really MsgJoinPoolNoSwap +message MsgJoinPool { + option (amino.name) = "osmosis/gamm/join-pool"; + + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; + string share_out_amount = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"pool_amount_out\"", + (gogoproto.nullable) = false + ]; + repeated cosmos.base.v1beta1.Coin token_in_maxs = 4 [ + (gogoproto.moretags) = "yaml:\"token_in_max_amounts\"", + (gogoproto.nullable) = false + ]; +} + +message MsgJoinPoolResponse { + string share_out_amount = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"share_out_amount\"", + (gogoproto.nullable) = false + ]; + repeated cosmos.base.v1beta1.Coin token_in = 2 [ + (gogoproto.moretags) = "yaml:\"token_in\"", + (gogoproto.nullable) = false + ]; +} + +// ===================== MsgExitPool +message MsgExitPool { + option (amino.name) = "osmosis/gamm/exit-pool"; + + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; + string share_in_amount = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"share_in_amount\"", + (gogoproto.nullable) = false + ]; + + repeated cosmos.base.v1beta1.Coin token_out_mins = 4 [ + (gogoproto.moretags) = "yaml:\"token_out_min_amounts\"", + (gogoproto.nullable) = false + ]; +} + +message MsgExitPoolResponse { + repeated cosmos.base.v1beta1.Coin token_out = 1 [ + (gogoproto.moretags) = "yaml:\"token_out\"", + (gogoproto.nullable) = false + ]; +} + +// ===================== MsgSwapExactAmountIn +message MsgSwapExactAmountIn { + option (amino.name) = "osmosis/gamm/exit-pool"; + + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + repeated osmosis.poolmanager.v1beta1.SwapAmountInRoute routes = 2 + [ (gogoproto.nullable) = false ]; + cosmos.base.v1beta1.Coin token_in = 3 [ + (gogoproto.moretags) = "yaml:\"token_in\"", + (gogoproto.nullable) = false + ]; + string token_out_min_amount = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_out_min_amount\"", + (gogoproto.nullable) = false + ]; +} + +message MsgSwapExactAmountInResponse { + string token_out_amount = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_out_amount\"", + (gogoproto.nullable) = false + ]; +} + +message MsgSwapExactAmountOut { + option (amino.name) = "osmosis/gamm/swap-exact-amount-out"; + + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + repeated osmosis.poolmanager.v1beta1.SwapAmountOutRoute routes = 2 + [ (gogoproto.nullable) = false ]; + string token_in_max_amount = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_in_max_amount\"", + (gogoproto.nullable) = false + ]; + cosmos.base.v1beta1.Coin token_out = 4 [ + (gogoproto.moretags) = "yaml:\"token_out\"", + (gogoproto.nullable) = false + ]; +} + +message MsgSwapExactAmountOutResponse { + string token_in_amount = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_in_amount\"", + (gogoproto.nullable) = false + ]; +} + +// ===================== MsgJoinSwapExternAmountIn +// TODO: Rename to MsgJoinSwapExactAmountIn +message MsgJoinSwapExternAmountIn { + option (amino.name) = "osmosis/gamm/join-swap-extern-amount-in"; + + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; + cosmos.base.v1beta1.Coin token_in = 3 [ + (gogoproto.moretags) = "yaml:\"token_in\"", + (gogoproto.nullable) = false + ]; + string share_out_min_amount = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"share_out_min_amount\"", + (gogoproto.nullable) = false + ]; + // repeated cosmos.base.v1beta1.Coin tokensIn = 5 [ + // (gogoproto.moretags) = "yaml:\"tokens_in\"", + // (gogoproto.nullable) = false + // ]; +} + +message MsgJoinSwapExternAmountInResponse { + string share_out_amount = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"share_out_amount\"", + (gogoproto.nullable) = false + ]; +} + +// ===================== MsgJoinSwapShareAmountOut +message MsgJoinSwapShareAmountOut { + option (amino.name) = "osmosis/gamm/join-swap-share-amount-out"; + + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; + string token_in_denom = 3 + [ (gogoproto.moretags) = "yaml:\"token_in_denom\"" ]; + string share_out_amount = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"share_out_amount\"", + (gogoproto.nullable) = false + ]; + string token_in_max_amount = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_in_max_amount\"", + (gogoproto.nullable) = false + ]; +} + +message MsgJoinSwapShareAmountOutResponse { + string token_in_amount = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_in_amount\"", + (gogoproto.nullable) = false + ]; +} + +// ===================== MsgExitSwapShareAmountIn +message MsgExitSwapShareAmountIn { + option (amino.name) = "osmosis/gamm/exit-swap-share-amount-in"; + + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; + string token_out_denom = 3 + [ (gogoproto.moretags) = "yaml:\"token_out_denom\"" ]; + string share_in_amount = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"share_in_amount\"", + (gogoproto.nullable) = false + ]; + string token_out_min_amount = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_out_min_amount\"", + (gogoproto.nullable) = false + ]; +} + +message MsgExitSwapShareAmountInResponse { + string token_out_amount = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_out_amount\"", + (gogoproto.nullable) = false + ]; +} + +// ===================== MsgExitSwapExternAmountOut +message MsgExitSwapExternAmountOut { + option (amino.name) = "osmosis/gamm/exit-swap-extern-amount-out"; + + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; + cosmos.base.v1beta1.Coin token_out = 3 [ + (gogoproto.moretags) = "yaml:\"token_out\"", + (gogoproto.nullable) = false + ]; + string share_in_max_amount = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"share_in_max_amount\"", + (gogoproto.nullable) = false + ]; +} + +message MsgExitSwapExternAmountOutResponse { + string share_in_amount = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"share_in_amount\"", + (gogoproto.nullable) = false + ]; +} \ No newline at end of file diff --git a/Osmosis/osmosis-starter-enhanced/proto/osmosis/poolmanager/v1beta1/swap_route.proto b/Osmosis/osmosis-starter-enhanced/proto/osmosis/poolmanager/v1beta1/swap_route.proto new file mode 100644 index 000000000..b7225dd8d --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/proto/osmosis/poolmanager/v1beta1/swap_route.proto @@ -0,0 +1,38 @@ +syntax = "proto3"; +package osmosis.poolmanager.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/osmosis-labs/osmosis/v15/x/poolmanager/types"; + +message SwapAmountInRoute { + uint64 pool_id = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; + string token_out_denom = 2 + [ (gogoproto.moretags) = "yaml:\"token_out_denom\"" ]; +} + +message SwapAmountOutRoute { + uint64 pool_id = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; + string token_in_denom = 2 + [ (gogoproto.moretags) = "yaml:\"token_in_denom\"" ]; +} + +message SwapAmountInSplitRoute { + repeated SwapAmountInRoute pools = 1 + [ (gogoproto.moretags) = "yaml:\"pools\"", (gogoproto.nullable) = false ]; + string token_in_amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_in_amount\"", + (gogoproto.nullable) = false + ]; +} + +message SwapAmountOutSplitRoute { + repeated SwapAmountOutRoute pools = 1 + [ (gogoproto.moretags) = "yaml:\"pools\"", (gogoproto.nullable) = false ]; + string token_out_amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_out_amount\"", + (gogoproto.nullable) = false + ]; +} \ No newline at end of file diff --git a/Osmosis/osmosis-starter-enhanced/schema.graphql b/Osmosis/osmosis-starter-enhanced/schema.graphql new file mode 100644 index 000000000..4d38089ee --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/schema.graphql @@ -0,0 +1,40 @@ +enum Direction { + IN + OUT +} + +enum Message { + MsgSwapExactAmountIn + MsgSwapExactAmountOut + MsgJoinSwapShareAmountOut +} + +type Swap @entity { + id: ID! + sender: String! + direction: Direction! + txHash: String! + blockHeight: BigInt! + datetime: Date! + message: Message! + tokenInDenom: String + tokenInAmount: BigInt + tokenOutMin: BigInt + tokenOutDenom: String + tokenOutAmount: BigInt + tokenInMax: BigInt + swapRoutes: [SwapRoute] @derivedFrom(field: "swap") #This is virtual field +} + +type SwapRoute @entity { + id: ID! + pool: Pool! + swap: Swap! + tokenInDenom: String + tokenOutDenom: String +} + +type Pool @entity { + id: ID! + swapRoutes: [SwapRoute] @derivedFrom(field: "pool") #This is virtual field +} diff --git a/Osmosis/osmosis-starter-enhanced/src/index.ts b/Osmosis/osmosis-starter-enhanced/src/index.ts new file mode 100644 index 000000000..fb59776f0 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/src/index.ts @@ -0,0 +1,2 @@ +//Exports all handler functions +export * from "./mappings/mappingHandlers"; diff --git a/Osmosis/osmosis-starter-enhanced/src/mappings/mappingHandlers.ts b/Osmosis/osmosis-starter-enhanced/src/mappings/mappingHandlers.ts new file mode 100644 index 000000000..c9d7de941 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/src/mappings/mappingHandlers.ts @@ -0,0 +1,131 @@ +import { + MsgSwapExactAmountInMessage, + MsgSwapExactAmountOutMessage, + MsgJoinSwapShareAmountOutMessage, +} from "../types/CosmosMessageTypes"; +import { Pool, Swap, SwapRoute, Direction, Message } from "../types"; + +async function checkGetPool(id: string): Promise { + // Check that the pool exists and create new ones if now + let pool = await Pool.get(id); + if (!pool) { + pool = new Pool(id); + await pool.save(); + } + return pool; +} + +export async function handleMsgSwapExactAmountOut( + msg: MsgSwapExactAmountOutMessage +): Promise { + // We first create a new swap record + const swap = Swap.create({ + id: `${msg.tx.hash}-${msg.idx}`, + txHash: msg.tx.hash, + blockHeight: BigInt(msg.block.block.header.height), + sender: msg.msg.decodedMsg.sender, + direction: Direction.IN, + message: Message.MsgSwapExactAmountIn, + tokenOutDenom: msg.msg.decodedMsg.tokenOut.denom, + tokenOutAmount: msg.msg.decodedMsg.tokenOut + ? BigInt(msg.msg.decodedMsg.tokenOut.amount) + : undefined, + tokenInMax: BigInt(msg.msg.decodedMsg.tokenInMaxAmount), + datetime: new Date(msg.block.header.time.toISOString()), + }); + + // Save this to the DB + await swap.save(); + + // Create swap routes from the array on the message + let lastTokenOutDenom = swap.tokenOutDenom; + for (const route of msg.msg.decodedMsg.routes) { + const index = msg.msg.decodedMsg.routes.indexOf(route); + // Check that the pool aready exists + const pool = await checkGetPool(route.poolId.toString()); + + const swapRoute = SwapRoute.create({ + id: `${msg.tx.hash}-${msg.idx}-${index}`, + poolId: pool.id, + swapId: swap.id, + tokenInDenom: route.tokenInDenom, + tokenOutDenom: lastTokenOutDenom, + }); + lastTokenOutDenom = route.tokenInDenom; + await swapRoute.save(); + } +} + +export async function handleMsgJoinSwapShareAmountOut( + msg: MsgJoinSwapShareAmountOutMessage +): Promise { + // We first create a new swap record + const swap = Swap.create({ + id: `${msg.tx.hash}-${msg.idx}`, + txHash: msg.tx.hash, + blockHeight: BigInt(msg.block.block.header.height), + sender: msg.msg.decodedMsg.sender, + direction: Direction.IN, + message: Message.MsgJoinSwapShareAmountOut, + tokenInDenom: msg.msg.decodedMsg.tokenInDenom, + tokenInMax: BigInt(msg.msg.decodedMsg.tokenInMaxAmount), + tokenOutAmount: BigInt(msg.msg.decodedMsg.shareOutAmount), + + datetime: new Date(msg.block.header.time.toISOString()), + }); + + // Save this to the DB + await swap.save(); + + // Create swap routes from the array on the message + const pool = await checkGetPool(msg.msg.decodedMsg.poolId.toString()); + + const swapRoute = SwapRoute.create({ + id: `${msg.tx.hash}-${msg.idx}`, + poolId: pool.id, + swapId: swap.id, + tokenInDenom: msg.msg.decodedMsg.tokenInDenom, + }); + await swapRoute.save(); +} + +export async function handleMsgSwapExactAmountIn( + msg: MsgSwapExactAmountInMessage +): Promise { + // We first create a new swap record + const swap = Swap.create({ + id: `${msg.tx.hash}-${msg.idx}`, + txHash: msg.tx.hash, + blockHeight: BigInt(msg.block.block.header.height), + sender: msg.msg.decodedMsg.sender, + direction: Direction.IN, + message: Message.MsgSwapExactAmountIn, + tokenInDenom: msg.msg.decodedMsg.tokenIn?.denom, + tokenInAmount: msg.msg.decodedMsg.tokenIn + ? BigInt(msg.msg.decodedMsg.tokenIn.amount) + : undefined, + tokenOutMin: BigInt(msg.msg.decodedMsg.tokenOutMinAmount), + datetime: new Date(msg.block.header.time.toISOString()), + }); + + // Save this to the DB + await swap.save(); + + // Create swap routes from the array on the message + let lastTokenOutDenom = swap.tokenInDenom; + for (const route of msg.msg.decodedMsg.routes) { + const index = msg.msg.decodedMsg.routes.indexOf(route); + // Check that the pool aready exists + const pool = await checkGetPool(route.poolId.toString()); + + const swapRoute = SwapRoute.create({ + id: `${msg.tx.hash}-${msg.idx}-${index}`, + poolId: pool.id, + swapId: swap.id, + tokenInDenom: lastTokenOutDenom, + tokenOutDenom: route.tokenOutDenom, + }); + lastTokenOutDenom = route.tokenOutDenom; + await swapRoute.save(); + } +} diff --git a/Osmosis/osmosis-starter-enhanced/tsconfig.json b/Osmosis/osmosis-starter-enhanced/tsconfig.json new file mode 100644 index 000000000..f3019d720 --- /dev/null +++ b/Osmosis/osmosis-starter-enhanced/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "esModuleInterop": true, + "declaration": true, + "importHelpers": true, + "resolveJsonModule": true, + "module": "commonjs", + "outDir": "dist", + "rootDir": "src", + "target": "es2017", + "strict": true + }, + "include": [ + "src/**/*", + "node_modules/@subql/types-core/dist/global.d.ts", + "node_modules/@subql/types-cosmos/dist/global.d.ts" + ] +}