diff --git a/.gitignore b/.gitignore index bbbe817346..05ae345c17 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ v4-proto-py/v4_proto v4-proto-js/build v4-proto-js/node_modules v4-proto-js/src +v4-proto-rs/target +v4-proto-rs/Cargo.lock .idea .vscode diff --git a/v4-proto-rs/Cargo.toml b/v4-proto-rs/Cargo.toml new file mode 100644 index 0000000000..a76ce4d45c --- /dev/null +++ b/v4-proto-rs/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "v4-proto-rs" +version = "0.1.0" +edition = "2021" +license = "AGPL-3.0" + +[lib] +doctest = false + +[dependencies] +cosmos-sdk-proto = "0.21.1" +tonic = { version = "0.11", features = ["tls", "tls-roots", "transport", "channel"] } +prost = "0.12" +prost-types = "0.12" + +[build-dependencies] +tonic-buf-build = "0.2.1" +prost-build = "0.12" # keep the version the same as in tonic-buf-build +tonic-build = "0.11" # keep the version the same as in tonic-buf-build diff --git a/v4-proto-rs/README.md b/v4-proto-rs/README.md new file mode 100644 index 0000000000..551c7d6ce0 --- /dev/null +++ b/v4-proto-rs/README.md @@ -0,0 +1,62 @@ +# Rust crate for dYdX Chain protobufs + +## Usage as a dependency + +Cargo.toml + +```toml +[dependencies] +v4-proto-rs = "0.1" +``` + +*Note:* by default, rust stub files are not rebuilt (see Q&A below) + +For more idiomatic Rust you can use conversions (`try_into` and `into`) for the following types: +* `prost_types::Timestamp` -> `std::time::SystemTime` +* `prost_types::Duration`-> `std::time::Duration` + +## Local development + +### Prerequisites +1) [Rust](https://www.rust-lang.org/tools/install) +2) [Buf](https://github.com/bufbuild/buf?tab=readme-ov-file#installation) - to resolve 3rd-party dependencies for protobuf files +3) [protoc](https://github.com/protocolbuffers/protobuf#protobuf-compiler-installation) - to compile protobuf files with their 3rd-party dependencies +4) [cargo deny](https://github.com/EmbarkStudios/cargo-deny) - to check for security/license/sources issues + +Then for a code (re-)generation run + +```sh +V4_PROTO_REBUILD=1 cargo build -vv +``` + +Before publishing make sure to run (and fix all warnings and errors) + +```sh +cargo fmt +cargo clippy +cargo deny check licenses advisories sources +``` + +## Q&A + +1) Why do we put autogenerated files to the crate (and git) and do not (re-)generate them at compilation? + + For several reasons: + * reproducibility of the dependency + * to avoid external dependencies for the lib users (`protoc` and `buf` are only needed for code generation) + + But if a user wants to (re-)generate at compilation time, he/she can set an environment variable `V4_PROTO_REBUILD` (to any value). + +2) Why do I need a `protoc` for this crate development? I thought `prost-build` crate generates everything natively with Rust? + + The main work (parsing, linking, etc. - have a look https://protobuf.com/docs/descriptors) is done by `protoc`. + The result of the `protoc` work is a "file descriptor" (think of it as IR assembly language like LLVM IR) - a binary file. This file descriptor is an input for a language-specific code generator like `prost`. Think of `prost` crate as a compiler target which generates a ISA-specific "assembly" (in our case, Rust) as an output. + `prost-build` always used the `protoc` but since version 0.11 of [prost-build](https://github.com/tokio-rs/prost?tab=readme-ov-file#protoc) it requires `protoc` (the protobuf compiler) to be already installed on the system - before the `protoc` could be compiled during the `prost-build` build (https://github.com/tokio-rs/prost/blob/v0.10.4/prost-build/build.rs#L77). + +3) Why do we use `tonic-build` crate and not just `prost-build`? + + `prost-build` generates only serialization-deserialization stubs for messages, but we also need a client implementation (generated by `tonic-build`) because packages in other language implementations of `v4-chain` have ones. + +4) Why do we need `buf`? + + [Buf](https://buf.build/) is a tool whose primary function is to resolve dependencies in protobuf files. Protobuf specifications can refer to 3rd-party protobuf specifications and use types declared there. Basically, `buf` builds a list of all used protobuf files, downloads them, and allows exporting (=copying) them to a specified directory. The proto files in this repository and downloaded 3rd-party proto files (aka "includes") are an input for the `protoc`. diff --git a/v4-proto-rs/build.rs b/v4-proto-rs/build.rs new file mode 100644 index 0000000000..dfad90ed8c --- /dev/null +++ b/v4-proto-rs/build.rs @@ -0,0 +1,28 @@ +use prost_build::Config; +use std::env; +use std::path::PathBuf; + +fn main() -> Result<(), tonic_buf_build::error::TonicBufBuildError> { + if std::env::var("V4_PROTO_REBUILD").is_ok() { + let mut config = Config::new(); + config.out_dir("src"); + config.include_file("_includes.rs"); + config.enable_type_names(); + let mut path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").map_err(|e| { + tonic_buf_build::error::TonicBufBuildError { + message: format!("Failed to get CARGO_MANIFEST_DIR: {}", e), + cause: None, + } + })?); + path.pop(); + tonic_buf_build::compile_from_buf_workspace_with_config( + tonic_build::configure().build_server(false), + Some(config), + tonic_buf_build::TonicBufConfig { + buf_dir: Some(path), + }, + )?; + } + + Ok(()) +} diff --git a/v4-proto-rs/deny.toml b/v4-proto-rs/deny.toml new file mode 100644 index 0000000000..198bd0af13 --- /dev/null +++ b/v4-proto-rs/deny.toml @@ -0,0 +1,56 @@ +[graph] +targets = [ + { triple = "x86_64-unknown-linux-gnu" }, + { triple = "aarch64-unknown-linux-gnu" }, + { triple = "x86_64-unknown-linux-musl" }, + { triple = "aarch64-apple-darwin" }, + { triple = "x86_64-apple-darwin" }, + { triple = "x86_64-pc-windows-msvc" }, +] +all-features = false +no-default-features = false + +[output] +feature-depth = 1 + +[advisories] +db-path = "~/.cargo/advisory-db" +db-urls = ["https://github.com/rustsec/advisory-db"] + +[licenses] +allow = [ + "MIT", + "Apache-2.0", + "BSD-3-Clause", + "ISC", + "Unicode-DFS-2016", + "OpenSSL", +] +confidence-threshold = 0.8 +exceptions = [] + +[[licenses.clarify]] +name = "ring" +expression = "MIT AND ISC AND OpenSSL" +license-files = [ + { path = "LICENSE", hash = 0xbd0eed23 } +] + +[licenses.private] +ignore = false +registries = [] + +[bans] +multiple-versions = "warn" +wildcards = "allow" +highlight = "all" + +[sources] +unknown-registry = "warn" +unknown-git = "warn" +allow-registry = ["https://github.com/rust-lang/crates.io-index"] + +[sources.allow-org] +github = [] +gitlab = [] +bitbucket = [] \ No newline at end of file diff --git a/v4-proto-rs/src/_includes.rs b/v4-proto-rs/src/_includes.rs new file mode 100644 index 0000000000..edcb46e6a8 --- /dev/null +++ b/v4-proto-rs/src/_includes.rs @@ -0,0 +1,110 @@ +// This file is @generated by prost-build. +pub mod cosmos { + pub mod base { + pub mod query { + pub mod v1beta1 { + include!("cosmos.base.query.v1beta1.rs"); + } + } + pub mod v1beta1 { + include!("cosmos.base.v1beta1.rs"); + } + } +} +pub mod cosmos_proto { + include!("cosmos_proto.rs"); +} +pub mod dydxprotocol { + pub mod assets { + include!("dydxprotocol.assets.rs"); + } + pub mod blocktime { + include!("dydxprotocol.blocktime.rs"); + } + pub mod bridge { + include!("dydxprotocol.bridge.rs"); + } + pub mod clob { + include!("dydxprotocol.clob.rs"); + } + pub mod daemons { + pub mod bridge { + include!("dydxprotocol.daemons.bridge.rs"); + } + pub mod liquidation { + include!("dydxprotocol.daemons.liquidation.rs"); + } + pub mod pricefeed { + include!("dydxprotocol.daemons.pricefeed.rs"); + } + } + pub mod delaymsg { + include!("dydxprotocol.delaymsg.rs"); + } + pub mod epochs { + include!("dydxprotocol.epochs.rs"); + } + pub mod feetiers { + include!("dydxprotocol.feetiers.rs"); + } + pub mod govplus { + include!("dydxprotocol.govplus.rs"); + } + pub mod indexer { + pub mod events { + include!("dydxprotocol.indexer.events.rs"); + } + pub mod indexer_manager { + include!("dydxprotocol.indexer.indexer_manager.rs"); + } + pub mod off_chain_updates { + include!("dydxprotocol.indexer.off_chain_updates.rs"); + } + pub mod protocol { + pub mod v1 { + include!("dydxprotocol.indexer.protocol.v1.rs"); + } + } + pub mod redis { + include!("dydxprotocol.indexer.redis.rs"); + } + pub mod shared { + include!("dydxprotocol.indexer.shared.rs"); + } + pub mod socks { + include!("dydxprotocol.indexer.socks.rs"); + } + } + pub mod perpetuals { + include!("dydxprotocol.perpetuals.rs"); + } + pub mod prices { + include!("dydxprotocol.prices.rs"); + } + pub mod ratelimit { + include!("dydxprotocol.ratelimit.rs"); + } + pub mod rewards { + include!("dydxprotocol.rewards.rs"); + } + pub mod sending { + include!("dydxprotocol.sending.rs"); + } + pub mod stats { + include!("dydxprotocol.stats.rs"); + } + pub mod subaccounts { + include!("dydxprotocol.subaccounts.rs"); + } + pub mod vault { + include!("dydxprotocol.vault.rs"); + } + pub mod vest { + include!("dydxprotocol.vest.rs"); + } +} +pub mod google { + pub mod api { + include!("google.api.rs"); + } +} diff --git a/v4-proto-rs/src/cosmos.base.query.v1beta1.rs b/v4-proto-rs/src/cosmos.base.query.v1beta1.rs new file mode 100644 index 0000000000..dc11f529f4 --- /dev/null +++ b/v4-proto-rs/src/cosmos.base.query.v1beta1.rs @@ -0,0 +1,77 @@ +// This file is @generated by prost-build. +/// PageRequest is to be embedded in gRPC request messages for efficient +/// pagination. Ex: +/// +/// message SomeRequest { +/// Foo some_parameter = 1; +/// PageRequest pagination = 2; +/// } +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct 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. + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + /// 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. + #[prost(uint64, tag = "2")] + pub offset: u64, + /// 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. + #[prost(uint64, tag = "3")] + pub limit: u64, + /// 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. + #[prost(bool, tag = "4")] + pub count_total: bool, + /// reverse is set to true if results are to be returned in the descending order. + /// + /// Since: cosmos-sdk 0.43 + #[prost(bool, tag = "5")] + pub reverse: bool, +} +impl ::prost::Name for PageRequest { + const NAME: &'static str = "PageRequest"; + const PACKAGE: &'static str = "cosmos.base.query.v1beta1"; + fn full_name() -> ::prost::alloc::string::String { + "cosmos.base.query.v1beta1.PageRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/cosmos.base.query.v1beta1.PageRequest".into() + } +} +/// 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; +/// } +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PageResponse { + /// next_key is the key to be passed to PageRequest.key to + /// query the next page most efficiently. It will be empty if + /// there are no more results. + #[prost(bytes = "vec", tag = "1")] + pub next_key: ::prost::alloc::vec::Vec, + /// total is total number of results available if PageRequest.count_total + /// was set, its value is undefined otherwise + #[prost(uint64, tag = "2")] + pub total: u64, +} +impl ::prost::Name for PageResponse { + const NAME: &'static str = "PageResponse"; + const PACKAGE: &'static str = "cosmos.base.query.v1beta1"; + fn full_name() -> ::prost::alloc::string::String { + "cosmos.base.query.v1beta1.PageResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/cosmos.base.query.v1beta1.PageResponse".into() + } +} diff --git a/v4-proto-rs/src/cosmos.base.v1beta1.rs b/v4-proto-rs/src/cosmos.base.v1beta1.rs new file mode 100644 index 0000000000..8a61cfab7a --- /dev/null +++ b/v4-proto-rs/src/cosmos.base.v1beta1.rs @@ -0,0 +1,81 @@ +// This file is @generated by prost-build. +/// 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. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Coin { + #[prost(string, tag = "1")] + pub denom: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub amount: ::prost::alloc::string::String, +} +impl ::prost::Name for Coin { + const NAME: &'static str = "Coin"; + const PACKAGE: &'static str = "cosmos.base.v1beta1"; + fn full_name() -> ::prost::alloc::string::String { + "cosmos.base.v1beta1.Coin".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/cosmos.base.v1beta1.Coin".into() + } +} +/// 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. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DecCoin { + #[prost(string, tag = "1")] + pub denom: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub amount: ::prost::alloc::string::String, +} +impl ::prost::Name for DecCoin { + const NAME: &'static str = "DecCoin"; + const PACKAGE: &'static str = "cosmos.base.v1beta1"; + fn full_name() -> ::prost::alloc::string::String { + "cosmos.base.v1beta1.DecCoin".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/cosmos.base.v1beta1.DecCoin".into() + } +} +/// IntProto defines a Protobuf wrapper around an Int object. +/// Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IntProto { + #[prost(string, tag = "1")] + pub int: ::prost::alloc::string::String, +} +impl ::prost::Name for IntProto { + const NAME: &'static str = "IntProto"; + const PACKAGE: &'static str = "cosmos.base.v1beta1"; + fn full_name() -> ::prost::alloc::string::String { + "cosmos.base.v1beta1.IntProto".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/cosmos.base.v1beta1.IntProto".into() + } +} +/// DecProto defines a Protobuf wrapper around a Dec object. +/// Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DecProto { + #[prost(string, tag = "1")] + pub dec: ::prost::alloc::string::String, +} +impl ::prost::Name for DecProto { + const NAME: &'static str = "DecProto"; + const PACKAGE: &'static str = "cosmos.base.v1beta1"; + fn full_name() -> ::prost::alloc::string::String { + "cosmos.base.v1beta1.DecProto".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/cosmos.base.v1beta1.DecProto".into() + } +} diff --git a/v4-proto-rs/src/cosmos_proto.rs b/v4-proto-rs/src/cosmos_proto.rs new file mode 100644 index 0000000000..e45172e7ee --- /dev/null +++ b/v4-proto-rs/src/cosmos_proto.rs @@ -0,0 +1,94 @@ +// This file is @generated by prost-build. +/// InterfaceDescriptor describes an interface type to be used with +/// accepts_interface and implements_interface and declared by declare_interface. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InterfaceDescriptor { + /// name is the name of the interface. It should be a short-name (without + /// a period) such that the fully qualified name of the interface will be + /// package.name, ex. for the package a.b and interface named C, the + /// fully-qualified name will be a.b.C. + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + /// description is a human-readable description of the interface and its + /// purpose. + #[prost(string, tag = "2")] + pub description: ::prost::alloc::string::String, +} +impl ::prost::Name for InterfaceDescriptor { + const NAME: &'static str = "InterfaceDescriptor"; + const PACKAGE: &'static str = "cosmos_proto"; + fn full_name() -> ::prost::alloc::string::String { + "cosmos_proto.InterfaceDescriptor".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/cosmos_proto.InterfaceDescriptor".into() + } +} +/// ScalarDescriptor describes an scalar type to be used with +/// the scalar field option and declared by declare_scalar. +/// Scalars extend simple protobuf built-in types with additional +/// syntax and semantics, for instance to represent big integers. +/// Scalars should ideally define an encoding such that there is only one +/// valid syntactical representation for a given semantic meaning, +/// i.e. the encoding should be deterministic. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ScalarDescriptor { + /// name is the name of the scalar. It should be a short-name (without + /// a period) such that the fully qualified name of the scalar will be + /// package.name, ex. for the package a.b and scalar named C, the + /// fully-qualified name will be a.b.C. + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + /// description is a human-readable description of the scalar and its + /// encoding format. For instance a big integer or decimal scalar should + /// specify precisely the expected encoding format. + #[prost(string, tag = "2")] + pub description: ::prost::alloc::string::String, + /// field_type is the type of field with which this scalar can be used. + /// Scalars can be used with one and only one type of field so that + /// encoding standards and simple and clear. Currently only string and + /// bytes fields are supported for scalars. + #[prost(enumeration = "ScalarType", repeated, tag = "3")] + pub field_type: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for ScalarDescriptor { + const NAME: &'static str = "ScalarDescriptor"; + const PACKAGE: &'static str = "cosmos_proto"; + fn full_name() -> ::prost::alloc::string::String { + "cosmos_proto.ScalarDescriptor".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/cosmos_proto.ScalarDescriptor".into() + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ScalarType { + Unspecified = 0, + String = 1, + Bytes = 2, +} +impl ScalarType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ScalarType::Unspecified => "SCALAR_TYPE_UNSPECIFIED", + ScalarType::String => "SCALAR_TYPE_STRING", + ScalarType::Bytes => "SCALAR_TYPE_BYTES", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SCALAR_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "SCALAR_TYPE_STRING" => Some(Self::String), + "SCALAR_TYPE_BYTES" => Some(Self::Bytes), + _ => None, + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.assets.rs b/v4-proto-rs/src/dydxprotocol.assets.rs new file mode 100644 index 0000000000..04c175b7d0 --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.assets.rs @@ -0,0 +1,371 @@ +// This file is @generated by prost-build. +/// Asset defines a single exchangable asset. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Asset { + /// Unique, sequentially-generated. + #[prost(uint32, tag = "1")] + pub id: u32, + /// The human readable symbol of the `Asset` (e.g. `USDC`, `ATOM`). + /// Must be uppercase, unique and correspond to the canonical symbol of the + /// full coin. + #[prost(string, tag = "2")] + pub symbol: ::prost::alloc::string::String, + /// The name of base denomination unit of the `Asset` (e.g. `uatom`, + /// 'ibc/xxxxx'). Must be unique and match the `denom` used in the `sdk.Coin` + /// type in the `x/bank` module. + #[prost(string, tag = "3")] + pub denom: ::prost::alloc::string::String, + /// The exponent of converting one unit of `denom` to a full coin. + /// For example, `name=USDC, denom=uusdc, denom_exponent=-6` defines that + /// `1 uusdc = 10^(-6) USDC`. Note that `uusdc` refers to a `Coin` type in + /// `x/bank`, where the prefix `u` means `micro` by convetion. `uusdc` is + /// a different concept from a "quantum" defined by `atomic_resolution` below. + /// To convert from an amount of `denom` to quantums: + /// `quantums = denom_amount * 10^(denom_exponent - atomic_resolution)` + #[prost(sint32, tag = "4")] + pub denom_exponent: i32, + /// `true` if this `Asset` has a valid `MarketId` value. + #[prost(bool, tag = "5")] + pub has_market: bool, + /// The `Id` of the `Market` associated with this `Asset`. It acts as the + /// oracle price for the purposes of calculating collateral + /// and margin requirements. + #[prost(uint32, tag = "6")] + pub market_id: u32, + /// The exponent for converting an atomic amount (1 'quantum') + /// to a full coin. For example, if `atomic_resolution = -8` + /// then an `asset_position` with `base_quantums = 1e8` is equivalent to + /// a position size of one full coin. + #[prost(sint32, tag = "7")] + pub atomic_resolution: i32, +} +impl ::prost::Name for Asset { + const NAME: &'static str = "Asset"; + const PACKAGE: &'static str = "dydxprotocol.assets"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.assets.Asset".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.assets.Asset".into() + } +} +/// GenesisState defines the assets module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, repeated, tag = "1")] + pub assets: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.assets"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.assets.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.assets.GenesisState".into() + } +} +/// Queries an Asset by id. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAssetRequest { + #[prost(uint32, tag = "1")] + pub id: u32, +} +impl ::prost::Name for QueryAssetRequest { + const NAME: &'static str = "QueryAssetRequest"; + const PACKAGE: &'static str = "dydxprotocol.assets"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.assets.QueryAssetRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.assets.QueryAssetRequest".into() + } +} +/// QueryAssetResponse is response type for the Asset RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAssetResponse { + #[prost(message, optional, tag = "1")] + pub asset: ::core::option::Option, +} +impl ::prost::Name for QueryAssetResponse { + const NAME: &'static str = "QueryAssetResponse"; + const PACKAGE: &'static str = "dydxprotocol.assets"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.assets.QueryAssetResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.assets.QueryAssetResponse".into() + } +} +/// Queries a list of Asset items. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllAssetsRequest { + #[prost(message, optional, tag = "1")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageRequest, + >, +} +impl ::prost::Name for QueryAllAssetsRequest { + const NAME: &'static str = "QueryAllAssetsRequest"; + const PACKAGE: &'static str = "dydxprotocol.assets"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.assets.QueryAllAssetsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.assets.QueryAllAssetsRequest".into() + } +} +/// QueryAllAssetsResponse is response type for the AllAssets RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllAssetsResponse { + #[prost(message, repeated, tag = "1")] + pub asset: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageResponse, + >, +} +impl ::prost::Name for QueryAllAssetsResponse { + const NAME: &'static str = "QueryAllAssetsResponse"; + const PACKAGE: &'static str = "dydxprotocol.assets"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.assets.QueryAllAssetsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.assets.QueryAllAssetsResponse".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Queries a Asset by id. + pub async fn asset( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.assets.Query/Asset", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.assets.Query", "Asset")); + self.inner.unary(req, path, codec).await + } + /// Queries a list of Asset items. + pub async fn all_assets( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.assets.Query/AllAssets", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.assets.Query", "AllAssets")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated client implementations. +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.blocktime.rs b/v4-proto-rs/src/dydxprotocol.blocktime.rs new file mode 100644 index 0000000000..c92356fc7b --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.blocktime.rs @@ -0,0 +1,520 @@ +// This file is @generated by prost-build. +/// BlockInfo stores information about a block +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockInfo { + #[prost(uint32, tag = "1")] + pub height: u32, + #[prost(message, optional, tag = "2")] + pub timestamp: ::core::option::Option<::prost_types::Timestamp>, +} +impl ::prost::Name for BlockInfo { + const NAME: &'static str = "BlockInfo"; + const PACKAGE: &'static str = "dydxprotocol.blocktime"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.blocktime.BlockInfo".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.blocktime.BlockInfo".into() + } +} +/// AllDowntimeInfo stores information for all downtime durations. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AllDowntimeInfo { + /// The downtime information for each tracked duration. Sorted by duration, + /// ascending. (i.e. the same order as they appear in DowntimeParams). + #[prost(message, repeated, tag = "1")] + pub infos: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `AllDowntimeInfo`. +pub mod all_downtime_info { + /// Stores information about downtime. block_info corresponds to the most + /// recent block at which a downtime occurred. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct DowntimeInfo { + #[prost(message, optional, tag = "1")] + pub duration: ::core::option::Option<::prost_types::Duration>, + #[prost(message, optional, tag = "2")] + pub block_info: ::core::option::Option, + } + impl ::prost::Name for DowntimeInfo { + const NAME: &'static str = "DowntimeInfo"; + const PACKAGE: &'static str = "dydxprotocol.blocktime"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.blocktime.AllDowntimeInfo.DowntimeInfo".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.blocktime.AllDowntimeInfo.DowntimeInfo".into() + } + } +} +impl ::prost::Name for AllDowntimeInfo { + const NAME: &'static str = "AllDowntimeInfo"; + const PACKAGE: &'static str = "dydxprotocol.blocktime"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.blocktime.AllDowntimeInfo".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.blocktime.AllDowntimeInfo".into() + } +} +/// DowntimeParams defines the parameters for downtime. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DowntimeParams { + /// Durations tracked for downtime. The durations must be sorted from + /// shortest to longest and must all be positive. + #[prost(message, repeated, tag = "1")] + pub durations: ::prost::alloc::vec::Vec<::prost_types::Duration>, +} +impl ::prost::Name for DowntimeParams { + const NAME: &'static str = "DowntimeParams"; + const PACKAGE: &'static str = "dydxprotocol.blocktime"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.blocktime.DowntimeParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.blocktime.DowntimeParams".into() + } +} +/// GenesisState defines the blocktime module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.blocktime"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.blocktime.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.blocktime.GenesisState".into() + } +} +/// QueryDowntimeParamsRequest is a request type for the DowntimeParams +/// RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDowntimeParamsRequest {} +impl ::prost::Name for QueryDowntimeParamsRequest { + const NAME: &'static str = "QueryDowntimeParamsRequest"; + const PACKAGE: &'static str = "dydxprotocol.blocktime"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.blocktime.QueryDowntimeParamsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.blocktime.QueryDowntimeParamsRequest".into() + } +} +/// QueryDowntimeParamsResponse is a response type for the DowntimeParams +/// RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDowntimeParamsResponse { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +impl ::prost::Name for QueryDowntimeParamsResponse { + const NAME: &'static str = "QueryDowntimeParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.blocktime"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.blocktime.QueryDowntimeParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.blocktime.QueryDowntimeParamsResponse".into() + } +} +/// QueryPreviousBlockInfoRequest is a request type for the PreviousBlockInfo +/// RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPreviousBlockInfoRequest {} +impl ::prost::Name for QueryPreviousBlockInfoRequest { + const NAME: &'static str = "QueryPreviousBlockInfoRequest"; + const PACKAGE: &'static str = "dydxprotocol.blocktime"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.blocktime.QueryPreviousBlockInfoRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.blocktime.QueryPreviousBlockInfoRequest".into() + } +} +/// QueryPreviousBlockInfoResponse is a request type for the PreviousBlockInfo +/// RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPreviousBlockInfoResponse { + #[prost(message, optional, tag = "1")] + pub info: ::core::option::Option, +} +impl ::prost::Name for QueryPreviousBlockInfoResponse { + const NAME: &'static str = "QueryPreviousBlockInfoResponse"; + const PACKAGE: &'static str = "dydxprotocol.blocktime"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.blocktime.QueryPreviousBlockInfoResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.blocktime.QueryPreviousBlockInfoResponse".into() + } +} +/// QueryAllDowntimeInfoRequest is a request type for the AllDowntimeInfo +/// RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllDowntimeInfoRequest {} +impl ::prost::Name for QueryAllDowntimeInfoRequest { + const NAME: &'static str = "QueryAllDowntimeInfoRequest"; + const PACKAGE: &'static str = "dydxprotocol.blocktime"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.blocktime.QueryAllDowntimeInfoRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.blocktime.QueryAllDowntimeInfoRequest".into() + } +} +/// QueryAllDowntimeInfoResponse is a request type for the AllDowntimeInfo +/// RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllDowntimeInfoResponse { + #[prost(message, optional, tag = "1")] + pub info: ::core::option::Option, +} +impl ::prost::Name for QueryAllDowntimeInfoResponse { + const NAME: &'static str = "QueryAllDowntimeInfoResponse"; + const PACKAGE: &'static str = "dydxprotocol.blocktime"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.blocktime.QueryAllDowntimeInfoResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.blocktime.QueryAllDowntimeInfoResponse".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Queries the DowntimeParams. + pub async fn downtime_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.blocktime.Query/DowntimeParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.blocktime.Query", "DowntimeParams"), + ); + self.inner.unary(req, path, codec).await + } + /// Queries the information of the previous block + pub async fn previous_block_info( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.blocktime.Query/PreviousBlockInfo", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.blocktime.Query", "PreviousBlockInfo"), + ); + self.inner.unary(req, path, codec).await + } + /// Queries all recorded downtime info. + pub async fn all_downtime_info( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.blocktime.Query/AllDowntimeInfo", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.blocktime.Query", "AllDowntimeInfo"), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// MsgUpdateDowntimeParams is the Msg/UpdateDowntimeParams request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateDowntimeParams { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// Defines the parameters to update. All parameters must be supplied. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +impl ::prost::Name for MsgUpdateDowntimeParams { + const NAME: &'static str = "MsgUpdateDowntimeParams"; + const PACKAGE: &'static str = "dydxprotocol.blocktime"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.blocktime.MsgUpdateDowntimeParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.blocktime.MsgUpdateDowntimeParams".into() + } +} +/// MsgUpdateDowntimeParamsResponse is the Msg/UpdateDowntimeParams response +/// type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateDowntimeParamsResponse {} +impl ::prost::Name for MsgUpdateDowntimeParamsResponse { + const NAME: &'static str = "MsgUpdateDowntimeParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.blocktime"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.blocktime.MsgUpdateDowntimeParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.blocktime.MsgUpdateDowntimeParamsResponse".into() + } +} +/// Generated client implementations. +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// UpdateDowntimeParams updates the DowntimeParams in state. + pub async fn update_downtime_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.blocktime.Msg/UpdateDowntimeParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.blocktime.Msg", "UpdateDowntimeParams"), + ); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.bridge.rs b/v4-proto-rs/src/dydxprotocol.bridge.rs new file mode 100644 index 0000000000..43d0e28ca0 --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.bridge.rs @@ -0,0 +1,1033 @@ +// This file is @generated by prost-build. +/// BridgeEvent is a recognized event from the Ethereum blockchain. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BridgeEvent { + /// The unique id of the Ethereum event log. + #[prost(uint32, tag = "1")] + pub id: u32, + /// The tokens bridged. + #[prost(message, optional, tag = "2")] + pub coin: ::core::option::Option, + /// The account address or module address to bridge to. + #[prost(string, tag = "3")] + pub address: ::prost::alloc::string::String, + /// The Ethereum block height of the event. + #[prost(uint64, tag = "4")] + pub eth_block_height: u64, +} +impl ::prost::Name for BridgeEvent { + const NAME: &'static str = "BridgeEvent"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.BridgeEvent".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.BridgeEvent".into() + } +} +/// BridgeEventInfo stores information about the most recently processed bridge +/// event. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BridgeEventInfo { + /// The next event id (the last processed id plus one) of the logs from the + /// Ethereum contract. + #[prost(uint32, tag = "1")] + pub next_id: u32, + /// The Ethereum block height of the most recently processed bridge event. + #[prost(uint64, tag = "2")] + pub eth_block_height: u64, +} +impl ::prost::Name for BridgeEventInfo { + const NAME: &'static str = "BridgeEventInfo"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.BridgeEventInfo".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.BridgeEventInfo".into() + } +} +/// EventParams stores parameters about which events to recognize and which +/// tokens to mint. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventParams { + /// The denom of the token to mint. + #[prost(string, tag = "1")] + pub denom: ::prost::alloc::string::String, + /// The numerical chain ID of the Ethereum chain to query. + #[prost(uint64, tag = "2")] + pub eth_chain_id: u64, + /// The address of the Ethereum contract to monitor for logs. + #[prost(string, tag = "3")] + pub eth_address: ::prost::alloc::string::String, +} +impl ::prost::Name for EventParams { + const NAME: &'static str = "EventParams"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.EventParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.EventParams".into() + } +} +/// ProposeParams stores parameters for proposing to the module. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProposeParams { + /// The maximum number of bridge events to propose per block. + /// Limits the number of events to propose in a single block + /// in-order to smooth out the flow of events. + #[prost(uint32, tag = "1")] + pub max_bridges_per_block: u32, + /// The minimum duration to wait between a finalized bridge and + /// proposing it. This allows other validators to have enough time to + /// also recognize its occurence. Therefore the bridge daemon should + /// pool for new finalized events at least as often as this parameter. + #[prost(message, optional, tag = "2")] + pub propose_delay_duration: ::core::option::Option<::prost_types::Duration>, + /// Do not propose any events if a [0, 1_000_000) random number generator + /// generates a number smaller than this number. + /// Setting this parameter to 1_000_000 means always skipping proposing events. + #[prost(uint32, tag = "3")] + pub skip_rate_ppm: u32, + /// Do not propose any events if the timestamp of the proposal block is + /// behind the proposers' wall-clock by at least this duration. + #[prost(message, optional, tag = "4")] + pub skip_if_block_delayed_by_duration: ::core::option::Option< + ::prost_types::Duration, + >, +} +impl ::prost::Name for ProposeParams { + const NAME: &'static str = "ProposeParams"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.ProposeParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.ProposeParams".into() + } +} +/// SafetyParams stores safety parameters for the module. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SafetyParams { + /// True if bridging is disabled. + #[prost(bool, tag = "1")] + pub is_disabled: bool, + /// The number of blocks that bridges accepted in-consensus will be pending + /// until the minted tokens are granted. + #[prost(uint32, tag = "2")] + pub delay_blocks: u32, +} +impl ::prost::Name for SafetyParams { + const NAME: &'static str = "SafetyParams"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.SafetyParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.SafetyParams".into() + } +} +/// GenesisState defines the bridge module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// The parameters of the module. + #[prost(message, optional, tag = "1")] + pub event_params: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub propose_params: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub safety_params: ::core::option::Option, + /// Acknowledged event info that stores: + /// - the next event ID to be added to consensus. + /// - Ethereum block height of the most recently acknowledged bridge event. + #[prost(message, optional, tag = "4")] + pub acknowledged_event_info: ::core::option::Option, +} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.GenesisState".into() + } +} +/// MsgAcknowledgeBridges is the Msg/AcknowledgeBridges request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgAcknowledgeBridges { + /// The events to acknowledge. + #[prost(message, repeated, tag = "1")] + pub events: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for MsgAcknowledgeBridges { + const NAME: &'static str = "MsgAcknowledgeBridges"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.MsgAcknowledgeBridges".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.MsgAcknowledgeBridges".into() + } +} +/// MsgAcknowledgeBridgesResponse is the Msg/AcknowledgeBridgesResponse response +/// type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgAcknowledgeBridgesResponse {} +impl ::prost::Name for MsgAcknowledgeBridgesResponse { + const NAME: &'static str = "MsgAcknowledgeBridgesResponse"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.MsgAcknowledgeBridgesResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.MsgAcknowledgeBridgesResponse".into() + } +} +/// MsgCompleteBridge is the Msg/CompleteBridgeResponse request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCompleteBridge { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// The event to complete. + #[prost(message, optional, tag = "2")] + pub event: ::core::option::Option, +} +impl ::prost::Name for MsgCompleteBridge { + const NAME: &'static str = "MsgCompleteBridge"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.MsgCompleteBridge".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.MsgCompleteBridge".into() + } +} +/// MsgCompleteBridgeResponse is the Msg/CompleteBridgeResponse response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCompleteBridgeResponse {} +impl ::prost::Name for MsgCompleteBridgeResponse { + const NAME: &'static str = "MsgCompleteBridgeResponse"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.MsgCompleteBridgeResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.MsgCompleteBridgeResponse".into() + } +} +/// MsgUpdateEventParams is the Msg/UpdateEventParams request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateEventParams { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// The parameters to update. Each field must be set. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +impl ::prost::Name for MsgUpdateEventParams { + const NAME: &'static str = "MsgUpdateEventParams"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.MsgUpdateEventParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.MsgUpdateEventParams".into() + } +} +/// MsgUpdateEventParamsResponse is the Msg/UpdateEventParams response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateEventParamsResponse {} +impl ::prost::Name for MsgUpdateEventParamsResponse { + const NAME: &'static str = "MsgUpdateEventParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.MsgUpdateEventParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.MsgUpdateEventParamsResponse".into() + } +} +/// MsgUpdateProposeParams is the Msg/UpdateProposeParams request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateProposeParams { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// The parameters to update. Each field must be set. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +impl ::prost::Name for MsgUpdateProposeParams { + const NAME: &'static str = "MsgUpdateProposeParams"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.MsgUpdateProposeParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.MsgUpdateProposeParams".into() + } +} +/// MsgUpdateProposeParamsResponse is the Msg/UpdateProposeParams response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateProposeParamsResponse {} +impl ::prost::Name for MsgUpdateProposeParamsResponse { + const NAME: &'static str = "MsgUpdateProposeParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.MsgUpdateProposeParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.MsgUpdateProposeParamsResponse".into() + } +} +/// MsgUpdateSafetyParams is the Msg/UpdateSafetyParams request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateSafetyParams { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// The parameters to update. Each field must be set. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +impl ::prost::Name for MsgUpdateSafetyParams { + const NAME: &'static str = "MsgUpdateSafetyParams"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.MsgUpdateSafetyParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.MsgUpdateSafetyParams".into() + } +} +/// MsgUpdateSafetyParamsResponse is the Msg/UpdateSafetyParams response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateSafetyParamsResponse {} +impl ::prost::Name for MsgUpdateSafetyParamsResponse { + const NAME: &'static str = "MsgUpdateSafetyParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.MsgUpdateSafetyParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.MsgUpdateSafetyParamsResponse".into() + } +} +/// Generated client implementations. +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// AcknowledgeBridges acknowledges bridges and sets them to complete at a + /// later block. + pub async fn acknowledge_bridges( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.bridge.Msg/AcknowledgeBridges", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.bridge.Msg", "AcknowledgeBridges"), + ); + self.inner.unary(req, path, codec).await + } + /// CompleteBridge finalizes a bridge by minting coins to an address. + pub async fn complete_bridge( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.bridge.Msg/CompleteBridge", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.bridge.Msg", "CompleteBridge")); + self.inner.unary(req, path, codec).await + } + /// UpdateEventParams updates the EventParams in state. + pub async fn update_event_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.bridge.Msg/UpdateEventParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.bridge.Msg", "UpdateEventParams")); + self.inner.unary(req, path, codec).await + } + /// UpdateProposeParams updates the ProposeParams in state. + pub async fn update_propose_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.bridge.Msg/UpdateProposeParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.bridge.Msg", "UpdateProposeParams"), + ); + self.inner.unary(req, path, codec).await + } + /// UpdateSafetyParams updates the SafetyParams in state. + pub async fn update_safety_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.bridge.Msg/UpdateSafetyParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.bridge.Msg", "UpdateSafetyParams"), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// QueryEventParamsRequest is a request type for the EventParams RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEventParamsRequest {} +impl ::prost::Name for QueryEventParamsRequest { + const NAME: &'static str = "QueryEventParamsRequest"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.QueryEventParamsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.QueryEventParamsRequest".into() + } +} +/// QueryEventParamsResponse is a response type for the EventParams RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEventParamsResponse { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +impl ::prost::Name for QueryEventParamsResponse { + const NAME: &'static str = "QueryEventParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.QueryEventParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.QueryEventParamsResponse".into() + } +} +/// QueryProposeParamsRequest is a request type for the ProposeParams RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryProposeParamsRequest {} +impl ::prost::Name for QueryProposeParamsRequest { + const NAME: &'static str = "QueryProposeParamsRequest"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.QueryProposeParamsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.QueryProposeParamsRequest".into() + } +} +/// QueryProposeParamsResponse is a response type for the ProposeParams RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryProposeParamsResponse { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +impl ::prost::Name for QueryProposeParamsResponse { + const NAME: &'static str = "QueryProposeParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.QueryProposeParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.QueryProposeParamsResponse".into() + } +} +/// QuerySafetyParamsRequest is a request type for the SafetyParams RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySafetyParamsRequest {} +impl ::prost::Name for QuerySafetyParamsRequest { + const NAME: &'static str = "QuerySafetyParamsRequest"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.QuerySafetyParamsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.QuerySafetyParamsRequest".into() + } +} +/// QuerySafetyParamsResponse is a response type for the SafetyParams RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySafetyParamsResponse { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +impl ::prost::Name for QuerySafetyParamsResponse { + const NAME: &'static str = "QuerySafetyParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.QuerySafetyParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.QuerySafetyParamsResponse".into() + } +} +/// QueryAcknowledgedEventInfoRequest is a request type for the +/// AcknowledgedEventInfo RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAcknowledgedEventInfoRequest {} +impl ::prost::Name for QueryAcknowledgedEventInfoRequest { + const NAME: &'static str = "QueryAcknowledgedEventInfoRequest"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.QueryAcknowledgedEventInfoRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.QueryAcknowledgedEventInfoRequest".into() + } +} +/// QueryAcknowledgedEventInfoResponse is a response type for the +/// AcknowledgedEventInfo RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAcknowledgedEventInfoResponse { + #[prost(message, optional, tag = "1")] + pub info: ::core::option::Option, +} +impl ::prost::Name for QueryAcknowledgedEventInfoResponse { + const NAME: &'static str = "QueryAcknowledgedEventInfoResponse"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.QueryAcknowledgedEventInfoResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.QueryAcknowledgedEventInfoResponse".into() + } +} +/// QueryRecognizedEventInfoRequest is a request type for the +/// RecognizedEventInfo RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryRecognizedEventInfoRequest {} +impl ::prost::Name for QueryRecognizedEventInfoRequest { + const NAME: &'static str = "QueryRecognizedEventInfoRequest"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.QueryRecognizedEventInfoRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.QueryRecognizedEventInfoRequest".into() + } +} +/// QueryRecognizedEventInfoResponse is a response type for the +/// RecognizedEventInfo RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryRecognizedEventInfoResponse { + #[prost(message, optional, tag = "1")] + pub info: ::core::option::Option, +} +impl ::prost::Name for QueryRecognizedEventInfoResponse { + const NAME: &'static str = "QueryRecognizedEventInfoResponse"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.QueryRecognizedEventInfoResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.QueryRecognizedEventInfoResponse".into() + } +} +/// QueryDelayedCompleteBridgeMessagesRequest is a request type for the +/// DelayedCompleteBridgeMessages RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDelayedCompleteBridgeMessagesRequest { + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, +} +impl ::prost::Name for QueryDelayedCompleteBridgeMessagesRequest { + const NAME: &'static str = "QueryDelayedCompleteBridgeMessagesRequest"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.QueryDelayedCompleteBridgeMessagesRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.QueryDelayedCompleteBridgeMessagesRequest".into() + } +} +/// QueryDelayedCompleteBridgeMessagesResponse is a response type for the +/// DelayedCompleteBridgeMessages RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDelayedCompleteBridgeMessagesResponse { + #[prost(message, repeated, tag = "1")] + pub messages: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for QueryDelayedCompleteBridgeMessagesResponse { + const NAME: &'static str = "QueryDelayedCompleteBridgeMessagesResponse"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.QueryDelayedCompleteBridgeMessagesResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.QueryDelayedCompleteBridgeMessagesResponse".into() + } +} +/// DelayedCompleteBridgeMessage is a message type for the response of +/// DelayedCompleteBridgeMessages RPC method. It contains the message +/// and the block height at which it will execute. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DelayedCompleteBridgeMessage { + #[prost(message, optional, tag = "1")] + pub message: ::core::option::Option, + #[prost(uint32, tag = "2")] + pub block_height: u32, +} +impl ::prost::Name for DelayedCompleteBridgeMessage { + const NAME: &'static str = "DelayedCompleteBridgeMessage"; + const PACKAGE: &'static str = "dydxprotocol.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.bridge.DelayedCompleteBridgeMessage".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.bridge.DelayedCompleteBridgeMessage".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Queries the EventParams. + pub async fn event_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.bridge.Query/EventParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.bridge.Query", "EventParams")); + self.inner.unary(req, path, codec).await + } + /// Queries the ProposeParams. + pub async fn propose_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.bridge.Query/ProposeParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.bridge.Query", "ProposeParams")); + self.inner.unary(req, path, codec).await + } + /// Queries the SafetyParams. + pub async fn safety_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.bridge.Query/SafetyParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.bridge.Query", "SafetyParams")); + self.inner.unary(req, path, codec).await + } + /// Queries the AcknowledgedEventInfo. + /// An "acknowledged" event is one that is in-consensus and has been stored + /// in-state. + pub async fn acknowledged_event_info( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.bridge.Query/AcknowledgedEventInfo", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.bridge.Query", "AcknowledgedEventInfo"), + ); + self.inner.unary(req, path, codec).await + } + /// Queries the RecognizedEventInfo. + /// A "recognized" event is one that is finalized on the Ethereum blockchain + /// and has been identified by the queried node. It is not yet in-consensus. + pub async fn recognized_event_info( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.bridge.Query/RecognizedEventInfo", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.bridge.Query", "RecognizedEventInfo"), + ); + self.inner.unary(req, path, codec).await + } + /// Queries all `MsgCompleteBridge` messages that are delayed (not yet + /// executed) and corresponding block heights at which they will execute. + pub async fn delayed_complete_bridge_messages( + &mut self, + request: impl tonic::IntoRequest< + super::QueryDelayedCompleteBridgeMessagesRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.bridge.Query/DelayedCompleteBridgeMessages", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.bridge.Query", + "DelayedCompleteBridgeMessages", + ), + ); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.clob.rs b/v4-proto-rs/src/dydxprotocol.clob.rs new file mode 100644 index 0000000000..c8c7008c1c --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.clob.rs @@ -0,0 +1,2984 @@ +// This file is @generated by prost-build. +/// Defines the block rate limits for CLOB specific operations. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockRateLimitConfiguration { + /// How many short term order attempts (successful and failed) are allowed for + /// an account per N blocks. Note that the rate limits are applied + /// in an AND fashion such that an order placement must pass all rate limit + /// configurations. + /// + /// Specifying 0 values disables this rate limit. + /// Deprecated in favor of `max_short_term_orders_and_cancels_per_n_blocks` + /// for v5.x onwards. + #[deprecated] + #[prost(message, repeated, tag = "1")] + pub max_short_term_orders_per_n_blocks: ::prost::alloc::vec::Vec< + MaxPerNBlocksRateLimit, + >, + /// How many stateful order attempts (successful and failed) are allowed for + /// an account per N blocks. Note that the rate limits are applied + /// in an AND fashion such that an order placement must pass all rate limit + /// configurations. + /// + /// Specifying 0 values disables this rate limit. + #[prost(message, repeated, tag = "2")] + pub max_stateful_orders_per_n_blocks: ::prost::alloc::vec::Vec< + MaxPerNBlocksRateLimit, + >, + /// How many short term order cancellation attempts (successful and failed) are + /// allowed for an account per N blocks. Note that the rate limits are + /// applied in an AND fashion such that an order cancellation must pass all + /// rate limit configurations. + /// + /// Specifying 0 values disables this rate limit. + /// Deprecated in favor of `max_short_term_orders_and_cancels_per_n_blocks` + /// for v5.x onwards. + #[deprecated] + #[prost(message, repeated, tag = "3")] + pub max_short_term_order_cancellations_per_n_blocks: ::prost::alloc::vec::Vec< + MaxPerNBlocksRateLimit, + >, + /// How many short term order place and cancel attempts (successful and failed) + /// are allowed for an account per N blocks. Note that the rate limits are + /// applied in an AND fashion such that an order placement must pass all rate + /// limit configurations. + /// + /// Specifying 0 values disables this rate limit. + #[prost(message, repeated, tag = "4")] + pub max_short_term_orders_and_cancels_per_n_blocks: ::prost::alloc::vec::Vec< + MaxPerNBlocksRateLimit, + >, +} +impl ::prost::Name for BlockRateLimitConfiguration { + const NAME: &'static str = "BlockRateLimitConfiguration"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.BlockRateLimitConfiguration".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.BlockRateLimitConfiguration".into() + } +} +/// Defines a rate limit over a specific number of blocks. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MaxPerNBlocksRateLimit { + /// How many blocks the rate limit is over. + /// Specifying 0 is invalid. + #[prost(uint32, tag = "1")] + pub num_blocks: u32, + /// What the limit is for `num_blocks`. + /// Specifying 0 is invalid. + #[prost(uint32, tag = "2")] + pub limit: u32, +} +impl ::prost::Name for MaxPerNBlocksRateLimit { + const NAME: &'static str = "MaxPerNBlocksRateLimit"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MaxPerNBlocksRateLimit".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MaxPerNBlocksRateLimit".into() + } +} +/// PerpetualClobMetadata contains metadata for a `ClobPair` +/// representing a Perpetual product. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PerpetualClobMetadata { + /// Id of the Perpetual the CLOB allows trading of. + #[prost(uint32, tag = "1")] + pub perpetual_id: u32, +} +impl ::prost::Name for PerpetualClobMetadata { + const NAME: &'static str = "PerpetualClobMetadata"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.PerpetualClobMetadata".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.PerpetualClobMetadata".into() + } +} +/// PerpetualClobMetadata contains metadata for a `ClobPair` +/// representing a Spot product. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SpotClobMetadata { + /// Id of the base Asset in the trading pair. + #[prost(uint32, tag = "1")] + pub base_asset_id: u32, + /// Id of the quote Asset in the trading pair. + #[prost(uint32, tag = "2")] + pub quote_asset_id: u32, +} +impl ::prost::Name for SpotClobMetadata { + const NAME: &'static str = "SpotClobMetadata"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.SpotClobMetadata".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.SpotClobMetadata".into() + } +} +/// ClobPair represents a single CLOB pair for a given product +/// in state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ClobPair { + /// ID of the orderbook that stores all resting liquidity for this CLOB. + #[prost(uint32, tag = "1")] + pub id: u32, + /// Minimum increment in the size of orders on the CLOB, in base quantums. + #[prost(uint64, tag = "4")] + pub step_base_quantums: u64, + /// Defines the tick size of the orderbook by defining how many subticks + /// are in one tick. That is, the subticks of any valid order must be a + /// multiple of this value. Generally this value should start `>= 100`to + /// allow room for decreasing it. + #[prost(uint32, tag = "5")] + pub subticks_per_tick: u32, + /// `10^Exponent` gives the number of QuoteQuantums traded per BaseQuantum + /// per Subtick. + #[prost(sint32, tag = "6")] + pub quantum_conversion_exponent: i32, + #[prost(enumeration = "clob_pair::Status", tag = "7")] + pub status: i32, + /// Product-specific metadata. Perpetual CLOBs will have + /// PerpetualClobMetadata, and Spot CLOBs will have SpotClobMetadata. + #[prost(oneof = "clob_pair::Metadata", tags = "2, 3")] + pub metadata: ::core::option::Option, +} +/// Nested message and enum types in `ClobPair`. +pub mod clob_pair { + /// Status of the CLOB. + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum Status { + /// Default value. This value is invalid and unused. + Unspecified = 0, + /// STATUS_ACTIVE represents an active clob pair. + Active = 1, + /// STATUS_PAUSED behavior is unfinalized. + /// TODO(DEC-600): update this documentation. + Paused = 2, + /// STATUS_CANCEL_ONLY behavior is unfinalized. + /// TODO(DEC-600): update this documentation. + CancelOnly = 3, + /// STATUS_POST_ONLY behavior is unfinalized. + /// TODO(DEC-600): update this documentation. + PostOnly = 4, + /// STATUS_INITIALIZING represents a newly-added clob pair. + /// Clob pairs in this state only accept orders which are + /// both short-term and post-only. + Initializing = 5, + /// STATUS_FINAL_SETTLEMENT represents a clob pair which is deactivated + /// and trading has ceased. All open positions will be closed by the + /// protocol. Open stateful orders will be cancelled. Open short-term + /// orders will be left to expire. + FinalSettlement = 6, + } + impl Status { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Status::Unspecified => "STATUS_UNSPECIFIED", + Status::Active => "STATUS_ACTIVE", + Status::Paused => "STATUS_PAUSED", + Status::CancelOnly => "STATUS_CANCEL_ONLY", + Status::PostOnly => "STATUS_POST_ONLY", + Status::Initializing => "STATUS_INITIALIZING", + Status::FinalSettlement => "STATUS_FINAL_SETTLEMENT", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "STATUS_UNSPECIFIED" => Some(Self::Unspecified), + "STATUS_ACTIVE" => Some(Self::Active), + "STATUS_PAUSED" => Some(Self::Paused), + "STATUS_CANCEL_ONLY" => Some(Self::CancelOnly), + "STATUS_POST_ONLY" => Some(Self::PostOnly), + "STATUS_INITIALIZING" => Some(Self::Initializing), + "STATUS_FINAL_SETTLEMENT" => Some(Self::FinalSettlement), + _ => None, + } + } + } + /// Product-specific metadata. Perpetual CLOBs will have + /// PerpetualClobMetadata, and Spot CLOBs will have SpotClobMetadata. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Metadata { + #[prost(message, tag = "2")] + PerpetualClobMetadata(super::PerpetualClobMetadata), + #[prost(message, tag = "3")] + SpotClobMetadata(super::SpotClobMetadata), + } +} +impl ::prost::Name for ClobPair { + const NAME: &'static str = "ClobPair"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.ClobPair".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.ClobPair".into() + } +} +/// Defines the set of equity tiers to limit how many open orders +/// a subaccount is allowed to have. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EquityTierLimitConfiguration { + /// How many short term stateful orders are allowed per equity tier. + /// Specifying 0 values disables this limit. + #[prost(message, repeated, tag = "1")] + pub short_term_order_equity_tiers: ::prost::alloc::vec::Vec, + /// How many open stateful orders are allowed per equity tier. + /// Specifying 0 values disables this limit. + #[prost(message, repeated, tag = "2")] + pub stateful_order_equity_tiers: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for EquityTierLimitConfiguration { + const NAME: &'static str = "EquityTierLimitConfiguration"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.EquityTierLimitConfiguration".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.EquityTierLimitConfiguration".into() + } +} +/// Defines an equity tier limit. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EquityTierLimit { + /// The total net collateral in USDC quote quantums of equity required. + #[prost(bytes = "vec", tag = "1")] + pub usd_tnc_required: ::prost::alloc::vec::Vec, + /// What the limit is for `usd_tnc_required`. + #[prost(uint32, tag = "2")] + pub limit: u32, +} +impl ::prost::Name for EquityTierLimit { + const NAME: &'static str = "EquityTierLimit"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.EquityTierLimit".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.EquityTierLimit".into() + } +} +/// LiquidationsConfig stores all configurable fields related to liquidations. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LiquidationsConfig { + /// The maximum liquidation fee (in parts-per-million). This fee goes + /// 100% to the insurance fund. + #[prost(uint32, tag = "1")] + pub max_liquidation_fee_ppm: u32, + /// Limits around how much of a single position can be liquidated + /// within a single block. + #[prost(message, optional, tag = "2")] + pub position_block_limits: ::core::option::Option, + /// Limits around how many quote quantums from a single subaccount can + /// be liquidated within a single block. + #[prost(message, optional, tag = "3")] + pub subaccount_block_limits: ::core::option::Option, + /// Config about how the fillable-price spread from the oracle price + /// increases based on the adjusted bankruptcy rating of the subaccount. + #[prost(message, optional, tag = "4")] + pub fillable_price_config: ::core::option::Option, +} +impl ::prost::Name for LiquidationsConfig { + const NAME: &'static str = "LiquidationsConfig"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.LiquidationsConfig".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.LiquidationsConfig".into() + } +} +/// PositionBlockLimits stores all configurable fields related to limits +/// around how much of a single position can be liquidated within a single block. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PositionBlockLimits { + /// The minimum amount of quantums to liquidate for each message (in + /// quote quantums). + /// Overridden by the maximum size of the position. + #[prost(uint64, tag = "1")] + pub min_position_notional_liquidated: u64, + /// The maximum portion of the position liquidated (in parts-per- + /// million). Overridden by min_position_notional_liquidated. + #[prost(uint32, tag = "2")] + pub max_position_portion_liquidated_ppm: u32, +} +impl ::prost::Name for PositionBlockLimits { + const NAME: &'static str = "PositionBlockLimits"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.PositionBlockLimits".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.PositionBlockLimits".into() + } +} +/// SubaccountBlockLimits stores all configurable fields related to limits +/// around how many quote quantums from a single subaccount can +/// be liquidated within a single block. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubaccountBlockLimits { + /// The maximum notional amount that a single subaccount can have + /// liquidated (in quote quantums) per block. + #[prost(uint64, tag = "1")] + pub max_notional_liquidated: u64, + /// The maximum insurance-fund payout amount for a given subaccount + /// per block. I.e. how much it can cover for that subaccount. + #[prost(uint64, tag = "2")] + pub max_quantums_insurance_lost: u64, +} +impl ::prost::Name for SubaccountBlockLimits { + const NAME: &'static str = "SubaccountBlockLimits"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.SubaccountBlockLimits".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.SubaccountBlockLimits".into() + } +} +/// FillablePriceConfig stores all configurable fields related to calculating +/// the fillable price for liquidating a position. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FillablePriceConfig { + /// The rate at which the Adjusted Bankruptcy Rating increases. + #[prost(uint32, tag = "1")] + pub bankruptcy_adjustment_ppm: u32, + /// The maximum value that the liquidation spread can take, as + /// a ratio against the position's maintenance margin. + #[prost(uint32, tag = "2")] + pub spread_to_maintenance_margin_ratio_ppm: u32, +} +impl ::prost::Name for FillablePriceConfig { + const NAME: &'static str = "FillablePriceConfig"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.FillablePriceConfig".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.FillablePriceConfig".into() + } +} +/// GenesisState defines the clob module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, repeated, tag = "1")] + pub clob_pairs: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub liquidations_config: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub block_rate_limit_config: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub equity_tier_limit_config: ::core::option::Option, +} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.GenesisState".into() + } +} +/// PerpetualLiquidationInfo holds information about a liquidation that occurred +/// for a position held by a subaccount. +/// Note this proto is defined to make it easier to hash +/// the metadata of a liquidation, and is never written to state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PerpetualLiquidationInfo { + /// The id of the subaccount that got liquidated/deleveraged or was deleveraged + /// onto. + #[prost(message, optional, tag = "1")] + pub subaccount_id: ::core::option::Option, + /// The id of the perpetual involved. + #[prost(uint32, tag = "2")] + pub perpetual_id: u32, +} +impl ::prost::Name for PerpetualLiquidationInfo { + const NAME: &'static str = "PerpetualLiquidationInfo"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.PerpetualLiquidationInfo".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.PerpetualLiquidationInfo".into() + } +} +/// SubaccountLiquidationInfo holds liquidation information per-subaccount in the +/// current block. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubaccountLiquidationInfo { + /// An unsorted list of unique perpetual IDs that the subaccount has previously + /// liquidated. + #[prost(uint32, repeated, tag = "1")] + pub perpetuals_liquidated: ::prost::alloc::vec::Vec, + /// The notional value (in quote quantums, determined by the oracle price) of + /// all positions liquidated for this subaccount. + #[prost(uint64, tag = "2")] + pub notional_liquidated: u64, + /// The amount of funds that the insurance fund has lost + /// covering this subaccount. + #[prost(uint64, tag = "3")] + pub quantums_insurance_lost: u64, +} +impl ::prost::Name for SubaccountLiquidationInfo { + const NAME: &'static str = "SubaccountLiquidationInfo"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.SubaccountLiquidationInfo".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.SubaccountLiquidationInfo".into() + } +} +/// SubaccountOpenPositionInfo holds information about open positions for a +/// perpetual. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubaccountOpenPositionInfo { + /// The id of the perpetual. + #[prost(uint32, tag = "1")] + pub perpetual_id: u32, + /// The ids of the subaccounts with long positions. + #[prost(message, repeated, tag = "2")] + pub subaccounts_with_long_position: ::prost::alloc::vec::Vec< + super::subaccounts::SubaccountId, + >, + /// The ids of the subaccounts with short positions. + #[prost(message, repeated, tag = "3")] + pub subaccounts_with_short_position: ::prost::alloc::vec::Vec< + super::subaccounts::SubaccountId, + >, +} +impl ::prost::Name for SubaccountOpenPositionInfo { + const NAME: &'static str = "SubaccountOpenPositionInfo"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.SubaccountOpenPositionInfo".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.SubaccountOpenPositionInfo".into() + } +} +/// OrderId refers to a single order belonging to a Subaccount. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OrderId { + /// The subaccount ID that opened this order. + /// Note that this field has `gogoproto.nullable = false` so that it is + /// generated as a value instead of a pointer. This is because the `OrderId` + /// proto is used as a key within maps, and map comparisons will compare + /// pointers for equality (when the desired behavior is to compare the values). + #[prost(message, optional, tag = "1")] + pub subaccount_id: ::core::option::Option, + /// The client ID of this order, unique with respect to the specific + /// sub account (I.E., the same subaccount can't have two orders with + /// the same ClientId). + #[prost(fixed32, tag = "2")] + pub client_id: u32, + /// order_flags represent order flags for the order. This field is invalid if + /// it's greater than 127 (larger than one byte). Each bit in the first byte + /// represents a different flag. Currently only two flags are supported. + /// + /// Starting from the bit after the most MSB (note that the MSB is used in + /// proto varint encoding, and therefore cannot be used): Bit 1 is set if this + /// order is a Long-Term order (0x40, or 64 as a uint8). Bit 2 is set if this + /// order is a Conditional order (0x20, or 32 as a uint8). + /// + /// If neither bit is set, the order is assumed to be a Short-Term order. + /// + /// If both bits are set or bits other than the 2nd and 3rd are set, the order + /// ID is invalid. + #[prost(uint32, tag = "3")] + pub order_flags: u32, + /// ID of the CLOB the order is created for. + #[prost(uint32, tag = "4")] + pub clob_pair_id: u32, +} +impl ::prost::Name for OrderId { + const NAME: &'static str = "OrderId"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.OrderId".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.OrderId".into() + } +} +/// OrdersFilledDuringLatestBlock represents a list of `OrderIds` that were +/// filled by any non-zero amount in the latest block. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OrdersFilledDuringLatestBlock { + /// A list of unique order_ids that were filled by any non-zero amount in the + /// latest block. + #[prost(message, repeated, tag = "1")] + pub order_ids: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for OrdersFilledDuringLatestBlock { + const NAME: &'static str = "OrdersFilledDuringLatestBlock"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.OrdersFilledDuringLatestBlock".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.OrdersFilledDuringLatestBlock".into() + } +} +/// PotentiallyPrunableOrders represents a list of orders that may be prunable +/// from state at a future block height. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PotentiallyPrunableOrders { + /// A list of unique order_ids that may potentially be pruned from state at a + /// future block height. + #[prost(message, repeated, tag = "1")] + pub order_ids: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for PotentiallyPrunableOrders { + const NAME: &'static str = "PotentiallyPrunableOrders"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.PotentiallyPrunableOrders".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.PotentiallyPrunableOrders".into() + } +} +/// OrderFillState represents the fill amount of an order according to on-chain +/// state. This proto includes both the current on-chain fill amount of the +/// order, as well as the block at which this information can be pruned from +/// state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OrderFillState { + /// The current fillAmount of the order according to on-chain state. + #[prost(uint64, tag = "1")] + pub fill_amount: u64, + /// The block height at which the fillAmount state for this order can be + /// pruned. + #[prost(uint32, tag = "2")] + pub prunable_block_height: u32, +} +impl ::prost::Name for OrderFillState { + const NAME: &'static str = "OrderFillState"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.OrderFillState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.OrderFillState".into() + } +} +/// StatefulOrderTimeSliceValue represents the type of the value of the +/// `StatefulOrdersTimeSlice` in state. The `StatefulOrdersTimeSlice` +/// in state consists of key/value pairs where the keys are UTF-8-encoded +/// `RFC3339NANO` timestamp strings with right-padded zeroes and no +/// time zone info, and the values are of type `StatefulOrderTimeSliceValue`. +/// This `StatefulOrderTimeSliceValue` in state is used for managing stateful +/// order expiration. Stateful order expirations can be for either long term +/// or conditional orders. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StatefulOrderTimeSliceValue { + /// A unique list of order_ids that expire at this timestamp, sorted in + /// ascending order by block height and transaction index of each stateful + /// order. + #[prost(message, repeated, tag = "1")] + pub order_ids: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for StatefulOrderTimeSliceValue { + const NAME: &'static str = "StatefulOrderTimeSliceValue"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.StatefulOrderTimeSliceValue".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.StatefulOrderTimeSliceValue".into() + } +} +/// LongTermOrderPlacement represents the placement of a stateful order in +/// state. It stores the stateful order itself and the `BlockHeight` and +/// `TransactionIndex` at which the order was placed. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LongTermOrderPlacement { + #[prost(message, optional, tag = "1")] + pub order: ::core::option::Option, + /// The block height and transaction index at which the order was placed. + /// Used for ordering by time priority when the chain is restarted. + #[prost(message, optional, tag = "2")] + pub placement_index: ::core::option::Option, +} +impl ::prost::Name for LongTermOrderPlacement { + const NAME: &'static str = "LongTermOrderPlacement"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.LongTermOrderPlacement".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.LongTermOrderPlacement".into() + } +} +/// ConditionalOrderPlacement represents the placement of a conditional order in +/// state. It stores the stateful order itself, the `BlockHeight` and +/// `TransactionIndex` at which the order was placed and triggered. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConditionalOrderPlacement { + #[prost(message, optional, tag = "1")] + pub order: ::core::option::Option, + /// The block height and transaction index at which the order was placed. + #[prost(message, optional, tag = "2")] + pub placement_index: ::core::option::Option, + /// The block height and transaction index at which the order was triggered. + /// Set to be nil if the transaction has not been triggered. + /// Used for ordering by time priority when the chain is restarted. + #[prost(message, optional, tag = "3")] + pub trigger_index: ::core::option::Option, +} +impl ::prost::Name for ConditionalOrderPlacement { + const NAME: &'static str = "ConditionalOrderPlacement"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.ConditionalOrderPlacement".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.ConditionalOrderPlacement".into() + } +} +/// Order represents a single order belonging to a `Subaccount` +/// for a particular `ClobPair`. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Order { + /// The unique ID of this order. Meant to be unique across all orders. + #[prost(message, optional, tag = "1")] + pub order_id: ::core::option::Option, + #[prost(enumeration = "order::Side", tag = "2")] + pub side: i32, + /// The size of this order in base quantums. Must be a multiple of + /// `ClobPair.StepBaseQuantums` (where `ClobPair.Id = orderId.ClobPairId`). + #[prost(uint64, tag = "3")] + pub quantums: u64, + /// The price level that this order will be placed at on the orderbook, + /// in subticks. Must be a multiple of ClobPair.SubticksPerTick + /// (where `ClobPair.Id = orderId.ClobPairId`). + #[prost(uint64, tag = "4")] + pub subticks: u64, + /// The time in force of this order. + #[prost(enumeration = "order::TimeInForce", tag = "7")] + pub time_in_force: i32, + /// Enforces that the order can only reduce the size of an existing position. + /// If a ReduceOnly order would change the side of the existing position, + /// its size is reduced to that of the remaining size of the position. + /// If existing orders on the book with ReduceOnly + /// would already close the position, the least aggressive (out-of-the-money) + /// ReduceOnly orders are resized and canceled first. + #[prost(bool, tag = "8")] + pub reduce_only: bool, + /// Set of bit flags set arbitrarily by clients and ignored by the protocol. + /// Used by indexer to infer information about a placed order. + #[prost(uint32, tag = "9")] + pub client_metadata: u32, + #[prost(enumeration = "order::ConditionType", tag = "10")] + pub condition_type: i32, + /// conditional_order_trigger_subticks represents the price at which this order + /// will be triggered. If the condition_type is CONDITION_TYPE_UNSPECIFIED, + /// this value is enforced to be 0. If this value is nonzero, condition_type + /// cannot be CONDITION_TYPE_UNSPECIFIED. Value is in subticks. + /// Must be a multiple of ClobPair.SubticksPerTick (where `ClobPair.Id = + /// orderId.ClobPairId`). + #[prost(uint64, tag = "11")] + pub conditional_order_trigger_subticks: u64, + /// Information about when the order expires. + #[prost(oneof = "order::GoodTilOneof", tags = "5, 6")] + pub good_til_oneof: ::core::option::Option, +} +/// Nested message and enum types in `Order`. +pub mod order { + /// Represents the side of the orderbook the order will be placed on. + /// Note that Side.SIDE_UNSPECIFIED is an invalid order and cannot be + /// placed on the orderbook. + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum Side { + /// Default value. This value is invalid and unused. + Unspecified = 0, + /// SIDE_BUY is used to represent a BUY order. + Buy = 1, + /// SIDE_SELL is used to represent a SELL order. + Sell = 2, + } + impl Side { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Side::Unspecified => "SIDE_UNSPECIFIED", + Side::Buy => "SIDE_BUY", + Side::Sell => "SIDE_SELL", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SIDE_UNSPECIFIED" => Some(Self::Unspecified), + "SIDE_BUY" => Some(Self::Buy), + "SIDE_SELL" => Some(Self::Sell), + _ => None, + } + } + } + /// TimeInForce indicates how long an order will remain active before it + /// is executed or expires. + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum TimeInForce { + /// TIME_IN_FORCE_UNSPECIFIED represents the default behavior where an + /// order will first match with existing orders on the book, and any + /// remaining size will be added to the book as a maker order. + Unspecified = 0, + /// TIME_IN_FORCE_IOC enforces that an order only be matched with + /// maker orders on the book. If the order has remaining size after + /// matching with existing orders on the book, the remaining size + /// is not placed on the book. + Ioc = 1, + /// TIME_IN_FORCE_POST_ONLY enforces that an order only be placed + /// on the book as a maker order. Note this means that validators will cancel + /// any newly-placed post only orders that would cross with other maker + /// orders. + PostOnly = 2, + /// TIME_IN_FORCE_FILL_OR_KILL enforces that an order will either be filled + /// completely and immediately by maker orders on the book or canceled if the + /// entire amount can‘t be matched. + FillOrKill = 3, + } + impl TimeInForce { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + TimeInForce::Unspecified => "TIME_IN_FORCE_UNSPECIFIED", + TimeInForce::Ioc => "TIME_IN_FORCE_IOC", + TimeInForce::PostOnly => "TIME_IN_FORCE_POST_ONLY", + TimeInForce::FillOrKill => "TIME_IN_FORCE_FILL_OR_KILL", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "TIME_IN_FORCE_UNSPECIFIED" => Some(Self::Unspecified), + "TIME_IN_FORCE_IOC" => Some(Self::Ioc), + "TIME_IN_FORCE_POST_ONLY" => Some(Self::PostOnly), + "TIME_IN_FORCE_FILL_OR_KILL" => Some(Self::FillOrKill), + _ => None, + } + } + } + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum ConditionType { + /// CONDITION_TYPE_UNSPECIFIED represents the default behavior where an + /// order will be placed immediately on the orderbook. + Unspecified = 0, + /// CONDITION_TYPE_STOP_LOSS represents a stop order. A stop order will + /// trigger when the oracle price moves at or above the trigger price for + /// buys, and at or below the trigger price for sells. + StopLoss = 1, + /// CONDITION_TYPE_TAKE_PROFIT represents a take profit order. A take profit + /// order will trigger when the oracle price moves at or below the trigger + /// price for buys and at or above the trigger price for sells. + TakeProfit = 2, + } + impl ConditionType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ConditionType::Unspecified => "CONDITION_TYPE_UNSPECIFIED", + ConditionType::StopLoss => "CONDITION_TYPE_STOP_LOSS", + ConditionType::TakeProfit => "CONDITION_TYPE_TAKE_PROFIT", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "CONDITION_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "CONDITION_TYPE_STOP_LOSS" => Some(Self::StopLoss), + "CONDITION_TYPE_TAKE_PROFIT" => Some(Self::TakeProfit), + _ => None, + } + } + } + /// Information about when the order expires. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum GoodTilOneof { + /// The last block this order can be executed at (after which it will be + /// unfillable). Used only for Short-Term orders. If this value is non-zero + /// then the order is assumed to be a Short-Term order. + #[prost(uint32, tag = "5")] + GoodTilBlock(u32), + /// good_til_block_time represents the unix timestamp (in seconds) at which a + /// stateful order will be considered expired. The + /// good_til_block_time is always evaluated against the previous block's + /// `BlockTime` instead of the block in which the order is committed. If this + /// value is non-zero then the order is assumed to be a stateful or + /// conditional order. + #[prost(fixed32, tag = "6")] + GoodTilBlockTime(u32), + } +} +impl ::prost::Name for Order { + const NAME: &'static str = "Order"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.Order".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.Order".into() + } +} +/// TransactionOrdering represents a unique location in the block where a +/// transaction was placed. This proto includes both block height and the +/// transaction index that the specific transaction was placed. This information +/// is used for ordering by time priority when the chain is restarted. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransactionOrdering { + /// Block height in which the transaction was placed. + #[prost(uint32, tag = "1")] + pub block_height: u32, + /// Within the block, the unique transaction index. + #[prost(uint32, tag = "2")] + pub transaction_index: u32, +} +impl ::prost::Name for TransactionOrdering { + const NAME: &'static str = "TransactionOrdering"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.TransactionOrdering".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.TransactionOrdering".into() + } +} +/// ClobMatch represents an operations queue entry around all different types +/// of matches, specifically regular matches, liquidation matches, and +/// deleveraging matches. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ClobMatch { + /// The match type that this message includes. + #[prost(oneof = "clob_match::Match", tags = "1, 2, 3")] + pub r#match: ::core::option::Option, +} +/// Nested message and enum types in `ClobMatch`. +pub mod clob_match { + /// The match type that this message includes. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Match { + #[prost(message, tag = "1")] + MatchOrders(super::MatchOrders), + #[prost(message, tag = "2")] + MatchPerpetualLiquidation(super::MatchPerpetualLiquidation), + #[prost(message, tag = "3")] + MatchPerpetualDeleveraging(super::MatchPerpetualDeleveraging), + } +} +impl ::prost::Name for ClobMatch { + const NAME: &'static str = "ClobMatch"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.ClobMatch".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.ClobMatch".into() + } +} +/// MakerFill represents the filled amount of a matched maker order. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MakerFill { + /// The filled amount of the matched maker order, in base quantums. + /// TODO(CLOB-571): update to use SerializableInt. + #[prost(uint64, tag = "1")] + pub fill_amount: u64, + /// The `OrderId` of the matched maker order. + #[prost(message, optional, tag = "2")] + pub maker_order_id: ::core::option::Option, +} +impl ::prost::Name for MakerFill { + const NAME: &'static str = "MakerFill"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MakerFill".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MakerFill".into() + } +} +/// MatchOrders is an injected message used for matching orders. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MatchOrders { + /// The `OrderId` of the taker order. + #[prost(message, optional, tag = "1")] + pub taker_order_id: ::core::option::Option, + /// An ordered list of fills created by this taker order. + #[prost(message, repeated, tag = "2")] + pub fills: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for MatchOrders { + const NAME: &'static str = "MatchOrders"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MatchOrders".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MatchOrders".into() + } +} +/// MatchPerpetualLiquidation is an injected message used for liquidating a +/// subaccount. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MatchPerpetualLiquidation { + /// ID of the subaccount that was liquidated. + #[prost(message, optional, tag = "1")] + pub liquidated: ::core::option::Option, + /// The ID of the clob pair involved in the liquidation. + #[prost(uint32, tag = "2")] + pub clob_pair_id: u32, + /// The ID of the perpetual involved in the liquidation. + #[prost(uint32, tag = "3")] + pub perpetual_id: u32, + /// The total size of the liquidation order including any unfilled size. + #[prost(uint64, tag = "4")] + pub total_size: u64, + /// `true` if liquidating a short position, `false` otherwise. + #[prost(bool, tag = "5")] + pub is_buy: bool, + /// An ordered list of fills created by this liquidation. + #[prost(message, repeated, tag = "6")] + pub fills: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for MatchPerpetualLiquidation { + const NAME: &'static str = "MatchPerpetualLiquidation"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MatchPerpetualLiquidation".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MatchPerpetualLiquidation".into() + } +} +/// MatchPerpetualDeleveraging is an injected message used for deleveraging a +/// subaccount. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MatchPerpetualDeleveraging { + /// ID of the subaccount that was liquidated. + #[prost(message, optional, tag = "1")] + pub liquidated: ::core::option::Option, + /// The ID of the perpetual that was liquidated. + #[prost(uint32, tag = "2")] + pub perpetual_id: u32, + /// An ordered list of fills created by this liquidation. + #[prost(message, repeated, tag = "3")] + pub fills: ::prost::alloc::vec::Vec, + /// Flag denoting whether the deleveraging operation was for the purpose + /// of final settlement. Final settlement matches are at the oracle price, + /// whereas deleveraging happens at the bankruptcy price of the deleveraged + /// subaccount. + #[prost(bool, tag = "4")] + pub is_final_settlement: bool, +} +/// Nested message and enum types in `MatchPerpetualDeleveraging`. +pub mod match_perpetual_deleveraging { + /// Fill represents a fill between the liquidated and offsetting subaccount. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Fill { + /// ID of the subaccount that was used to offset the liquidated subaccount's + /// position. + #[prost(message, optional, tag = "1")] + pub offsetting_subaccount_id: ::core::option::Option< + super::super::subaccounts::SubaccountId, + >, + /// The amount filled between the liquidated and offsetting position, in + /// base quantums. + /// TODO(CLOB-571): update to use SerializableInt. + #[prost(uint64, tag = "2")] + pub fill_amount: u64, + } + impl ::prost::Name for Fill { + const NAME: &'static str = "Fill"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MatchPerpetualDeleveraging.Fill".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MatchPerpetualDeleveraging.Fill".into() + } + } +} +impl ::prost::Name for MatchPerpetualDeleveraging { + const NAME: &'static str = "MatchPerpetualDeleveraging"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MatchPerpetualDeleveraging".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MatchPerpetualDeleveraging".into() + } +} +/// MEVMatch represents all necessary data to calculate MEV for a regular match. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MevMatch { + #[prost(message, optional, tag = "1")] + pub taker_order_subaccount_id: ::core::option::Option< + super::subaccounts::SubaccountId, + >, + #[prost(int32, tag = "2")] + pub taker_fee_ppm: i32, + #[prost(message, optional, tag = "3")] + pub maker_order_subaccount_id: ::core::option::Option< + super::subaccounts::SubaccountId, + >, + #[prost(uint64, tag = "4")] + pub maker_order_subticks: u64, + #[prost(bool, tag = "5")] + pub maker_order_is_buy: bool, + #[prost(int32, tag = "6")] + pub maker_fee_ppm: i32, + #[prost(uint32, tag = "7")] + pub clob_pair_id: u32, + #[prost(uint64, tag = "8")] + pub fill_amount: u64, +} +impl ::prost::Name for MevMatch { + const NAME: &'static str = "MEVMatch"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MEVMatch".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MEVMatch".into() + } +} +/// MEVLiquidationMatch represents all necessary data to calculate MEV for a +/// liquidation. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MevLiquidationMatch { + #[prost(message, optional, tag = "1")] + pub liquidated_subaccount_id: ::core::option::Option< + super::subaccounts::SubaccountId, + >, + #[prost(int64, tag = "2")] + pub insurance_fund_delta_quote_quantums: i64, + #[prost(message, optional, tag = "3")] + pub maker_order_subaccount_id: ::core::option::Option< + super::subaccounts::SubaccountId, + >, + #[prost(uint64, tag = "4")] + pub maker_order_subticks: u64, + #[prost(bool, tag = "5")] + pub maker_order_is_buy: bool, + #[prost(int32, tag = "6")] + pub maker_fee_ppm: i32, + #[prost(uint32, tag = "7")] + pub clob_pair_id: u32, + #[prost(uint64, tag = "8")] + pub fill_amount: u64, +} +impl ::prost::Name for MevLiquidationMatch { + const NAME: &'static str = "MEVLiquidationMatch"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MEVLiquidationMatch".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MEVLiquidationMatch".into() + } +} +/// ClobMidPrice contains the mid price of a CLOB pair, represented by it's ID. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ClobMidPrice { + #[prost(message, optional, tag = "1")] + pub clob_pair: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub subticks: u64, +} +impl ::prost::Name for ClobMidPrice { + const NAME: &'static str = "ClobMidPrice"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.ClobMidPrice".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.ClobMidPrice".into() + } +} +/// ValidatorMevMatches contains all matches from the validator's local +/// operations queue. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorMevMatches { + #[prost(message, repeated, tag = "1")] + pub matches: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "2")] + pub liquidation_matches: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for ValidatorMevMatches { + const NAME: &'static str = "ValidatorMevMatches"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.ValidatorMevMatches".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.ValidatorMevMatches".into() + } +} +/// MevNodeToNodeMetrics is a data structure for encapsulating all MEV node <> +/// node metrics. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MevNodeToNodeMetrics { + #[prost(message, optional, tag = "1")] + pub validator_mev_matches: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub clob_mid_prices: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "3")] + pub bp_mev_matches: ::core::option::Option, + #[prost(uint64, tag = "4")] + pub proposal_receive_time: u64, +} +impl ::prost::Name for MevNodeToNodeMetrics { + const NAME: &'static str = "MevNodeToNodeMetrics"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MevNodeToNodeMetrics".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MevNodeToNodeMetrics".into() + } +} +/// OrderRemoval is a request type used for forced removal of stateful orders. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OrderRemoval { + #[prost(message, optional, tag = "1")] + pub order_id: ::core::option::Option, + #[prost(enumeration = "order_removal::RemovalReason", tag = "2")] + pub removal_reason: i32, +} +/// Nested message and enum types in `OrderRemoval`. +pub mod order_removal { + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum RemovalReason { + /// REMOVAL_REASON_UNSPECIFIED represents an unspecified removal reason. This + /// removal reason is used as a catchall and should never appear on an + /// OrderRemoval in the operations queue. + Unspecified = 0, + /// REMOVAL_REASON_UNDERCOLLATERALIZED represents a removal of an order which + /// if filled in isolation with respect to the current state of the + /// subaccount would leave the subaccount undercollateralized. + Undercollateralized = 1, + /// REMOVAL_REASON_INVALID_REDUCE_ONLY represents a removal of a reduce-only + /// order which if filled in isolation with respect to the current state of + /// the subaccount would cause the subaccount's existing position to increase + /// or change sides. + InvalidReduceOnly = 2, + /// REMOVAL_REASON_POST_ONLY_WOULD_CROSS_MAKER_ORDER represents a removal of + /// a stateful post-only order that was deemed invalid because it crossed + /// maker orders on the book of the proposer. + PostOnlyWouldCrossMakerOrder = 3, + /// REMOVAL_REASON_INVALID_SELF_TRADE represents a removal of a stateful + /// order that was deemed invalid because it constituted a self trade on the + /// proposers orderbook. + InvalidSelfTrade = 4, + /// REMOVAL_REASON_CONDITIONAL_FOK_COULD_NOT_BE_FULLY_FILLED represents a + /// removal of a conditional FOK order that was deemed invalid because it + /// could not be completely filled. Conditional FOK orders should always be + /// fully-filled or removed in the block after they are triggered. + ConditionalFokCouldNotBeFullyFilled = 5, + /// REMOVAL_REASON_CONDITIONAL_IOC_WOULD_REST_ON_BOOK represents a removal + /// of a conditional IOC order. + /// Conditional IOC orders should always have their remaining size removed + /// in the block after they are triggered. + ConditionalIocWouldRestOnBook = 6, + /// REMOVAL_REASON_FULLY_FILLED represents a removal of an order that + /// was fully filled and should therefore be removed from state. + FullyFilled = 7, + /// REMOVAL_REASON_FULLY_FILLED represents a removal of an order that + /// would lead to the subaccount violating isolated subaccount constraints. + ViolatesIsolatedSubaccountConstraints = 8, + } + impl RemovalReason { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + RemovalReason::Unspecified => "REMOVAL_REASON_UNSPECIFIED", + RemovalReason::Undercollateralized => { + "REMOVAL_REASON_UNDERCOLLATERALIZED" + } + RemovalReason::InvalidReduceOnly => "REMOVAL_REASON_INVALID_REDUCE_ONLY", + RemovalReason::PostOnlyWouldCrossMakerOrder => { + "REMOVAL_REASON_POST_ONLY_WOULD_CROSS_MAKER_ORDER" + } + RemovalReason::InvalidSelfTrade => "REMOVAL_REASON_INVALID_SELF_TRADE", + RemovalReason::ConditionalFokCouldNotBeFullyFilled => { + "REMOVAL_REASON_CONDITIONAL_FOK_COULD_NOT_BE_FULLY_FILLED" + } + RemovalReason::ConditionalIocWouldRestOnBook => { + "REMOVAL_REASON_CONDITIONAL_IOC_WOULD_REST_ON_BOOK" + } + RemovalReason::FullyFilled => "REMOVAL_REASON_FULLY_FILLED", + RemovalReason::ViolatesIsolatedSubaccountConstraints => { + "REMOVAL_REASON_VIOLATES_ISOLATED_SUBACCOUNT_CONSTRAINTS" + } + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "REMOVAL_REASON_UNSPECIFIED" => Some(Self::Unspecified), + "REMOVAL_REASON_UNDERCOLLATERALIZED" => Some(Self::Undercollateralized), + "REMOVAL_REASON_INVALID_REDUCE_ONLY" => Some(Self::InvalidReduceOnly), + "REMOVAL_REASON_POST_ONLY_WOULD_CROSS_MAKER_ORDER" => { + Some(Self::PostOnlyWouldCrossMakerOrder) + } + "REMOVAL_REASON_INVALID_SELF_TRADE" => Some(Self::InvalidSelfTrade), + "REMOVAL_REASON_CONDITIONAL_FOK_COULD_NOT_BE_FULLY_FILLED" => { + Some(Self::ConditionalFokCouldNotBeFullyFilled) + } + "REMOVAL_REASON_CONDITIONAL_IOC_WOULD_REST_ON_BOOK" => { + Some(Self::ConditionalIocWouldRestOnBook) + } + "REMOVAL_REASON_FULLY_FILLED" => Some(Self::FullyFilled), + "REMOVAL_REASON_VIOLATES_ISOLATED_SUBACCOUNT_CONSTRAINTS" => { + Some(Self::ViolatesIsolatedSubaccountConstraints) + } + _ => None, + } + } + } +} +impl ::prost::Name for OrderRemoval { + const NAME: &'static str = "OrderRemoval"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.OrderRemoval".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.OrderRemoval".into() + } +} +/// MsgCreateClobPair is a message used by x/gov for creating a new clob pair. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateClobPair { + /// The address that controls the module. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// `clob_pair` defines parameters for the new clob pair. + #[prost(message, optional, tag = "2")] + pub clob_pair: ::core::option::Option, +} +impl ::prost::Name for MsgCreateClobPair { + const NAME: &'static str = "MsgCreateClobPair"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgCreateClobPair".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgCreateClobPair".into() + } +} +/// MsgCreateClobPairResponse defines the CreateClobPair response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateClobPairResponse {} +impl ::prost::Name for MsgCreateClobPairResponse { + const NAME: &'static str = "MsgCreateClobPairResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgCreateClobPairResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgCreateClobPairResponse".into() + } +} +/// MsgProposedOperations is a message injected by block proposers to +/// specify the operations that occurred in a block. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgProposedOperations { + /// The list of operations proposed by the block proposer. + #[prost(message, repeated, tag = "1")] + pub operations_queue: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for MsgProposedOperations { + const NAME: &'static str = "MsgProposedOperations"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgProposedOperations".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgProposedOperations".into() + } +} +/// MsgProposedOperationsResponse is the response type of the message injected +/// by block proposers to specify the operations that occurred in a block. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgProposedOperationsResponse {} +impl ::prost::Name for MsgProposedOperationsResponse { + const NAME: &'static str = "MsgProposedOperationsResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgProposedOperationsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgProposedOperationsResponse".into() + } +} +/// MsgPlaceOrder is a request type used for placing orders. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgPlaceOrder { + #[prost(message, optional, tag = "1")] + pub order: ::core::option::Option, +} +impl ::prost::Name for MsgPlaceOrder { + const NAME: &'static str = "MsgPlaceOrder"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgPlaceOrder".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgPlaceOrder".into() + } +} +/// MsgPlaceOrderResponse is a response type used for placing orders. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgPlaceOrderResponse {} +impl ::prost::Name for MsgPlaceOrderResponse { + const NAME: &'static str = "MsgPlaceOrderResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgPlaceOrderResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgPlaceOrderResponse".into() + } +} +/// MsgCancelOrder is a request type used for canceling orders. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCancelOrder { + #[prost(message, optional, tag = "1")] + pub order_id: ::core::option::Option, + /// Information about when the order cancellation expires. + #[prost(oneof = "msg_cancel_order::GoodTilOneof", tags = "2, 3")] + pub good_til_oneof: ::core::option::Option, +} +/// Nested message and enum types in `MsgCancelOrder`. +pub mod msg_cancel_order { + /// Information about when the order cancellation expires. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum GoodTilOneof { + /// The last block this order cancellation can be executed at. + /// Used only for Short-Term orders and must be zero for stateful orders. + #[prost(uint32, tag = "2")] + GoodTilBlock(u32), + /// good_til_block_time represents the unix timestamp (in seconds) at which a + /// stateful order cancellation will be considered expired. The + /// good_til_block_time is always evaluated against the previous block's + /// `BlockTime` instead of the block in which the order is committed. + /// This value must be zero for Short-Term orders. + #[prost(fixed32, tag = "3")] + GoodTilBlockTime(u32), + } +} +impl ::prost::Name for MsgCancelOrder { + const NAME: &'static str = "MsgCancelOrder"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgCancelOrder".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgCancelOrder".into() + } +} +/// MsgCancelOrderResponse is a response type used for canceling orders. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCancelOrderResponse {} +impl ::prost::Name for MsgCancelOrderResponse { + const NAME: &'static str = "MsgCancelOrderResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgCancelOrderResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgCancelOrderResponse".into() + } +} +/// MsgBatchCancel is a request type used for batch canceling orders. +/// This msg is not atomic. Cancels will be performed optimistically even +/// if some cancels are invalid or fail. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgBatchCancel { + /// The subaccount this batch cancel will be applied for. + #[prost(message, optional, tag = "1")] + pub subaccount_id: ::core::option::Option, + /// The batch of short term orders that will be cancelled. + #[prost(message, repeated, tag = "2")] + pub short_term_cancels: ::prost::alloc::vec::Vec, + /// The last block the short term order cancellations can be executed at. + #[prost(uint32, tag = "3")] + pub good_til_block: u32, +} +impl ::prost::Name for MsgBatchCancel { + const NAME: &'static str = "MsgBatchCancel"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgBatchCancel".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgBatchCancel".into() + } +} +/// OrderBatch represents a batch of orders all belonging to a single clob pair +/// id. Along with a subaccount id and an order flag, is used to represent a +/// batch of orders that share the same subaccount, order flag, and clob pair id. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OrderBatch { + /// The Clob Pair ID all orders in this order batch belong to. + #[prost(uint32, tag = "1")] + pub clob_pair_id: u32, + /// List of client ids in this order batch. + /// Note that this is serialized as a uint32 instead of a fixed32 to + /// avoid issues when decoding repeated packed fixed32. + #[prost(uint32, repeated, tag = "2")] + pub client_ids: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for OrderBatch { + const NAME: &'static str = "OrderBatch"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.OrderBatch".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.OrderBatch".into() + } +} +/// MsgBatchCancelResponse is a response type used for batch canceling orders. +/// It indicates which cancel orders have succeeded or failed. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgBatchCancelResponse { + /// A batch of short term cancel orders that have succeeded. + #[prost(message, repeated, tag = "1")] + pub short_term_succeeded: ::prost::alloc::vec::Vec, + /// A batch of short term cancel orders that have failed. + #[prost(message, repeated, tag = "2")] + pub short_term_failed: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for MsgBatchCancelResponse { + const NAME: &'static str = "MsgBatchCancelResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgBatchCancelResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgBatchCancelResponse".into() + } +} +/// MsgUpdateClobPair is a request type used for updating a ClobPair in state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateClobPair { + /// Authority is the address that may send this message. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// `clob_pair` is the ClobPair to write to state. + #[prost(message, optional, tag = "2")] + pub clob_pair: ::core::option::Option, +} +impl ::prost::Name for MsgUpdateClobPair { + const NAME: &'static str = "MsgUpdateClobPair"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgUpdateClobPair".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgUpdateClobPair".into() + } +} +/// MsgUpdateClobPairResponse is a response type used for setting a ClobPair's +/// status. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateClobPairResponse {} +impl ::prost::Name for MsgUpdateClobPairResponse { + const NAME: &'static str = "MsgUpdateClobPairResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgUpdateClobPairResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgUpdateClobPairResponse".into() + } +} +/// OperationRaw represents an operation in the proposed operations. +/// Note that the `order_placement` operation is a signed message. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OperationRaw { + /// operationRaw represents an operation that occurred, which can be a match, + /// a signed order placement, or an order removal. + #[prost(oneof = "operation_raw::Operation", tags = "1, 2, 3")] + pub operation: ::core::option::Option, +} +/// Nested message and enum types in `OperationRaw`. +pub mod operation_raw { + /// operationRaw represents an operation that occurred, which can be a match, + /// a signed order placement, or an order removal. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Operation { + #[prost(message, tag = "1")] + Match(super::ClobMatch), + #[prost(bytes, tag = "2")] + ShortTermOrderPlacement(::prost::alloc::vec::Vec), + #[prost(message, tag = "3")] + OrderRemoval(super::OrderRemoval), + } +} +impl ::prost::Name for OperationRaw { + const NAME: &'static str = "OperationRaw"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.OperationRaw".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.OperationRaw".into() + } +} +/// MsgUpdateEquityTierLimitConfiguration is the Msg/EquityTierLimitConfiguration +/// request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateEquityTierLimitConfiguration { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// Defines the equity tier limit configuration to update to. All fields must + /// be set. + #[prost(message, optional, tag = "2")] + pub equity_tier_limit_config: ::core::option::Option, +} +impl ::prost::Name for MsgUpdateEquityTierLimitConfiguration { + const NAME: &'static str = "MsgUpdateEquityTierLimitConfiguration"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgUpdateEquityTierLimitConfiguration".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgUpdateEquityTierLimitConfiguration".into() + } +} +/// MsgUpdateEquityTierLimitConfiguration is the Msg/EquityTierLimitConfiguration +/// response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateEquityTierLimitConfigurationResponse {} +impl ::prost::Name for MsgUpdateEquityTierLimitConfigurationResponse { + const NAME: &'static str = "MsgUpdateEquityTierLimitConfigurationResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgUpdateEquityTierLimitConfigurationResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgUpdateEquityTierLimitConfigurationResponse".into() + } +} +/// MsgUpdateBlockRateLimitConfiguration is the Msg/BlockRateLimitConfiguration +/// request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateBlockRateLimitConfiguration { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// Defines the block rate limit configuration to update to. All fields must be + /// set. + #[prost(message, optional, tag = "3")] + pub block_rate_limit_config: ::core::option::Option, +} +impl ::prost::Name for MsgUpdateBlockRateLimitConfiguration { + const NAME: &'static str = "MsgUpdateBlockRateLimitConfiguration"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgUpdateBlockRateLimitConfiguration".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgUpdateBlockRateLimitConfiguration".into() + } +} +/// MsgUpdateBlockRateLimitConfiguration is a response type for updating the +/// liquidations config. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateBlockRateLimitConfigurationResponse {} +impl ::prost::Name for MsgUpdateBlockRateLimitConfigurationResponse { + const NAME: &'static str = "MsgUpdateBlockRateLimitConfigurationResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgUpdateBlockRateLimitConfigurationResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgUpdateBlockRateLimitConfigurationResponse".into() + } +} +/// MsgUpdateLiquidationsConfig is a request type for updating the liquidations +/// config. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateLiquidationsConfig { + /// Authority is the address that may send this message. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// Defines the liquidations configuration to update to. All fields must + /// be set. + #[prost(message, optional, tag = "2")] + pub liquidations_config: ::core::option::Option, +} +impl ::prost::Name for MsgUpdateLiquidationsConfig { + const NAME: &'static str = "MsgUpdateLiquidationsConfig"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgUpdateLiquidationsConfig".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgUpdateLiquidationsConfig".into() + } +} +/// MsgUpdateLiquidationsConfig is the Msg/LiquidationsConfig response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateLiquidationsConfigResponse {} +impl ::prost::Name for MsgUpdateLiquidationsConfigResponse { + const NAME: &'static str = "MsgUpdateLiquidationsConfigResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MsgUpdateLiquidationsConfigResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MsgUpdateLiquidationsConfigResponse".into() + } +} +/// Generated client implementations. +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// ProposedOperations is a temporary message used by block proposers + /// for matching orders as part of the ABCI++ workaround. + pub async fn proposed_operations( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Msg/ProposedOperations", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.clob.Msg", "ProposedOperations")); + self.inner.unary(req, path, codec).await + } + /// PlaceOrder allows accounts to place orders on the orderbook. + pub async fn place_order( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Msg/PlaceOrder", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.clob.Msg", "PlaceOrder")); + self.inner.unary(req, path, codec).await + } + /// CancelOrder allows accounts to cancel existing orders on the orderbook. + pub async fn cancel_order( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Msg/CancelOrder", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.clob.Msg", "CancelOrder")); + self.inner.unary(req, path, codec).await + } + /// BatchCancel allows accounts to cancel a batch of orders on the orderbook. + pub async fn batch_cancel( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Msg/BatchCancel", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.clob.Msg", "BatchCancel")); + self.inner.unary(req, path, codec).await + } + /// CreateClobPair creates a new clob pair. + pub async fn create_clob_pair( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Msg/CreateClobPair", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.clob.Msg", "CreateClobPair")); + self.inner.unary(req, path, codec).await + } + /// UpdateClobPair sets the status of a clob pair. Should return an error + /// if the authority is not in the clob keeper's set of authorities, + /// if the ClobPair id is not found in state, or if the update includes + /// an unsupported status transition. + pub async fn update_clob_pair( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Msg/UpdateClobPair", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.clob.Msg", "UpdateClobPair")); + self.inner.unary(req, path, codec).await + } + /// UpdateEquityTierLimitConfiguration updates the equity tier limit + /// configuration in state. + pub async fn update_equity_tier_limit_configuration( + &mut self, + request: impl tonic::IntoRequest< + super::MsgUpdateEquityTierLimitConfiguration, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Msg/UpdateEquityTierLimitConfiguration", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.clob.Msg", + "UpdateEquityTierLimitConfiguration", + ), + ); + self.inner.unary(req, path, codec).await + } + /// UpdateBlockRateLimitConfiguration updates the block rate limit + /// configuration in state. + pub async fn update_block_rate_limit_configuration( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Msg/UpdateBlockRateLimitConfiguration", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.clob.Msg", + "UpdateBlockRateLimitConfiguration", + ), + ); + self.inner.unary(req, path, codec).await + } + /// UpdateLiquidationsConfig updates the liquidations configuration in state. + pub async fn update_liquidations_config( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Msg/UpdateLiquidationsConfig", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.clob.Msg", "UpdateLiquidationsConfig"), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// Operation represents an operation in the proposed operations. Operation is +/// used internally within the memclob only. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Operation { + /// operation represents the operation that occurred, which can be a match, + /// short term order placement, short term order cancellation, or the placement + /// of a pre-existing stateful order. + #[prost(oneof = "operation::Operation", tags = "1, 2, 3, 4")] + pub operation: ::core::option::Option, +} +/// Nested message and enum types in `Operation`. +pub mod operation { + /// operation represents the operation that occurred, which can be a match, + /// short term order placement, short term order cancellation, or the placement + /// of a pre-existing stateful order. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Operation { + #[prost(message, tag = "1")] + Match(super::ClobMatch), + #[prost(message, tag = "2")] + ShortTermOrderPlacement(super::MsgPlaceOrder), + #[prost(message, tag = "3")] + ShortTermOrderCancellation(super::MsgCancelOrder), + #[prost(message, tag = "4")] + PreexistingStatefulOrder(super::OrderId), + } +} +impl ::prost::Name for Operation { + const NAME: &'static str = "Operation"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.Operation".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.Operation".into() + } +} +/// InternalOperation represents an internal operation in the operations to +/// propose. InternalOperation is used internally within the memclob only. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InternalOperation { + /// operation represents the operation that occurred, which can be a match, + /// Short-Term order placement, or the placement of a pre-existing stateful + /// order. + #[prost(oneof = "internal_operation::Operation", tags = "1, 2, 3, 4")] + pub operation: ::core::option::Option, +} +/// Nested message and enum types in `InternalOperation`. +pub mod internal_operation { + /// operation represents the operation that occurred, which can be a match, + /// Short-Term order placement, or the placement of a pre-existing stateful + /// order. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Operation { + #[prost(message, tag = "1")] + Match(super::ClobMatch), + #[prost(message, tag = "2")] + ShortTermOrderPlacement(super::MsgPlaceOrder), + #[prost(message, tag = "3")] + PreexistingStatefulOrder(super::OrderId), + #[prost(message, tag = "4")] + OrderRemoval(super::OrderRemoval), + } +} +impl ::prost::Name for InternalOperation { + const NAME: &'static str = "InternalOperation"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.InternalOperation".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.InternalOperation".into() + } +} +/// ProcessProposerMatchesEvents is used for communicating which events occurred +/// in the last block that require updating the state of the memclob in the +/// Commit blocker. It contains information about the following state updates: +/// - Long term order IDs that were placed in the last block. +/// - Stateful order IDs that were expired in the last block. +/// - Order IDs that were filled in the last block. +/// - Stateful cancellations order IDs that were placed in the last block. +/// - Stateful order IDs forcefully removed in the last block. +/// - Conditional order IDs triggered in the last block. +/// - Conditional order IDs placed, but not triggered in the last block. +/// - The height of the block in which the events occurred. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProcessProposerMatchesEvents { + #[prost(message, repeated, tag = "1")] + pub placed_long_term_order_ids: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "2")] + pub expired_stateful_order_ids: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "3")] + pub order_ids_filled_in_last_block: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "4")] + pub placed_stateful_cancellation_order_ids: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "5")] + pub removed_stateful_order_ids: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "6")] + pub conditional_order_ids_triggered_in_last_block: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "7")] + pub placed_conditional_order_ids: ::prost::alloc::vec::Vec, + #[prost(uint32, tag = "8")] + pub block_height: u32, +} +impl ::prost::Name for ProcessProposerMatchesEvents { + const NAME: &'static str = "ProcessProposerMatchesEvents"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.ProcessProposerMatchesEvents".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.ProcessProposerMatchesEvents".into() + } +} +/// QueryGetClobPairRequest is request type for the ClobPair method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetClobPairRequest { + #[prost(uint32, tag = "1")] + pub id: u32, +} +impl ::prost::Name for QueryGetClobPairRequest { + const NAME: &'static str = "QueryGetClobPairRequest"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.QueryGetClobPairRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.QueryGetClobPairRequest".into() + } +} +/// QueryClobPairResponse is response type for the ClobPair method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryClobPairResponse { + #[prost(message, optional, tag = "1")] + pub clob_pair: ::core::option::Option, +} +impl ::prost::Name for QueryClobPairResponse { + const NAME: &'static str = "QueryClobPairResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.QueryClobPairResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.QueryClobPairResponse".into() + } +} +/// QueryAllClobPairRequest is request type for the ClobPairAll method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllClobPairRequest { + #[prost(message, optional, tag = "1")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageRequest, + >, +} +impl ::prost::Name for QueryAllClobPairRequest { + const NAME: &'static str = "QueryAllClobPairRequest"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.QueryAllClobPairRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.QueryAllClobPairRequest".into() + } +} +/// QueryClobPairAllResponse is response type for the ClobPairAll method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryClobPairAllResponse { + #[prost(message, repeated, tag = "1")] + pub clob_pair: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageResponse, + >, +} +impl ::prost::Name for QueryClobPairAllResponse { + const NAME: &'static str = "QueryClobPairAllResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.QueryClobPairAllResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.QueryClobPairAllResponse".into() + } +} +/// MevNodeToNodeCalculationRequest is a request message used to run the +/// MEV node <> node calculation. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MevNodeToNodeCalculationRequest { + /// Represents the matches on the "block proposer". Note that this field + /// does not need to be the actual block proposer's matches for a block, since + /// the MEV calculation logic is run with this nodes matches as the "block + /// proposer" matches. + #[prost(message, optional, tag = "1")] + pub block_proposer_matches: ::core::option::Option, + /// Represents the matches and mid-prices on the validator. + #[prost(message, optional, tag = "2")] + pub validator_mev_metrics: ::core::option::Option, +} +impl ::prost::Name for MevNodeToNodeCalculationRequest { + const NAME: &'static str = "MevNodeToNodeCalculationRequest"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MevNodeToNodeCalculationRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MevNodeToNodeCalculationRequest".into() + } +} +/// MevNodeToNodeCalculationResponse is a response message that contains the +/// MEV node <> node calculation result. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MevNodeToNodeCalculationResponse { + #[prost(message, repeated, tag = "1")] + pub results: ::prost::alloc::vec::Vec< + mev_node_to_node_calculation_response::MevAndVolumePerClob, + >, +} +/// Nested message and enum types in `MevNodeToNodeCalculationResponse`. +pub mod mev_node_to_node_calculation_response { + /// MevAndVolumePerClob contains information about the MEV and volume per CLOB. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct MevAndVolumePerClob { + #[prost(uint32, tag = "1")] + pub clob_pair_id: u32, + #[prost(float, tag = "2")] + pub mev: f32, + #[prost(uint64, tag = "3")] + pub volume: u64, + } + impl ::prost::Name for MevAndVolumePerClob { + const NAME: &'static str = "MevAndVolumePerClob"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MevNodeToNodeCalculationResponse.MevAndVolumePerClob" + .into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MevNodeToNodeCalculationResponse.MevAndVolumePerClob" + .into() + } + } +} +impl ::prost::Name for MevNodeToNodeCalculationResponse { + const NAME: &'static str = "MevNodeToNodeCalculationResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.MevNodeToNodeCalculationResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.MevNodeToNodeCalculationResponse".into() + } +} +/// QueryEquityTierLimitConfigurationRequest is a request message for +/// EquityTierLimitConfiguration. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEquityTierLimitConfigurationRequest {} +impl ::prost::Name for QueryEquityTierLimitConfigurationRequest { + const NAME: &'static str = "QueryEquityTierLimitConfigurationRequest"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.QueryEquityTierLimitConfigurationRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.QueryEquityTierLimitConfigurationRequest".into() + } +} +/// QueryEquityTierLimitConfigurationResponse is a response message that contains +/// the EquityTierLimitConfiguration. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEquityTierLimitConfigurationResponse { + #[prost(message, optional, tag = "1")] + pub equity_tier_limit_config: ::core::option::Option, +} +impl ::prost::Name for QueryEquityTierLimitConfigurationResponse { + const NAME: &'static str = "QueryEquityTierLimitConfigurationResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.QueryEquityTierLimitConfigurationResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.QueryEquityTierLimitConfigurationResponse".into() + } +} +/// QueryBlockRateLimitConfigurationRequest is a request message for +/// BlockRateLimitConfiguration. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryBlockRateLimitConfigurationRequest {} +impl ::prost::Name for QueryBlockRateLimitConfigurationRequest { + const NAME: &'static str = "QueryBlockRateLimitConfigurationRequest"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.QueryBlockRateLimitConfigurationRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.QueryBlockRateLimitConfigurationRequest".into() + } +} +/// QueryBlockRateLimitConfigurationResponse is a response message that contains +/// the BlockRateLimitConfiguration. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryBlockRateLimitConfigurationResponse { + #[prost(message, optional, tag = "1")] + pub block_rate_limit_config: ::core::option::Option, +} +impl ::prost::Name for QueryBlockRateLimitConfigurationResponse { + const NAME: &'static str = "QueryBlockRateLimitConfigurationResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.QueryBlockRateLimitConfigurationResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.QueryBlockRateLimitConfigurationResponse".into() + } +} +/// QueryStatefulOrderRequest is a request message for StatefulOrder. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryStatefulOrderRequest { + /// Order id to query. + #[prost(message, optional, tag = "1")] + pub order_id: ::core::option::Option, +} +impl ::prost::Name for QueryStatefulOrderRequest { + const NAME: &'static str = "QueryStatefulOrderRequest"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.QueryStatefulOrderRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.QueryStatefulOrderRequest".into() + } +} +/// QueryStatefulOrderResponse is a response message that contains the stateful +/// order. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryStatefulOrderResponse { + /// Stateful order placement. + #[prost(message, optional, tag = "1")] + pub order_placement: ::core::option::Option, + /// Fill amounts. + #[prost(uint64, tag = "2")] + pub fill_amount: u64, + /// Triggered status. + #[prost(bool, tag = "3")] + pub triggered: bool, +} +impl ::prost::Name for QueryStatefulOrderResponse { + const NAME: &'static str = "QueryStatefulOrderResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.QueryStatefulOrderResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.QueryStatefulOrderResponse".into() + } +} +/// QueryLiquidationsConfigurationRequest is a request message for +/// LiquidationsConfiguration. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryLiquidationsConfigurationRequest {} +impl ::prost::Name for QueryLiquidationsConfigurationRequest { + const NAME: &'static str = "QueryLiquidationsConfigurationRequest"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.QueryLiquidationsConfigurationRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.QueryLiquidationsConfigurationRequest".into() + } +} +/// QueryLiquidationsConfigurationResponse is a response message that contains +/// the LiquidationsConfiguration. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryLiquidationsConfigurationResponse { + #[prost(message, optional, tag = "1")] + pub liquidations_config: ::core::option::Option, +} +impl ::prost::Name for QueryLiquidationsConfigurationResponse { + const NAME: &'static str = "QueryLiquidationsConfigurationResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.QueryLiquidationsConfigurationResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.QueryLiquidationsConfigurationResponse".into() + } +} +/// StreamOrderbookUpdatesRequest is a request message for the +/// StreamOrderbookUpdates method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StreamOrderbookUpdatesRequest { + /// Clob pair ids to stream orderbook updates for. + #[prost(uint32, repeated, tag = "1")] + pub clob_pair_id: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for StreamOrderbookUpdatesRequest { + const NAME: &'static str = "StreamOrderbookUpdatesRequest"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.StreamOrderbookUpdatesRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.StreamOrderbookUpdatesRequest".into() + } +} +/// StreamOrderbookUpdatesResponse is a response message for the +/// StreamOrderbookUpdates method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StreamOrderbookUpdatesResponse { + /// Orderbook updates for the clob pair. + #[prost(message, repeated, tag = "1")] + pub updates: ::prost::alloc::vec::Vec, + /// ---Additional fields used to debug issues--- + /// Block height of the updates. + #[prost(uint32, tag = "2")] + pub block_height: u32, + /// Exec mode of the updates. + #[prost(uint32, tag = "3")] + pub exec_mode: u32, +} +impl ::prost::Name for StreamOrderbookUpdatesResponse { + const NAME: &'static str = "StreamOrderbookUpdatesResponse"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.StreamOrderbookUpdatesResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.StreamOrderbookUpdatesResponse".into() + } +} +/// StreamUpdate is an update that will be pushed through the +/// GRPC stream. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StreamUpdate { + /// Contains one of an StreamOrderbookUpdate, + /// StreamOrderbookFill. + #[prost(oneof = "stream_update::UpdateMessage", tags = "1, 2")] + pub update_message: ::core::option::Option, +} +/// Nested message and enum types in `StreamUpdate`. +pub mod stream_update { + /// Contains one of an StreamOrderbookUpdate, + /// StreamOrderbookFill. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum UpdateMessage { + #[prost(message, tag = "1")] + OrderbookUpdate(super::StreamOrderbookUpdate), + #[prost(message, tag = "2")] + OrderFill(super::StreamOrderbookFill), + } +} +impl ::prost::Name for StreamUpdate { + const NAME: &'static str = "StreamUpdate"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.StreamUpdate".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.StreamUpdate".into() + } +} +/// StreamOrderbookUpdate provides information on an orderbook update. Used in +/// the full node GRPC stream. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StreamOrderbookUpdate { + /// Orderbook updates for the clob pair. Can contain order place, removals, + /// or updates. + #[prost(message, repeated, tag = "1")] + pub updates: ::prost::alloc::vec::Vec< + super::indexer::off_chain_updates::OffChainUpdateV1, + >, + /// Snapshot indicates if the response is from a snapshot of the orderbook. + /// This is true for the initial response and false for all subsequent updates. + /// Note that if the snapshot is true, then all previous entries should be + /// discarded and the orderbook should be resynced. + #[prost(bool, tag = "2")] + pub snapshot: bool, +} +impl ::prost::Name for StreamOrderbookUpdate { + const NAME: &'static str = "StreamOrderbookUpdate"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.StreamOrderbookUpdate".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.StreamOrderbookUpdate".into() + } +} +/// StreamOrderbookFill provides information on an orderbook fill. Used in +/// the full node GRPC stream. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StreamOrderbookFill { + /// Clob match. Provides information on which orders were matched + /// and the type of order. Fill amounts here are relative. + #[prost(message, optional, tag = "1")] + pub clob_match: ::core::option::Option, + /// All orders involved in the specified clob match. Used to look up + /// price of a match through a given maker order id. + #[prost(message, repeated, tag = "2")] + pub orders: ::prost::alloc::vec::Vec, + /// Resulting fill amounts for each order in the orders array. + #[prost(uint64, repeated, packed = "false", tag = "3")] + pub fill_amounts: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for StreamOrderbookFill { + const NAME: &'static str = "StreamOrderbookFill"; + const PACKAGE: &'static str = "dydxprotocol.clob"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.clob.StreamOrderbookFill".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.clob.StreamOrderbookFill".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Queries a ClobPair by id. + pub async fn clob_pair( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Query/ClobPair", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.clob.Query", "ClobPair")); + self.inner.unary(req, path, codec).await + } + /// Queries a list of ClobPair items. + pub async fn clob_pair_all( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Query/ClobPairAll", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.clob.Query", "ClobPairAll")); + self.inner.unary(req, path, codec).await + } + /// Runs the MEV node <> node calculation with the provided parameters. + pub async fn mev_node_to_node_calculation( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Query/MevNodeToNodeCalculation", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.clob.Query", + "MevNodeToNodeCalculation", + ), + ); + self.inner.unary(req, path, codec).await + } + /// Queries EquityTierLimitConfiguration. + pub async fn equity_tier_limit_configuration( + &mut self, + request: impl tonic::IntoRequest< + super::QueryEquityTierLimitConfigurationRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Query/EquityTierLimitConfiguration", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.clob.Query", + "EquityTierLimitConfiguration", + ), + ); + self.inner.unary(req, path, codec).await + } + /// Queries BlockRateLimitConfiguration. + pub async fn block_rate_limit_configuration( + &mut self, + request: impl tonic::IntoRequest< + super::QueryBlockRateLimitConfigurationRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Query/BlockRateLimitConfiguration", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.clob.Query", + "BlockRateLimitConfiguration", + ), + ); + self.inner.unary(req, path, codec).await + } + /// Queries LiquidationsConfiguration. + pub async fn liquidations_configuration( + &mut self, + request: impl tonic::IntoRequest< + super::QueryLiquidationsConfigurationRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Query/LiquidationsConfiguration", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.clob.Query", + "LiquidationsConfiguration", + ), + ); + self.inner.unary(req, path, codec).await + } + /// Queries the stateful order for a given order id. + pub async fn stateful_order( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Query/StatefulOrder", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.clob.Query", "StatefulOrder")); + self.inner.unary(req, path, codec).await + } + /// Streams orderbook updates. Updates contain orderbook data + /// such as order placements, updates, and fills. + pub async fn stream_orderbook_updates( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response< + tonic::codec::Streaming, + >, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.clob.Query/StreamOrderbookUpdates", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.clob.Query", "StreamOrderbookUpdates"), + ); + self.inner.server_streaming(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.daemons.bridge.rs b/v4-proto-rs/src/dydxprotocol.daemons.bridge.rs new file mode 100644 index 0000000000..ae7eb45729 --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.daemons.bridge.rs @@ -0,0 +1,152 @@ +// This file is @generated by prost-build. +/// AddBridgeEventsRequest is a request message that contains a list of new +/// bridge events. The events should be contiguous and sorted by (unique) id. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AddBridgeEventsRequest { + #[prost(message, repeated, tag = "1")] + pub bridge_events: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for AddBridgeEventsRequest { + const NAME: &'static str = "AddBridgeEventsRequest"; + const PACKAGE: &'static str = "dydxprotocol.daemons.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.daemons.bridge.AddBridgeEventsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.daemons.bridge.AddBridgeEventsRequest".into() + } +} +/// AddBridgeEventsResponse is a response message for BridgeEventRequest. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AddBridgeEventsResponse {} +impl ::prost::Name for AddBridgeEventsResponse { + const NAME: &'static str = "AddBridgeEventsResponse"; + const PACKAGE: &'static str = "dydxprotocol.daemons.bridge"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.daemons.bridge.AddBridgeEventsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.daemons.bridge.AddBridgeEventsResponse".into() + } +} +/// Generated client implementations. +pub mod bridge_service_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// BridgeService defines the gRPC service used by bridge daemon. + #[derive(Debug, Clone)] + pub struct BridgeServiceClient { + inner: tonic::client::Grpc, + } + impl BridgeServiceClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl BridgeServiceClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> BridgeServiceClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + BridgeServiceClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Sends a list of newly recognized bridge events. + pub async fn add_bridge_events( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.daemons.bridge.BridgeService/AddBridgeEvents", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.daemons.bridge.BridgeService", + "AddBridgeEvents", + ), + ); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.daemons.liquidation.rs b/v4-proto-rs/src/dydxprotocol.daemons.liquidation.rs new file mode 100644 index 0000000000..b87a3eed41 --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.daemons.liquidation.rs @@ -0,0 +1,171 @@ +// This file is @generated by prost-build. +/// LiquidateSubaccountsRequest is a request message that contains a list of +/// subaccount ids that potentially need to be liquidated. The list of subaccount +/// ids should not contain duplicates. The application should re-verify these +/// subaccount ids against current state before liquidating their positions. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LiquidateSubaccountsRequest { + /// The block height at which the liquidation daemon is processing. + #[prost(uint32, tag = "1")] + pub block_height: u32, + /// The list of liquidatable subaccount ids. + #[prost(message, repeated, tag = "2")] + pub liquidatable_subaccount_ids: ::prost::alloc::vec::Vec< + super::super::subaccounts::SubaccountId, + >, + /// The list of subaccount ids with negative total net collateral. + #[prost(message, repeated, tag = "3")] + pub negative_tnc_subaccount_ids: ::prost::alloc::vec::Vec< + super::super::subaccounts::SubaccountId, + >, + /// A map of perpetual id to subaccount open position info. + #[prost(message, repeated, tag = "4")] + pub subaccount_open_position_info: ::prost::alloc::vec::Vec< + super::super::clob::SubaccountOpenPositionInfo, + >, +} +impl ::prost::Name for LiquidateSubaccountsRequest { + const NAME: &'static str = "LiquidateSubaccountsRequest"; + const PACKAGE: &'static str = "dydxprotocol.daemons.liquidation"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.daemons.liquidation.LiquidateSubaccountsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.daemons.liquidation.LiquidateSubaccountsRequest".into() + } +} +/// LiquidateSubaccountsResponse is a response message for +/// LiquidateSubaccountsRequest. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LiquidateSubaccountsResponse {} +impl ::prost::Name for LiquidateSubaccountsResponse { + const NAME: &'static str = "LiquidateSubaccountsResponse"; + const PACKAGE: &'static str = "dydxprotocol.daemons.liquidation"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.daemons.liquidation.LiquidateSubaccountsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.daemons.liquidation.LiquidateSubaccountsResponse".into() + } +} +/// Generated client implementations. +pub mod liquidation_service_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// LiquidationService defines the gRPC service used by liquidation daemon. + #[derive(Debug, Clone)] + pub struct LiquidationServiceClient { + inner: tonic::client::Grpc, + } + impl LiquidationServiceClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl LiquidationServiceClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> LiquidationServiceClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + LiquidationServiceClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Sends a list of subaccount ids that are potentially liquidatable. + pub async fn liquidate_subaccounts( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.daemons.liquidation.LiquidationService/LiquidateSubaccounts", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.daemons.liquidation.LiquidationService", + "LiquidateSubaccounts", + ), + ); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.daemons.pricefeed.rs b/v4-proto-rs/src/dydxprotocol.daemons.pricefeed.rs new file mode 100644 index 0000000000..bb273d7232 --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.daemons.pricefeed.rs @@ -0,0 +1,191 @@ +// This file is @generated by prost-build. +/// UpdateMarketPriceRequest is a request message updating market prices. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateMarketPricesRequest { + #[prost(message, repeated, tag = "1")] + pub market_price_updates: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for UpdateMarketPricesRequest { + const NAME: &'static str = "UpdateMarketPricesRequest"; + const PACKAGE: &'static str = "dydxprotocol.daemons.pricefeed"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.daemons.pricefeed.UpdateMarketPricesRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.daemons.pricefeed.UpdateMarketPricesRequest".into() + } +} +/// UpdateMarketPricesResponse is a response message for updating market prices. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateMarketPricesResponse {} +impl ::prost::Name for UpdateMarketPricesResponse { + const NAME: &'static str = "UpdateMarketPricesResponse"; + const PACKAGE: &'static str = "dydxprotocol.daemons.pricefeed"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.daemons.pricefeed.UpdateMarketPricesResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.daemons.pricefeed.UpdateMarketPricesResponse".into() + } +} +/// ExchangePrice represents a specific exchange's market price +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExchangePrice { + #[prost(string, tag = "1")] + pub exchange_id: ::prost::alloc::string::String, + #[prost(uint64, tag = "2")] + pub price: u64, + #[prost(message, optional, tag = "3")] + pub last_update_time: ::core::option::Option<::prost_types::Timestamp>, +} +impl ::prost::Name for ExchangePrice { + const NAME: &'static str = "ExchangePrice"; + const PACKAGE: &'static str = "dydxprotocol.daemons.pricefeed"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.daemons.pricefeed.ExchangePrice".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.daemons.pricefeed.ExchangePrice".into() + } +} +/// MarketPriceUpdate represents an update to a single market +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketPriceUpdate { + #[prost(uint32, tag = "1")] + pub market_id: u32, + #[prost(message, repeated, tag = "2")] + pub exchange_prices: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for MarketPriceUpdate { + const NAME: &'static str = "MarketPriceUpdate"; + const PACKAGE: &'static str = "dydxprotocol.daemons.pricefeed"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.daemons.pricefeed.MarketPriceUpdate".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.daemons.pricefeed.MarketPriceUpdate".into() + } +} +/// Generated client implementations. +pub mod price_feed_service_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// PriceFeedService provides methods related to market prices. + #[derive(Debug, Clone)] + pub struct PriceFeedServiceClient { + inner: tonic::client::Grpc, + } + impl PriceFeedServiceClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl PriceFeedServiceClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> PriceFeedServiceClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + PriceFeedServiceClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Updates market prices. + pub async fn update_market_prices( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.daemons.pricefeed.PriceFeedService/UpdateMarketPrices", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.daemons.pricefeed.PriceFeedService", + "UpdateMarketPrices", + ), + ); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.delaymsg.rs b/v4-proto-rs/src/dydxprotocol.delaymsg.rs new file mode 100644 index 0000000000..b4e043a63f --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.delaymsg.rs @@ -0,0 +1,498 @@ +// This file is @generated by prost-build. +/// BlockMessageIds stores the id of each message that should be processed at a +/// given block height. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockMessageIds { + /// ids stores a list of DelayedMessage ids that should be processed at a given + /// block height. + #[prost(uint32, repeated, tag = "1")] + pub ids: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for BlockMessageIds { + const NAME: &'static str = "BlockMessageIds"; + const PACKAGE: &'static str = "dydxprotocol.delaymsg"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.delaymsg.BlockMessageIds".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.delaymsg.BlockMessageIds".into() + } +} +/// DelayedMessage is a message that is delayed until a certain block height. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DelayedMessage { + /// The ID of the delayed message. + #[prost(uint32, tag = "1")] + pub id: u32, + /// The message to be executed. + #[prost(message, optional, tag = "2")] + pub msg: ::core::option::Option<::prost_types::Any>, + /// The block height at which the message should be executed. + #[prost(uint32, tag = "3")] + pub block_height: u32, +} +impl ::prost::Name for DelayedMessage { + const NAME: &'static str = "DelayedMessage"; + const PACKAGE: &'static str = "dydxprotocol.delaymsg"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.delaymsg.DelayedMessage".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.delaymsg.DelayedMessage".into() + } +} +/// GenesisState defines the delaymsg module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// delayed_messages is a list of delayed messages. + #[prost(message, repeated, tag = "1")] + pub delayed_messages: ::prost::alloc::vec::Vec, + /// next_delayed_message_id is the id to be assigned to next delayed message. + #[prost(uint32, tag = "2")] + pub next_delayed_message_id: u32, +} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.delaymsg"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.delaymsg.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.delaymsg.GenesisState".into() + } +} +/// QueryNextDelayedMessageIdRequest is the request type for the +/// NextDelayedMessageId RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryNextDelayedMessageIdRequest {} +impl ::prost::Name for QueryNextDelayedMessageIdRequest { + const NAME: &'static str = "QueryNextDelayedMessageIdRequest"; + const PACKAGE: &'static str = "dydxprotocol.delaymsg"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.delaymsg.QueryNextDelayedMessageIdRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.delaymsg.QueryNextDelayedMessageIdRequest".into() + } +} +/// QueryNextDelayedMessageIdResponse is the response type for the +/// NextDelayedMessageId RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryNextDelayedMessageIdResponse { + #[prost(uint32, tag = "1")] + pub next_delayed_message_id: u32, +} +impl ::prost::Name for QueryNextDelayedMessageIdResponse { + const NAME: &'static str = "QueryNextDelayedMessageIdResponse"; + const PACKAGE: &'static str = "dydxprotocol.delaymsg"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.delaymsg.QueryNextDelayedMessageIdResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.delaymsg.QueryNextDelayedMessageIdResponse".into() + } +} +/// QueryMessageRequest is the request type for the Message RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryMessageRequest { + #[prost(uint32, tag = "1")] + pub id: u32, +} +impl ::prost::Name for QueryMessageRequest { + const NAME: &'static str = "QueryMessageRequest"; + const PACKAGE: &'static str = "dydxprotocol.delaymsg"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.delaymsg.QueryMessageRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.delaymsg.QueryMessageRequest".into() + } +} +/// QueryGetMessageResponse is the response type for the Message RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryMessageResponse { + #[prost(message, optional, tag = "1")] + pub message: ::core::option::Option, +} +impl ::prost::Name for QueryMessageResponse { + const NAME: &'static str = "QueryMessageResponse"; + const PACKAGE: &'static str = "dydxprotocol.delaymsg"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.delaymsg.QueryMessageResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.delaymsg.QueryMessageResponse".into() + } +} +/// QueryBlockMessageIdsRequest is the request type for the BlockMessageIds +/// RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryBlockMessageIdsRequest { + #[prost(uint32, tag = "1")] + pub block_height: u32, +} +impl ::prost::Name for QueryBlockMessageIdsRequest { + const NAME: &'static str = "QueryBlockMessageIdsRequest"; + const PACKAGE: &'static str = "dydxprotocol.delaymsg"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.delaymsg.QueryBlockMessageIdsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.delaymsg.QueryBlockMessageIdsRequest".into() + } +} +/// QueryGetBlockMessageIdsResponse is the response type for the BlockMessageIds +/// RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryBlockMessageIdsResponse { + #[prost(uint32, repeated, tag = "1")] + pub message_ids: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for QueryBlockMessageIdsResponse { + const NAME: &'static str = "QueryBlockMessageIdsResponse"; + const PACKAGE: &'static str = "dydxprotocol.delaymsg"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.delaymsg.QueryBlockMessageIdsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.delaymsg.QueryBlockMessageIdsResponse".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Queries the next DelayedMessage's id. + pub async fn next_delayed_message_id( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.delaymsg.Query/NextDelayedMessageId", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.delaymsg.Query", + "NextDelayedMessageId", + ), + ); + self.inner.unary(req, path, codec).await + } + /// Queries the DelayedMessage by id. + pub async fn message( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.delaymsg.Query/Message", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.delaymsg.Query", "Message")); + self.inner.unary(req, path, codec).await + } + /// Queries the DelayedMessages at a given block height. + pub async fn block_message_ids( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.delaymsg.Query/BlockMessageIds", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.delaymsg.Query", "BlockMessageIds"), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// MsgDelayMessage is a request type for the DelayMessage method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgDelayMessage { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// The message to be delayed. + #[prost(message, optional, tag = "2")] + pub msg: ::core::option::Option<::prost_types::Any>, + /// The number of blocks to delay the message for. + #[prost(uint32, tag = "3")] + pub delay_blocks: u32, +} +impl ::prost::Name for MsgDelayMessage { + const NAME: &'static str = "MsgDelayMessage"; + const PACKAGE: &'static str = "dydxprotocol.delaymsg"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.delaymsg.MsgDelayMessage".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.delaymsg.MsgDelayMessage".into() + } +} +/// MsgDelayMessageResponse is a response type for the DelayMessage method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgDelayMessageResponse { + /// The id of the created delayed message. + #[prost(uint64, tag = "1")] + pub id: u64, +} +impl ::prost::Name for MsgDelayMessageResponse { + const NAME: &'static str = "MsgDelayMessageResponse"; + const PACKAGE: &'static str = "dydxprotocol.delaymsg"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.delaymsg.MsgDelayMessageResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.delaymsg.MsgDelayMessageResponse".into() + } +} +/// Generated client implementations. +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// DelayMessage delays the execution of a message for a given number of + /// blocks. + pub async fn delay_message( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.delaymsg.Msg/DelayMessage", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.delaymsg.Msg", "DelayMessage")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.epochs.rs b/v4-proto-rs/src/dydxprotocol.epochs.rs new file mode 100644 index 0000000000..b586a436c1 --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.epochs.rs @@ -0,0 +1,284 @@ +// This file is @generated by prost-build. +/// EpochInfo stores metadata of an epoch timer. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EpochInfo { + /// name is the unique identifier. + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + /// next_tick indicates when the next epoch starts (in Unix Epoch seconds), + /// if `EpochInfo` has been initialized. + /// If `EpochInfo` is not initialized yet, `next_tick` indicates the earliest + /// initialization time (see `is_initialized` below). + #[prost(uint32, tag = "2")] + pub next_tick: u32, + /// duration of the epoch in seconds. + #[prost(uint32, tag = "3")] + pub duration: u32, + /// current epoch is the number of the current epoch. + /// 0 if `next_tick` has never been reached, positive otherwise. + #[prost(uint32, tag = "4")] + pub current_epoch: u32, + /// current_epoch_start_block indicates the block height when the current + /// epoch started. 0 if `current_epoch` is 0. + #[prost(uint32, tag = "5")] + pub current_epoch_start_block: u32, + /// is_initialized indicates whether the `EpochInfo` has been initialized + /// and started ticking. + /// An `EpochInfo` is initialized when all below conditions are true: + /// - Not yet initialized + /// - `BlockHeight` >= 2 + /// - `BlockTime` >= `next_tick` + #[prost(bool, tag = "6")] + pub is_initialized: bool, + /// fast_forward_next_tick specifies whether during initialization, `next_tick` + /// should be fast-forwarded to be greater than the current block time. + /// If `false`, the original `next_tick` value is + /// unchanged during initialization. + /// If `true`, `next_tick` will be set to the smallest value `x` greater than + /// the current block time such that `(x - next_tick) % duration = 0`. + #[prost(bool, tag = "7")] + pub fast_forward_next_tick: bool, +} +impl ::prost::Name for EpochInfo { + const NAME: &'static str = "EpochInfo"; + const PACKAGE: &'static str = "dydxprotocol.epochs"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.epochs.EpochInfo".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.epochs.EpochInfo".into() + } +} +/// GenesisState defines the epochs module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// this line is used by starport scaffolding # genesis/proto/state + #[prost(message, repeated, tag = "1")] + pub epoch_info_list: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.epochs"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.epochs.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.epochs.GenesisState".into() + } +} +/// QueryGetEpochInfoRequest is request type for the GetEpochInfo RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetEpochInfoRequest { + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, +} +impl ::prost::Name for QueryGetEpochInfoRequest { + const NAME: &'static str = "QueryGetEpochInfoRequest"; + const PACKAGE: &'static str = "dydxprotocol.epochs"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.epochs.QueryGetEpochInfoRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.epochs.QueryGetEpochInfoRequest".into() + } +} +/// QueryEpochInfoResponse is response type for the GetEpochInfo RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEpochInfoResponse { + #[prost(message, optional, tag = "1")] + pub epoch_info: ::core::option::Option, +} +impl ::prost::Name for QueryEpochInfoResponse { + const NAME: &'static str = "QueryEpochInfoResponse"; + const PACKAGE: &'static str = "dydxprotocol.epochs"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.epochs.QueryEpochInfoResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.epochs.QueryEpochInfoResponse".into() + } +} +/// QueryAllEpochInfoRequest is request type for the AllEpochInfo RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllEpochInfoRequest { + #[prost(message, optional, tag = "1")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageRequest, + >, +} +impl ::prost::Name for QueryAllEpochInfoRequest { + const NAME: &'static str = "QueryAllEpochInfoRequest"; + const PACKAGE: &'static str = "dydxprotocol.epochs"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.epochs.QueryAllEpochInfoRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.epochs.QueryAllEpochInfoRequest".into() + } +} +/// QueryEpochInfoAllResponse is response type for the AllEpochInfo RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEpochInfoAllResponse { + #[prost(message, repeated, tag = "1")] + pub epoch_info: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageResponse, + >, +} +impl ::prost::Name for QueryEpochInfoAllResponse { + const NAME: &'static str = "QueryEpochInfoAllResponse"; + const PACKAGE: &'static str = "dydxprotocol.epochs"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.epochs.QueryEpochInfoAllResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.epochs.QueryEpochInfoAllResponse".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Queries a EpochInfo by name. + pub async fn epoch_info( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.epochs.Query/EpochInfo", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.epochs.Query", "EpochInfo")); + self.inner.unary(req, path, codec).await + } + /// Queries a list of EpochInfo items. + pub async fn epoch_info_all( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.epochs.Query/EpochInfoAll", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.epochs.Query", "EpochInfoAll")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.feetiers.rs b/v4-proto-rs/src/dydxprotocol.feetiers.rs new file mode 100644 index 0000000000..36aa2256ae --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.feetiers.rs @@ -0,0 +1,436 @@ +// This file is @generated by prost-build. +/// PerpetualFeeParams defines the parameters for perpetual fees. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PerpetualFeeParams { + /// Sorted fee tiers (lowest requirements first). + #[prost(message, repeated, tag = "1")] + pub tiers: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for PerpetualFeeParams { + const NAME: &'static str = "PerpetualFeeParams"; + const PACKAGE: &'static str = "dydxprotocol.feetiers"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.feetiers.PerpetualFeeParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.feetiers.PerpetualFeeParams".into() + } +} +/// A fee tier for perpetuals +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PerpetualFeeTier { + /// Human-readable name of the tier, e.g. "Gold". + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + /// The trader's absolute volume requirement in quote quantums. + #[prost(uint64, tag = "2")] + pub absolute_volume_requirement: u64, + /// The total volume share requirement. + #[prost(uint32, tag = "3")] + pub total_volume_share_requirement_ppm: u32, + /// The maker volume share requirement. + #[prost(uint32, tag = "4")] + pub maker_volume_share_requirement_ppm: u32, + /// The maker fee once this tier is reached. + #[prost(sint32, tag = "5")] + pub maker_fee_ppm: i32, + /// The taker fee once this tier is reached. + #[prost(sint32, tag = "6")] + pub taker_fee_ppm: i32, +} +impl ::prost::Name for PerpetualFeeTier { + const NAME: &'static str = "PerpetualFeeTier"; + const PACKAGE: &'static str = "dydxprotocol.feetiers"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.feetiers.PerpetualFeeTier".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.feetiers.PerpetualFeeTier".into() + } +} +/// GenesisState defines the feetiers module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// The parameters for perpetual fees. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.feetiers"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.feetiers.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.feetiers.GenesisState".into() + } +} +/// QueryPerpetualFeeParamsRequest is a request type for the PerpetualFeeParams +/// RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPerpetualFeeParamsRequest {} +impl ::prost::Name for QueryPerpetualFeeParamsRequest { + const NAME: &'static str = "QueryPerpetualFeeParamsRequest"; + const PACKAGE: &'static str = "dydxprotocol.feetiers"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.feetiers.QueryPerpetualFeeParamsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.feetiers.QueryPerpetualFeeParamsRequest".into() + } +} +/// QueryPerpetualFeeParamsResponse is a response type for the PerpetualFeeParams +/// RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPerpetualFeeParamsResponse { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +impl ::prost::Name for QueryPerpetualFeeParamsResponse { + const NAME: &'static str = "QueryPerpetualFeeParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.feetiers"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.feetiers.QueryPerpetualFeeParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.feetiers.QueryPerpetualFeeParamsResponse".into() + } +} +/// QueryUserFeeTierRequest is a request type for the UserFeeTier RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryUserFeeTierRequest { + #[prost(string, tag = "1")] + pub user: ::prost::alloc::string::String, +} +impl ::prost::Name for QueryUserFeeTierRequest { + const NAME: &'static str = "QueryUserFeeTierRequest"; + const PACKAGE: &'static str = "dydxprotocol.feetiers"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.feetiers.QueryUserFeeTierRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.feetiers.QueryUserFeeTierRequest".into() + } +} +/// QueryUserFeeTierResponse is a request type for the UserFeeTier RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryUserFeeTierResponse { + /// Index of the fee tier in the list queried from PerpetualFeeParams. + #[prost(uint32, tag = "1")] + pub index: u32, + #[prost(message, optional, tag = "2")] + pub tier: ::core::option::Option, +} +impl ::prost::Name for QueryUserFeeTierResponse { + const NAME: &'static str = "QueryUserFeeTierResponse"; + const PACKAGE: &'static str = "dydxprotocol.feetiers"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.feetiers.QueryUserFeeTierResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.feetiers.QueryUserFeeTierResponse".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Queries the PerpetualFeeParams. + pub async fn perpetual_fee_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.feetiers.Query/PerpetualFeeParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.feetiers.Query", "PerpetualFeeParams"), + ); + self.inner.unary(req, path, codec).await + } + /// Queries a user's fee tier + pub async fn user_fee_tier( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.feetiers.Query/UserFeeTier", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.feetiers.Query", "UserFeeTier")); + self.inner.unary(req, path, codec).await + } + } +} +/// MsgUpdatePerpetualFeeParams is the Msg/UpdatePerpetualFeeParams request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdatePerpetualFeeParams { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// Defines the parameters to update. All parameters must be supplied. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +impl ::prost::Name for MsgUpdatePerpetualFeeParams { + const NAME: &'static str = "MsgUpdatePerpetualFeeParams"; + const PACKAGE: &'static str = "dydxprotocol.feetiers"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.feetiers.MsgUpdatePerpetualFeeParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.feetiers.MsgUpdatePerpetualFeeParams".into() + } +} +/// MsgUpdatePerpetualFeeParamsResponse is the Msg/UpdatePerpetualFeeParams +/// response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdatePerpetualFeeParamsResponse {} +impl ::prost::Name for MsgUpdatePerpetualFeeParamsResponse { + const NAME: &'static str = "MsgUpdatePerpetualFeeParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.feetiers"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.feetiers.MsgUpdatePerpetualFeeParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.feetiers.MsgUpdatePerpetualFeeParamsResponse".into() + } +} +/// Generated client implementations. +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// UpdatePerpetualFeeParams updates the PerpetualFeeParams in state. + pub async fn update_perpetual_fee_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.feetiers.Msg/UpdatePerpetualFeeParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.feetiers.Msg", + "UpdatePerpetualFeeParams", + ), + ); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.govplus.rs b/v4-proto-rs/src/dydxprotocol.govplus.rs new file mode 100644 index 0000000000..3d9b4e7aed --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.govplus.rs @@ -0,0 +1,275 @@ +// This file is @generated by prost-build. +/// GenesisState defines the govplus module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState {} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.govplus"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.govplus.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.govplus.GenesisState".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + } +} +/// MsgSlashValidator is the Msg/SlashValidator request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSlashValidator { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// Consensus address of the validator to slash + #[prost(string, tag = "2")] + pub validator_address: ::prost::alloc::string::String, + /// Colloquially, the height at which the validator is deemed to have + /// misbehaved. In practice, this is the height used to determine the targets + /// of the slash. For example, undelegating after this height will not escape + /// slashing. This height should be set to a recent height at the time of the + /// proposal to prevent delegators from undelegating during the vote period. + /// i.e. infraction_height <= proposal submission height. + /// + /// NB: At the time this message is applied, this height must have occured + /// equal to or less than an unbonding period in the past in order for the + /// slash to be effective. + /// i.e. time(proposal pass height) - time(infraction_height) < unbonding + /// period + #[prost(uint32, tag = "3")] + pub infraction_height: u32, + /// Tokens of the validator at the specified height. Used to compute the slash + /// amount. The x/staking HistoricalInfo query endpoint can be used to find + /// this. + #[prost(bytes = "vec", tag = "4")] + pub tokens_at_infraction_height: ::prost::alloc::vec::Vec, + /// Multiplier for how much of the validator's stake should be slashed. + /// slash_factor * tokens_at_infraction_height = tokens slashed + #[prost(string, tag = "5")] + pub slash_factor: ::prost::alloc::string::String, +} +impl ::prost::Name for MsgSlashValidator { + const NAME: &'static str = "MsgSlashValidator"; + const PACKAGE: &'static str = "dydxprotocol.govplus"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.govplus.MsgSlashValidator".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.govplus.MsgSlashValidator".into() + } +} +/// MsgSlashValidatorResponse is the Msg/SlashValidator response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSlashValidatorResponse {} +impl ::prost::Name for MsgSlashValidatorResponse { + const NAME: &'static str = "MsgSlashValidatorResponse"; + const PACKAGE: &'static str = "dydxprotocol.govplus"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.govplus.MsgSlashValidatorResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.govplus.MsgSlashValidatorResponse".into() + } +} +/// Generated client implementations. +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// SlashValidator is exposed to allow slashing of a misbehaving validator via + /// governance. + pub async fn slash_validator( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.govplus.Msg/SlashValidator", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.govplus.Msg", "SlashValidator")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.indexer.events.rs b/v4-proto-rs/src/dydxprotocol.indexer.events.rs new file mode 100644 index 0000000000..a613801c76 --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.indexer.events.rs @@ -0,0 +1,1046 @@ +// This file is @generated by prost-build. +/// FundingUpdate is used for funding update events and includes a funding +/// value and an optional funding index that correspond to a perpetual market. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FundingUpdateV1 { + /// The id of the perpetual market. + #[prost(uint32, tag = "1")] + pub perpetual_id: u32, + /// funding value (in parts-per-million) can be premium vote, premium sample, + /// or funding rate. + #[prost(int32, tag = "2")] + pub funding_value_ppm: i32, + /// funding index is required if and only if parent `FundingEvent` type is + /// `TYPE_FUNDING_RATE_AND_INDEX`. + #[prost(bytes = "vec", tag = "3")] + pub funding_index: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for FundingUpdateV1 { + const NAME: &'static str = "FundingUpdateV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.FundingUpdateV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.FundingUpdateV1".into() + } +} +/// FundingEvent message contains a list of per-market funding values. The +/// funding values in the list is of the same type and the types are: which can +/// have one of the following types: +/// 1. Premium vote: votes on the premium values injected by block proposers. +/// 2. Premium sample: combined value from all premium votes during a +/// `funding-sample` epoch. +/// 3. Funding rate and index: final funding rate combining all premium samples +/// during a `funding-tick` epoch and funding index accordingly updated with +/// `funding rate * price`. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FundingEventV1 { + /// updates is a list of per-market funding updates for all existing perpetual + /// markets. The list is sorted by `perpetualId`s which are unique. + #[prost(message, repeated, tag = "1")] + pub updates: ::prost::alloc::vec::Vec, + /// type stores the type of funding updates. + #[prost(enumeration = "funding_event_v1::Type", tag = "2")] + pub r#type: i32, +} +/// Nested message and enum types in `FundingEventV1`. +pub mod funding_event_v1 { + /// Type is the type for funding values. + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum Type { + /// Unspecified type. + Unspecified = 0, + /// Premium sample is the combined value from all premium votes during a + /// `funding-sample` epoch. + PremiumSample = 1, + /// Funding rate is the final funding rate combining all premium samples + /// during a `funding-tick` epoch. + FundingRateAndIndex = 2, + /// TODO(DEC-1513): Investigate whether premium vote values need to be + /// sent to indexer. + PremiumVote = 3, + } + impl Type { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Type::Unspecified => "TYPE_UNSPECIFIED", + Type::PremiumSample => "TYPE_PREMIUM_SAMPLE", + Type::FundingRateAndIndex => "TYPE_FUNDING_RATE_AND_INDEX", + Type::PremiumVote => "TYPE_PREMIUM_VOTE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "TYPE_PREMIUM_SAMPLE" => Some(Self::PremiumSample), + "TYPE_FUNDING_RATE_AND_INDEX" => Some(Self::FundingRateAndIndex), + "TYPE_PREMIUM_VOTE" => Some(Self::PremiumVote), + _ => None, + } + } + } +} +impl ::prost::Name for FundingEventV1 { + const NAME: &'static str = "FundingEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.FundingEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.FundingEventV1".into() + } +} +/// MarketEvent message contains all the information about a market event on +/// the dYdX chain. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketEventV1 { + /// market id. + #[prost(uint32, tag = "1")] + pub market_id: u32, + /// either an event for price update, market creation, or market modification. + #[prost(oneof = "market_event_v1::Event", tags = "2, 3, 4")] + pub event: ::core::option::Option, +} +/// Nested message and enum types in `MarketEventV1`. +pub mod market_event_v1 { + /// either an event for price update, market creation, or market modification. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Event { + #[prost(message, tag = "2")] + PriceUpdate(super::MarketPriceUpdateEventV1), + #[prost(message, tag = "3")] + MarketCreate(super::MarketCreateEventV1), + #[prost(message, tag = "4")] + MarketModify(super::MarketModifyEventV1), + } +} +impl ::prost::Name for MarketEventV1 { + const NAME: &'static str = "MarketEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.MarketEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.MarketEventV1".into() + } +} +/// MarketPriceUpdateEvent message contains all the information about a price +/// update on the dYdX chain. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketPriceUpdateEventV1 { + /// price_with_exponent. Multiply by 10 ^ Exponent to get the human readable + /// price in dollars. For example if `Exponent == -5` then a `exponent_price` + /// of `1,000,000,000` represents “$10,000`. + #[prost(uint64, tag = "1")] + pub price_with_exponent: u64, +} +impl ::prost::Name for MarketPriceUpdateEventV1 { + const NAME: &'static str = "MarketPriceUpdateEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.MarketPriceUpdateEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.MarketPriceUpdateEventV1".into() + } +} +/// shared fields between MarketCreateEvent and MarketModifyEvent +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketBaseEventV1 { + /// String representation of the market pair, e.g. `BTC-USD` + #[prost(string, tag = "1")] + pub pair: ::prost::alloc::string::String, + /// The minimum allowable change in the Price value for a given update. + /// Measured as 1e-6. + #[prost(uint32, tag = "2")] + pub min_price_change_ppm: u32, +} +impl ::prost::Name for MarketBaseEventV1 { + const NAME: &'static str = "MarketBaseEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.MarketBaseEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.MarketBaseEventV1".into() + } +} +/// MarketCreateEvent message contains all the information about a new market on +/// the dYdX chain. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketCreateEventV1 { + #[prost(message, optional, tag = "1")] + pub base: ::core::option::Option, + /// Static value. The exponent of the price. + /// For example if Exponent == -5 then a `exponent_price` of 1,000,000,000 + /// represents $10,000. Therefore 10 ^ Exponent represents the smallest + /// price step (in dollars) that can be recorded. + #[prost(sint32, tag = "2")] + pub exponent: i32, +} +impl ::prost::Name for MarketCreateEventV1 { + const NAME: &'static str = "MarketCreateEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.MarketCreateEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.MarketCreateEventV1".into() + } +} +/// MarketModifyEvent message contains all the information about a market update +/// on the dYdX chain +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketModifyEventV1 { + #[prost(message, optional, tag = "1")] + pub base: ::core::option::Option, +} +impl ::prost::Name for MarketModifyEventV1 { + const NAME: &'static str = "MarketModifyEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.MarketModifyEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.MarketModifyEventV1".into() + } +} +/// SourceOfFunds is the source of funds in a transfer event. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SourceOfFunds { + /// one of below + /// - a subaccount ID + /// - a wallet address + #[prost(oneof = "source_of_funds::Source", tags = "1, 2")] + pub source: ::core::option::Option, +} +/// Nested message and enum types in `SourceOfFunds`. +pub mod source_of_funds { + /// one of below + /// - a subaccount ID + /// - a wallet address + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Source { + #[prost(message, tag = "1")] + SubaccountId(super::super::protocol::v1::IndexerSubaccountId), + #[prost(string, tag = "2")] + Address(::prost::alloc::string::String), + } +} +impl ::prost::Name for SourceOfFunds { + const NAME: &'static str = "SourceOfFunds"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.SourceOfFunds".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.SourceOfFunds".into() + } +} +/// TransferEvent message contains all the information about a transfer, +/// deposit-to-subaccount, or withdraw-from-subaccount on the dYdX chain. +/// When a subaccount is involved, a SubaccountUpdateEvent message will +/// be produced with the updated asset positions. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransferEventV1 { + #[prost(message, optional, tag = "1")] + pub sender_subaccount_id: ::core::option::Option< + super::protocol::v1::IndexerSubaccountId, + >, + #[prost(message, optional, tag = "2")] + pub recipient_subaccount_id: ::core::option::Option< + super::protocol::v1::IndexerSubaccountId, + >, + /// Id of the asset transfered. + #[prost(uint32, tag = "3")] + pub asset_id: u32, + /// The amount of asset in quantums to transfer. + #[prost(uint64, tag = "4")] + pub amount: u64, + /// The sender is one of below + /// - a subaccount ID (in transfer and withdraw events). + /// - a wallet address (in deposit events). + #[prost(message, optional, tag = "5")] + pub sender: ::core::option::Option, + /// The recipient is one of below + /// - a subaccount ID (in transfer and deposit events). + /// - a wallet address (in withdraw events). + #[prost(message, optional, tag = "6")] + pub recipient: ::core::option::Option, +} +impl ::prost::Name for TransferEventV1 { + const NAME: &'static str = "TransferEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.TransferEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.TransferEventV1".into() + } +} +/// OrderFillEvent message contains all the information from an order match in +/// the dYdX chain. This includes the maker/taker orders that matched and the +/// amount filled. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OrderFillEventV1 { + #[prost(message, optional, tag = "1")] + pub maker_order: ::core::option::Option, + /// Fill amount in base quantums. + #[prost(uint64, tag = "3")] + pub fill_amount: u64, + /// Maker fee in USDC quantums. + #[prost(sint64, tag = "5")] + pub maker_fee: i64, + /// Taker fee in USDC quantums. If the taker order is a liquidation, then this + /// represents the special liquidation fee, not the standard taker fee. + #[prost(sint64, tag = "6")] + pub taker_fee: i64, + /// Total filled of the maker order in base quantums. + #[prost(uint64, tag = "7")] + pub total_filled_maker: u64, + /// Total filled of the taker order in base quantums. + #[prost(uint64, tag = "8")] + pub total_filled_taker: u64, + /// The type of order fill this event represents. + #[prost(oneof = "order_fill_event_v1::TakerOrder", tags = "2, 4")] + pub taker_order: ::core::option::Option, +} +/// Nested message and enum types in `OrderFillEventV1`. +pub mod order_fill_event_v1 { + /// The type of order fill this event represents. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum TakerOrder { + #[prost(message, tag = "2")] + Order(super::super::protocol::v1::IndexerOrder), + #[prost(message, tag = "4")] + LiquidationOrder(super::LiquidationOrderV1), + } +} +impl ::prost::Name for OrderFillEventV1 { + const NAME: &'static str = "OrderFillEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.OrderFillEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.OrderFillEventV1".into() + } +} +/// DeleveragingEvent message contains all the information for a deleveraging +/// on the dYdX chain. This includes the liquidated/offsetting subaccounts and +/// the amount filled. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleveragingEventV1 { + /// ID of the subaccount that was liquidated. + #[prost(message, optional, tag = "1")] + pub liquidated: ::core::option::Option, + /// ID of the subaccount that was used to offset the position. + #[prost(message, optional, tag = "2")] + pub offsetting: ::core::option::Option, + /// The ID of the perpetual that was liquidated. + #[prost(uint32, tag = "3")] + pub perpetual_id: u32, + /// The amount filled between the liquidated and offsetting position, in + /// base quantums. + #[prost(uint64, tag = "4")] + pub fill_amount: u64, + /// Total quote quantums filled. + #[prost(uint64, tag = "5")] + pub total_quote_quantums: u64, + /// `true` if liquidating a short position, `false` otherwise. + #[prost(bool, tag = "6")] + pub is_buy: bool, + /// `true` if the deleveraging event is for final settlement, indicating + /// the match occurred at the oracle price rather than bankruptcy price. + /// When this flag is `false`, the fill price is the bankruptcy price + /// of the liquidated subaccount. + #[prost(bool, tag = "7")] + pub is_final_settlement: bool, +} +impl ::prost::Name for DeleveragingEventV1 { + const NAME: &'static str = "DeleveragingEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.DeleveragingEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.DeleveragingEventV1".into() + } +} +/// LiquidationOrder represents the liquidation taker order to be included in a +/// liquidation order fill event. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LiquidationOrderV1 { + /// ID of the subaccount that was liquidated. + #[prost(message, optional, tag = "1")] + pub liquidated: ::core::option::Option, + /// The ID of the clob pair involved in the liquidation. + #[prost(uint32, tag = "2")] + pub clob_pair_id: u32, + /// The ID of the perpetual involved in the liquidation. + #[prost(uint32, tag = "3")] + pub perpetual_id: u32, + /// The total size of the liquidation order including any unfilled size, + /// in base quantums. + #[prost(uint64, tag = "4")] + pub total_size: u64, + /// `true` if liquidating a short position, `false` otherwise. + #[prost(bool, tag = "5")] + pub is_buy: bool, + /// The fillable price in subticks. + /// This represents the lower-price-bound for liquidating longs + /// and the upper-price-bound for liquidating shorts. + /// Must be a multiple of ClobPair.SubticksPerTick + /// (where `ClobPair.Id = orderId.ClobPairId`). + #[prost(uint64, tag = "6")] + pub subticks: u64, +} +impl ::prost::Name for LiquidationOrderV1 { + const NAME: &'static str = "LiquidationOrderV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.LiquidationOrderV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.LiquidationOrderV1".into() + } +} +/// SubaccountUpdateEvent message contains information about an update to a +/// subaccount in the dYdX chain. This includes the list of updated perpetual +/// and asset positions for the subaccount. +/// Note: This event message will contain all the updates to a subaccount +/// at the end of a block which is why multiple asset/perpetual position +/// updates may exist. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubaccountUpdateEventV1 { + #[prost(message, optional, tag = "1")] + pub subaccount_id: ::core::option::Option, + /// updated_perpetual_positions will each be for unique perpetuals. + #[prost(message, repeated, tag = "3")] + pub updated_perpetual_positions: ::prost::alloc::vec::Vec< + super::protocol::v1::IndexerPerpetualPosition, + >, + /// updated_asset_positions will each be for unique assets. + #[prost(message, repeated, tag = "4")] + pub updated_asset_positions: ::prost::alloc::vec::Vec< + super::protocol::v1::IndexerAssetPosition, + >, +} +impl ::prost::Name for SubaccountUpdateEventV1 { + const NAME: &'static str = "SubaccountUpdateEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.SubaccountUpdateEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.SubaccountUpdateEventV1".into() + } +} +/// StatefulOrderEvent message contains information about a change to a stateful +/// order. Currently, this is either the placement of a long-term order, the +/// placement or triggering of a conditional order, or the removal of a +/// stateful order. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StatefulOrderEventV1 { + /// The type of event that this StatefulOrderEvent contains. + #[prost(oneof = "stateful_order_event_v1::Event", tags = "1, 4, 5, 6, 7, 8")] + pub event: ::core::option::Option, +} +/// Nested message and enum types in `StatefulOrderEventV1`. +pub mod stateful_order_event_v1 { + /// A stateful order placement contains an order. + /// Deprecated in favor of LongTermOrderPlacementV1. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct StatefulOrderPlacementV1 { + #[prost(message, optional, tag = "1")] + pub order: ::core::option::Option, + } + impl ::prost::Name for StatefulOrderPlacementV1 { + const NAME: &'static str = "StatefulOrderPlacementV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.StatefulOrderEventV1.StatefulOrderPlacementV1" + .into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.StatefulOrderEventV1.StatefulOrderPlacementV1" + .into() + } + } + /// A stateful order removal contains the id of an order that was already + /// placed and is now removed and the reason for the removal. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct StatefulOrderRemovalV1 { + #[prost(message, optional, tag = "1")] + pub removed_order_id: ::core::option::Option< + super::super::protocol::v1::IndexerOrderId, + >, + #[prost(enumeration = "super::super::shared::OrderRemovalReason", tag = "2")] + pub reason: i32, + } + impl ::prost::Name for StatefulOrderRemovalV1 { + const NAME: &'static str = "StatefulOrderRemovalV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.StatefulOrderEventV1.StatefulOrderRemovalV1" + .into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.StatefulOrderEventV1.StatefulOrderRemovalV1" + .into() + } + } + /// A conditional order placement contains an order. The order is newly-placed + /// and untriggered when this event is emitted. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct ConditionalOrderPlacementV1 { + #[prost(message, optional, tag = "1")] + pub order: ::core::option::Option, + } + impl ::prost::Name for ConditionalOrderPlacementV1 { + const NAME: &'static str = "ConditionalOrderPlacementV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.StatefulOrderEventV1.ConditionalOrderPlacementV1" + .into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.StatefulOrderEventV1.ConditionalOrderPlacementV1" + .into() + } + } + /// A conditional order trigger event contains an order id and is emitted when + /// an order is triggered. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct ConditionalOrderTriggeredV1 { + #[prost(message, optional, tag = "1")] + pub triggered_order_id: ::core::option::Option< + super::super::protocol::v1::IndexerOrderId, + >, + } + impl ::prost::Name for ConditionalOrderTriggeredV1 { + const NAME: &'static str = "ConditionalOrderTriggeredV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.StatefulOrderEventV1.ConditionalOrderTriggeredV1" + .into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.StatefulOrderEventV1.ConditionalOrderTriggeredV1" + .into() + } + } + /// A long term order placement contains an order. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct LongTermOrderPlacementV1 { + #[prost(message, optional, tag = "1")] + pub order: ::core::option::Option, + } + impl ::prost::Name for LongTermOrderPlacementV1 { + const NAME: &'static str = "LongTermOrderPlacementV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.StatefulOrderEventV1.LongTermOrderPlacementV1" + .into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.StatefulOrderEventV1.LongTermOrderPlacementV1" + .into() + } + } + /// A long term order placement contains an order. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct LongTermOrderReplacementV1 { + #[prost(message, optional, tag = "1")] + pub order: ::core::option::Option, + } + impl ::prost::Name for LongTermOrderReplacementV1 { + const NAME: &'static str = "LongTermOrderReplacementV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.StatefulOrderEventV1.LongTermOrderReplacementV1" + .into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.StatefulOrderEventV1.LongTermOrderReplacementV1" + .into() + } + } + /// The type of event that this StatefulOrderEvent contains. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Event { + /// Deprecated in favor of long_term_order_placement + #[prost(message, tag = "1")] + OrderPlace(StatefulOrderPlacementV1), + #[prost(message, tag = "4")] + OrderRemoval(StatefulOrderRemovalV1), + #[prost(message, tag = "5")] + ConditionalOrderPlacement(ConditionalOrderPlacementV1), + #[prost(message, tag = "6")] + ConditionalOrderTriggered(ConditionalOrderTriggeredV1), + #[prost(message, tag = "7")] + LongTermOrderPlacement(LongTermOrderPlacementV1), + #[prost(message, tag = "8")] + OrderReplace(LongTermOrderReplacementV1), + } +} +impl ::prost::Name for StatefulOrderEventV1 { + const NAME: &'static str = "StatefulOrderEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.StatefulOrderEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.StatefulOrderEventV1".into() + } +} +/// AssetCreateEventV1 message contains all the information about an new Asset on +/// the dYdX chain. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AssetCreateEventV1 { + /// Unique, sequentially-generated. + #[prost(uint32, tag = "1")] + pub id: u32, + /// The human readable symbol of the `Asset` (e.g. `USDC`, `ATOM`). + /// Must be uppercase, unique and correspond to the canonical symbol of the + /// full coin. + #[prost(string, tag = "2")] + pub symbol: ::prost::alloc::string::String, + /// `true` if this `Asset` has a valid `MarketId` value. + #[prost(bool, tag = "3")] + pub has_market: bool, + /// The `Id` of the `Market` associated with this `Asset`. It acts as the + /// oracle price for the purposes of calculating collateral + /// and margin requirements. + #[prost(uint32, tag = "4")] + pub market_id: u32, + /// The exponent for converting an atomic amount (1 'quantum') + /// to a full coin. For example, if `atomic_resolution = -8` + /// then an `asset_position` with `base_quantums = 1e8` is equivalent to + /// a position size of one full coin. + #[prost(sint32, tag = "5")] + pub atomic_resolution: i32, +} +impl ::prost::Name for AssetCreateEventV1 { + const NAME: &'static str = "AssetCreateEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.AssetCreateEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.AssetCreateEventV1".into() + } +} +/// PerpetualMarketCreateEventV1 message contains all the information about a +/// new Perpetual Market on the dYdX chain. +/// Deprecated. See PerpetualMarketCreateEventV2 for the most up to date message +/// for the event to create a new Perpetual Market. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PerpetualMarketCreateEventV1 { + /// Unique Perpetual id. + /// Defined in perpetuals.perpetual + #[prost(uint32, tag = "1")] + pub id: u32, + /// Unique clob pair Id associated with this perpetual market + /// Defined in clob.clob_pair + #[prost(uint32, tag = "2")] + pub clob_pair_id: u32, + /// The name of the `Perpetual` (e.g. `BTC-USD`). + /// Defined in perpetuals.perpetual + #[prost(string, tag = "3")] + pub ticker: ::prost::alloc::string::String, + /// Unique id of market param associated with this perpetual market. + /// Defined in perpetuals.perpetual + #[prost(uint32, tag = "4")] + pub market_id: u32, + /// Status of the CLOB + #[prost(enumeration = "super::protocol::v1::ClobPairStatus", tag = "5")] + pub status: i32, + /// `10^Exponent` gives the number of QuoteQuantums traded per BaseQuantum + /// per Subtick. + /// Defined in clob.clob_pair + #[prost(sint32, tag = "6")] + pub quantum_conversion_exponent: i32, + /// The exponent for converting an atomic amount (`size = 1`) + /// to a full coin. For example, if `AtomicResolution = -8` + /// then a `PerpetualPosition` with `size = 1e8` is equivalent to + /// a position size of one full coin. + /// Defined in perpetuals.perpetual + #[prost(sint32, tag = "7")] + pub atomic_resolution: i32, + /// Defines the tick size of the orderbook by defining how many subticks + /// are in one tick. That is, the subticks of any valid order must be a + /// multiple of this value. Generally this value should start `>= 100`to + /// allow room for decreasing it. + /// Defined in clob.clob_pair + #[prost(uint32, tag = "8")] + pub subticks_per_tick: u32, + /// Minimum increment in the size of orders on the CLOB, in base quantums. + /// Defined in clob.clob_pair + #[prost(uint64, tag = "9")] + pub step_base_quantums: u64, + /// The liquidity_tier that this perpetual is associated with. + /// Defined in perpetuals.perpetual + #[prost(uint32, tag = "10")] + pub liquidity_tier: u32, +} +impl ::prost::Name for PerpetualMarketCreateEventV1 { + const NAME: &'static str = "PerpetualMarketCreateEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.PerpetualMarketCreateEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.PerpetualMarketCreateEventV1".into() + } +} +/// PerpetualMarketCreateEventV2 message contains all the information about a +/// new Perpetual Market on the dYdX chain. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PerpetualMarketCreateEventV2 { + /// Unique Perpetual id. + /// Defined in perpetuals.perpetual + #[prost(uint32, tag = "1")] + pub id: u32, + /// Unique clob pair Id associated with this perpetual market + /// Defined in clob.clob_pair + #[prost(uint32, tag = "2")] + pub clob_pair_id: u32, + /// The name of the `Perpetual` (e.g. `BTC-USD`). + /// Defined in perpetuals.perpetual + #[prost(string, tag = "3")] + pub ticker: ::prost::alloc::string::String, + /// Unique id of market param associated with this perpetual market. + /// Defined in perpetuals.perpetual + #[prost(uint32, tag = "4")] + pub market_id: u32, + /// Status of the CLOB + #[prost(enumeration = "super::protocol::v1::ClobPairStatus", tag = "5")] + pub status: i32, + /// `10^Exponent` gives the number of QuoteQuantums traded per BaseQuantum + /// per Subtick. + /// Defined in clob.clob_pair + #[prost(sint32, tag = "6")] + pub quantum_conversion_exponent: i32, + /// The exponent for converting an atomic amount (`size = 1`) + /// to a full coin. For example, if `AtomicResolution = -8` + /// then a `PerpetualPosition` with `size = 1e8` is equivalent to + /// a position size of one full coin. + /// Defined in perpetuals.perpetual + #[prost(sint32, tag = "7")] + pub atomic_resolution: i32, + /// Defines the tick size of the orderbook by defining how many subticks + /// are in one tick. That is, the subticks of any valid order must be a + /// multiple of this value. Generally this value should start `>= 100`to + /// allow room for decreasing it. + /// Defined in clob.clob_pair + #[prost(uint32, tag = "8")] + pub subticks_per_tick: u32, + /// Minimum increment in the size of orders on the CLOB, in base quantums. + /// Defined in clob.clob_pair + #[prost(uint64, tag = "9")] + pub step_base_quantums: u64, + /// The liquidity_tier that this perpetual is associated with. + /// Defined in perpetuals.perpetual + #[prost(uint32, tag = "10")] + pub liquidity_tier: u32, + /// Market type of the perpetual. + #[prost(enumeration = "super::protocol::v1::PerpetualMarketType", tag = "11")] + pub market_type: i32, +} +impl ::prost::Name for PerpetualMarketCreateEventV2 { + const NAME: &'static str = "PerpetualMarketCreateEventV2"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.PerpetualMarketCreateEventV2".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.PerpetualMarketCreateEventV2".into() + } +} +/// LiquidityTierUpsertEventV1 message contains all the information to +/// create/update a Liquidity Tier on the dYdX chain. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LiquidityTierUpsertEventV1 { + /// Unique id. + #[prost(uint32, tag = "1")] + pub id: u32, + /// The name of the tier purely for mnemonic purposes, e.g. "Gold". + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, + /// The margin fraction needed to open a position. + /// In parts-per-million. + #[prost(uint32, tag = "3")] + pub initial_margin_ppm: u32, + /// The fraction of the initial-margin that the maintenance-margin is, + /// e.g. 50%. In parts-per-million. + #[prost(uint32, tag = "4")] + pub maintenance_fraction_ppm: u32, + /// The maximum position size at which the margin requirements are + /// not increased over the default values. Above this position size, + /// the margin requirements increase at a rate of sqrt(size). + /// + /// Deprecated since v3.x. + #[deprecated] + #[prost(uint64, tag = "5")] + pub base_position_notional: u64, +} +impl ::prost::Name for LiquidityTierUpsertEventV1 { + const NAME: &'static str = "LiquidityTierUpsertEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.LiquidityTierUpsertEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.LiquidityTierUpsertEventV1".into() + } +} +/// UpdateClobPairEventV1 message contains all the information about an update to +/// a clob pair on the dYdX chain. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateClobPairEventV1 { + /// Unique clob pair Id associated with this perpetual market + /// Defined in clob.clob_pair + #[prost(uint32, tag = "1")] + pub clob_pair_id: u32, + /// Status of the CLOB + #[prost(enumeration = "super::protocol::v1::ClobPairStatus", tag = "2")] + pub status: i32, + /// `10^Exponent` gives the number of QuoteQuantums traded per BaseQuantum + /// per Subtick. + /// Defined in clob.clob_pair + #[prost(sint32, tag = "3")] + pub quantum_conversion_exponent: i32, + /// Defines the tick size of the orderbook by defining how many subticks + /// are in one tick. That is, the subticks of any valid order must be a + /// multiple of this value. Generally this value should start `>= 100`to + /// allow room for decreasing it. + /// Defined in clob.clob_pair + #[prost(uint32, tag = "4")] + pub subticks_per_tick: u32, + /// Minimum increment in the size of orders on the CLOB, in base quantums. + /// Defined in clob.clob_pair + #[prost(uint64, tag = "5")] + pub step_base_quantums: u64, +} +impl ::prost::Name for UpdateClobPairEventV1 { + const NAME: &'static str = "UpdateClobPairEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.UpdateClobPairEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.UpdateClobPairEventV1".into() + } +} +/// UpdatePerpetualEventV1 message contains all the information about an update +/// to a perpetual on the dYdX chain. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdatePerpetualEventV1 { + /// Unique Perpetual id. + /// Defined in perpetuals.perpetual + #[prost(uint32, tag = "1")] + pub id: u32, + /// The name of the `Perpetual` (e.g. `BTC-USD`). + /// Defined in perpetuals.perpetual + #[prost(string, tag = "2")] + pub ticker: ::prost::alloc::string::String, + /// Unique id of market param associated with this perpetual market. + /// Defined in perpetuals.perpetual + #[prost(uint32, tag = "3")] + pub market_id: u32, + /// The exponent for converting an atomic amount (`size = 1`) + /// to a full coin. For example, if `AtomicResolution = -8` + /// then a `PerpetualPosition` with `size = 1e8` is equivalent to + /// a position size of one full coin. + /// Defined in perpetuals.perpetual + #[prost(sint32, tag = "4")] + pub atomic_resolution: i32, + /// The liquidity_tier that this perpetual is associated with. + /// Defined in perpetuals.perpetual + #[prost(uint32, tag = "5")] + pub liquidity_tier: u32, +} +impl ::prost::Name for UpdatePerpetualEventV1 { + const NAME: &'static str = "UpdatePerpetualEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.UpdatePerpetualEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.UpdatePerpetualEventV1".into() + } +} +/// TradingRewardsEventV1 is communicates all trading rewards for all accounts +/// that receive trade rewards in the block. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TradingRewardsEventV1 { + /// The list of all trading rewards in the block. + #[prost(message, repeated, tag = "1")] + pub trading_rewards: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for TradingRewardsEventV1 { + const NAME: &'static str = "TradingRewardsEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.TradingRewardsEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.TradingRewardsEventV1".into() + } +} +/// AddressTradingReward contains info on an instance of an address receiving a +/// reward +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AddressTradingReward { + /// The address of the wallet that will receive the trading reward. + #[prost(string, tag = "1")] + pub owner: ::prost::alloc::string::String, + /// The amount of trading rewards earned by the address above in denoms. 1e18 + /// denoms is equivalent to a single coin. + #[prost(bytes = "vec", tag = "2")] + pub denom_amount: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for AddressTradingReward { + const NAME: &'static str = "AddressTradingReward"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.AddressTradingReward".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.AddressTradingReward".into() + } +} +/// OpenInterestUpdateEventV1 is used for open interest update events +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenInterestUpdateEventV1 { + /// The list of all open interest updates in the block. + #[prost(message, repeated, tag = "1")] + pub open_interest_updates: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for OpenInterestUpdateEventV1 { + const NAME: &'static str = "OpenInterestUpdateEventV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.OpenInterestUpdateEventV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.OpenInterestUpdateEventV1".into() + } +} +/// OpenInterestUpdate contains a single open interest update for a perpetual +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenInterestUpdate { + /// The ID of the perpetual market. + #[prost(uint32, tag = "1")] + pub perpetual_id: u32, + /// The new open interest value for the perpetual market. + #[prost(bytes = "vec", tag = "2")] + pub open_interest: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for OpenInterestUpdate { + const NAME: &'static str = "OpenInterestUpdate"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.OpenInterestUpdate".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.OpenInterestUpdate".into() + } +} +/// LiquidationEventV2 message contains all the information needed to update +/// the liquidity tiers. It contains all the fields from V1 along with the +/// open interest caps. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LiquidityTierUpsertEventV2 { + /// Unique id. + #[prost(uint32, tag = "1")] + pub id: u32, + /// The name of the tier purely for mnemonic purposes, e.g. "Gold". + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, + /// The margin fraction needed to open a position. + /// In parts-per-million. + #[prost(uint32, tag = "3")] + pub initial_margin_ppm: u32, + /// The fraction of the initial-margin that the maintenance-margin is, + /// e.g. 50%. In parts-per-million. + #[prost(uint32, tag = "4")] + pub maintenance_fraction_ppm: u32, + /// The maximum position size at which the margin requirements are + /// not increased over the default values. Above this position size, + /// the margin requirements increase at a rate of sqrt(size). + /// + /// Deprecated since v3.x. + #[deprecated] + #[prost(uint64, tag = "5")] + pub base_position_notional: u64, + /// Lower cap of open interest in quote quantums. optional + #[prost(uint64, tag = "6")] + pub open_interest_lower_cap: u64, + /// Upper cap of open interest in quote quantums. + #[prost(uint64, tag = "7")] + pub open_interest_upper_cap: u64, +} +impl ::prost::Name for LiquidityTierUpsertEventV2 { + const NAME: &'static str = "LiquidityTierUpsertEventV2"; + const PACKAGE: &'static str = "dydxprotocol.indexer.events"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.events.LiquidityTierUpsertEventV2".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.events.LiquidityTierUpsertEventV2".into() + } +} diff --git a/v4-proto-rs/src/dydxprotocol.indexer.indexer_manager.rs b/v4-proto-rs/src/dydxprotocol.indexer.indexer_manager.rs new file mode 100644 index 0000000000..4403e6bb5e --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.indexer.indexer_manager.rs @@ -0,0 +1,162 @@ +// This file is @generated by prost-build. +/// IndexerTendermintEventWrapper is a wrapper around IndexerTendermintEvent, +/// with an additional txn_hash field. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IndexerTendermintEventWrapper { + #[prost(message, optional, tag = "1")] + pub event: ::core::option::Option, + #[prost(string, tag = "2")] + pub txn_hash: ::prost::alloc::string::String, +} +impl ::prost::Name for IndexerTendermintEventWrapper { + const NAME: &'static str = "IndexerTendermintEventWrapper"; + const PACKAGE: &'static str = "dydxprotocol.indexer.indexer_manager"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.indexer_manager.IndexerTendermintEventWrapper".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.indexer_manager.IndexerTendermintEventWrapper".into() + } +} +/// IndexerEventsStoreValue represents the type of the value of the +/// `IndexerEventsStore` in state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IndexerEventsStoreValue { + #[prost(message, repeated, tag = "1")] + pub events: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for IndexerEventsStoreValue { + const NAME: &'static str = "IndexerEventsStoreValue"; + const PACKAGE: &'static str = "dydxprotocol.indexer.indexer_manager"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.indexer_manager.IndexerEventsStoreValue".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.indexer_manager.IndexerEventsStoreValue".into() + } +} +/// IndexerTendermintEvent contains the base64 encoded event proto emitted from +/// the dYdX application as well as additional metadata to determine the ordering +/// of the event within the block and the subtype of the event. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IndexerTendermintEvent { + /// Subtype of the event e.g. "order_fill", "subaccount_update", etc. + #[prost(string, tag = "1")] + pub subtype: ::prost::alloc::string::String, + /// Index of the event within the list of events that happened either during a + /// transaction or during processing of a block. + /// TODO(DEC-537): Deprecate this field because events are already ordered. + #[prost(uint32, tag = "5")] + pub event_index: u32, + /// Version of the event. + #[prost(uint32, tag = "6")] + pub version: u32, + /// Tendermint event bytes. + #[prost(bytes = "vec", tag = "7")] + pub data_bytes: ::prost::alloc::vec::Vec, + /// ordering_within_block is either the transaction index or a boolean + /// indicating the event was generated during processing the block rather than + /// any specific transaction e.g. during FinalizeBlock. + #[prost(oneof = "indexer_tendermint_event::OrderingWithinBlock", tags = "3, 4")] + pub ordering_within_block: ::core::option::Option< + indexer_tendermint_event::OrderingWithinBlock, + >, +} +/// Nested message and enum types in `IndexerTendermintEvent`. +pub mod indexer_tendermint_event { + /// enum to specify that the IndexerTendermintEvent is a block event. + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum BlockEvent { + /// Default value. This value is invalid and unused. + Unspecified = 0, + /// BLOCK_EVENT_BEGIN_BLOCK indicates that the event was generated during + /// BeginBlock. + BeginBlock = 1, + /// BLOCK_EVENT_END_BLOCK indicates that the event was generated during + /// EndBlock. + EndBlock = 2, + } + impl BlockEvent { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + BlockEvent::Unspecified => "BLOCK_EVENT_UNSPECIFIED", + BlockEvent::BeginBlock => "BLOCK_EVENT_BEGIN_BLOCK", + BlockEvent::EndBlock => "BLOCK_EVENT_END_BLOCK", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "BLOCK_EVENT_UNSPECIFIED" => Some(Self::Unspecified), + "BLOCK_EVENT_BEGIN_BLOCK" => Some(Self::BeginBlock), + "BLOCK_EVENT_END_BLOCK" => Some(Self::EndBlock), + _ => None, + } + } + } + /// ordering_within_block is either the transaction index or a boolean + /// indicating the event was generated during processing the block rather than + /// any specific transaction e.g. during FinalizeBlock. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum OrderingWithinBlock { + #[prost(uint32, tag = "3")] + TransactionIndex(u32), + #[prost(enumeration = "BlockEvent", tag = "4")] + BlockEvent(i32), + } +} +impl ::prost::Name for IndexerTendermintEvent { + const NAME: &'static str = "IndexerTendermintEvent"; + const PACKAGE: &'static str = "dydxprotocol.indexer.indexer_manager"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.indexer_manager.IndexerTendermintEvent".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.indexer_manager.IndexerTendermintEvent".into() + } +} +/// IndexerTendermintBlock contains all the events for the block along with +/// metadata for the block height, timestamp of the block and a list of all the +/// hashes of the transactions within the block. The transaction hashes follow +/// the ordering of the transactions as they appear within the block. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IndexerTendermintBlock { + #[prost(uint32, tag = "1")] + pub height: u32, + #[prost(message, optional, tag = "2")] + pub time: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, repeated, tag = "3")] + pub events: ::prost::alloc::vec::Vec, + #[prost(string, repeated, tag = "4")] + pub tx_hashes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +impl ::prost::Name for IndexerTendermintBlock { + const NAME: &'static str = "IndexerTendermintBlock"; + const PACKAGE: &'static str = "dydxprotocol.indexer.indexer_manager"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.indexer_manager.IndexerTendermintBlock".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.indexer_manager.IndexerTendermintBlock".into() + } +} diff --git a/v4-proto-rs/src/dydxprotocol.indexer.off_chain_updates.rs b/v4-proto-rs/src/dydxprotocol.indexer.off_chain_updates.rs new file mode 100644 index 0000000000..56dd4cda0a --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.indexer.off_chain_updates.rs @@ -0,0 +1,256 @@ +// This file is @generated by prost-build. +/// OrderPlace messages contain the order placed/replaced. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OrderPlaceV1 { + #[prost(message, optional, tag = "1")] + pub order: ::core::option::Option, + #[prost(enumeration = "order_place_v1::OrderPlacementStatus", tag = "2")] + pub placement_status: i32, + /// The timestamp of the order placement. + #[prost(message, optional, tag = "3")] + pub time_stamp: ::core::option::Option<::prost_types::Timestamp>, +} +/// Nested message and enum types in `OrderPlaceV1`. +pub mod order_place_v1 { + /// OrderPlacementStatus is an enum for the resulting status after an order is + /// placed. + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum OrderPlacementStatus { + /// Default value, this is invalid and unused. + Unspecified = 0, + /// A best effort opened order is one that has only been confirmed to be + /// placed on the dYdX node sending the off-chain update message. + /// The cases where this happens includes: + /// - The dYdX node places an order in it's in-memory orderbook during the + /// CheckTx flow. + /// A best effort placed order may not have been placed on other dYdX + /// nodes including other dYdX validator nodes and may still be excluded in + /// future order matches. + BestEffortOpened = 1, + /// An opened order is one that is confirmed to be placed on all dYdX nodes + /// (discounting dishonest dYdX nodes) and will be included in any future + /// order matches. + /// This status is used internally by the indexer and will not be sent + /// out by protocol. + Opened = 2, + } + impl OrderPlacementStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + OrderPlacementStatus::Unspecified => "ORDER_PLACEMENT_STATUS_UNSPECIFIED", + OrderPlacementStatus::BestEffortOpened => { + "ORDER_PLACEMENT_STATUS_BEST_EFFORT_OPENED" + } + OrderPlacementStatus::Opened => "ORDER_PLACEMENT_STATUS_OPENED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ORDER_PLACEMENT_STATUS_UNSPECIFIED" => Some(Self::Unspecified), + "ORDER_PLACEMENT_STATUS_BEST_EFFORT_OPENED" => { + Some(Self::BestEffortOpened) + } + "ORDER_PLACEMENT_STATUS_OPENED" => Some(Self::Opened), + _ => None, + } + } + } +} +impl ::prost::Name for OrderPlaceV1 { + const NAME: &'static str = "OrderPlaceV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.off_chain_updates"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.off_chain_updates.OrderPlaceV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.off_chain_updates.OrderPlaceV1".into() + } +} +/// OrderRemove messages contain the id of the order removed, the reason for the +/// removal and the resulting status from the removal. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OrderRemoveV1 { + #[prost(message, optional, tag = "1")] + pub removed_order_id: ::core::option::Option, + #[prost(enumeration = "super::shared::OrderRemovalReason", tag = "2")] + pub reason: i32, + #[prost(enumeration = "order_remove_v1::OrderRemovalStatus", tag = "3")] + pub removal_status: i32, + /// The timestamp of the order removal. + #[prost(message, optional, tag = "4")] + pub time_stamp: ::core::option::Option<::prost_types::Timestamp>, +} +/// Nested message and enum types in `OrderRemoveV1`. +pub mod order_remove_v1 { + /// OrderRemovalStatus is an enum for the resulting status after an order is + /// removed. + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum OrderRemovalStatus { + /// Default value, this is invalid and unused. + Unspecified = 0, + /// A best effort canceled order is one that has only been confirmed to be + /// removed on the dYdX node sending the off-chain update message. + /// The cases where this happens includes: + /// - the order was removed due to the dYdX node receiving a CancelOrder + /// transaction for the order. + /// - the order was removed due to being undercollateralized during + /// optimistic matching. + /// A best effort canceled order may not have been removed on other dYdX + /// nodes including other dYdX validator nodes and may still be included in + /// future order matches. + BestEffortCanceled = 1, + /// A canceled order is one that is confirmed to be removed on all dYdX nodes + /// (discounting dishonest dYdX nodes) and will not be included in any future + /// order matches. + /// The cases where this happens includes: + /// - the order is expired. + Canceled = 2, + /// An order was fully-filled. Only sent by the Indexer for stateful orders. + Filled = 3, + } + impl OrderRemovalStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + OrderRemovalStatus::Unspecified => "ORDER_REMOVAL_STATUS_UNSPECIFIED", + OrderRemovalStatus::BestEffortCanceled => { + "ORDER_REMOVAL_STATUS_BEST_EFFORT_CANCELED" + } + OrderRemovalStatus::Canceled => "ORDER_REMOVAL_STATUS_CANCELED", + OrderRemovalStatus::Filled => "ORDER_REMOVAL_STATUS_FILLED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ORDER_REMOVAL_STATUS_UNSPECIFIED" => Some(Self::Unspecified), + "ORDER_REMOVAL_STATUS_BEST_EFFORT_CANCELED" => { + Some(Self::BestEffortCanceled) + } + "ORDER_REMOVAL_STATUS_CANCELED" => Some(Self::Canceled), + "ORDER_REMOVAL_STATUS_FILLED" => Some(Self::Filled), + _ => None, + } + } + } +} +impl ::prost::Name for OrderRemoveV1 { + const NAME: &'static str = "OrderRemoveV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.off_chain_updates"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.off_chain_updates.OrderRemoveV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.off_chain_updates.OrderRemoveV1".into() + } +} +/// OrderUpdate messages contain the id of the order being updated, and the +/// updated total filled quantums of the order. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OrderUpdateV1 { + #[prost(message, optional, tag = "1")] + pub order_id: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub total_filled_quantums: u64, +} +impl ::prost::Name for OrderUpdateV1 { + const NAME: &'static str = "OrderUpdateV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.off_chain_updates"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.off_chain_updates.OrderUpdateV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.off_chain_updates.OrderUpdateV1".into() + } +} +/// OrderReplace messages contain the replacement order. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OrderReplaceV1 { + #[prost(message, optional, tag = "1")] + pub order: ::core::option::Option, + #[prost(enumeration = "order_place_v1::OrderPlacementStatus", tag = "2")] + pub placement_status: i32, + #[prost(message, optional, tag = "3")] + pub time_stamp: ::core::option::Option<::prost_types::Timestamp>, +} +impl ::prost::Name for OrderReplaceV1 { + const NAME: &'static str = "OrderReplaceV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.off_chain_updates"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.off_chain_updates.OrderReplaceV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.off_chain_updates.OrderReplaceV1".into() + } +} +/// An OffChainUpdate message is the message type which will be sent on Kafka to +/// the Indexer. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OffChainUpdateV1 { + /// Contains one of an OrderPlaceV1, OrderRemoveV1, OrderUpdateV1, and + /// OrderReplaceV1 message. + #[prost(oneof = "off_chain_update_v1::UpdateMessage", tags = "1, 2, 3, 4")] + pub update_message: ::core::option::Option, +} +/// Nested message and enum types in `OffChainUpdateV1`. +pub mod off_chain_update_v1 { + /// Contains one of an OrderPlaceV1, OrderRemoveV1, OrderUpdateV1, and + /// OrderReplaceV1 message. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum UpdateMessage { + #[prost(message, tag = "1")] + OrderPlace(super::OrderPlaceV1), + #[prost(message, tag = "2")] + OrderRemove(super::OrderRemoveV1), + #[prost(message, tag = "3")] + OrderUpdate(super::OrderUpdateV1), + #[prost(message, tag = "4")] + OrderReplace(super::OrderReplaceV1), + } +} +impl ::prost::Name for OffChainUpdateV1 { + const NAME: &'static str = "OffChainUpdateV1"; + const PACKAGE: &'static str = "dydxprotocol.indexer.off_chain_updates"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.off_chain_updates.OffChainUpdateV1".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.off_chain_updates.OffChainUpdateV1".into() + } +} diff --git a/v4-proto-rs/src/dydxprotocol.indexer.protocol.v1.rs b/v4-proto-rs/src/dydxprotocol.indexer.protocol.v1.rs new file mode 100644 index 0000000000..b25016f4af --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.indexer.protocol.v1.rs @@ -0,0 +1,450 @@ +// This file is @generated by prost-build. +/// IndexerSubaccountId defines a unique identifier for a Subaccount. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IndexerSubaccountId { + /// The address of the wallet that owns this subaccount. + #[prost(string, tag = "1")] + pub owner: ::prost::alloc::string::String, + /// < 128 Since 128 should be enough to start and it fits within + /// 1 Byte (1 Bit needed to indicate that the first byte is the last). + #[prost(uint32, tag = "2")] + pub number: u32, +} +impl ::prost::Name for IndexerSubaccountId { + const NAME: &'static str = "IndexerSubaccountId"; + const PACKAGE: &'static str = "dydxprotocol.indexer.protocol.v1"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.protocol.v1.IndexerSubaccountId".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.protocol.v1.IndexerSubaccountId".into() + } +} +/// IndexerPerpetualPosition are an account’s positions of a `Perpetual`. +/// Therefore they hold any information needed to trade perpetuals. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IndexerPerpetualPosition { + /// The `Id` of the `Perpetual`. + #[prost(uint32, tag = "1")] + pub perpetual_id: u32, + /// The size of the position in base quantums. + #[prost(bytes = "vec", tag = "2")] + pub quantums: ::prost::alloc::vec::Vec, + /// The funding_index of the `Perpetual` the last time this position was + /// settled. + #[prost(bytes = "vec", tag = "3")] + pub funding_index: ::prost::alloc::vec::Vec, + /// Amount of funding payment (in quote quantums). + /// Note: 1. this field is not cumulative. + /// 2. a positive value means funding payment was paid out and + /// a negative value means funding payment was received. + #[prost(bytes = "vec", tag = "4")] + pub funding_payment: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for IndexerPerpetualPosition { + const NAME: &'static str = "IndexerPerpetualPosition"; + const PACKAGE: &'static str = "dydxprotocol.indexer.protocol.v1"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.protocol.v1.IndexerPerpetualPosition".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.protocol.v1.IndexerPerpetualPosition".into() + } +} +/// IndexerAssetPosition define an account’s positions of an `Asset`. +/// Therefore they hold any information needed to trade on Spot and Margin. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IndexerAssetPosition { + /// The `Id` of the `Asset`. + #[prost(uint32, tag = "1")] + pub asset_id: u32, + /// The absolute size of the position in base quantums. + #[prost(bytes = "vec", tag = "2")] + pub quantums: ::prost::alloc::vec::Vec, + /// The `Index` (either `LongIndex` or `ShortIndex`) of the `Asset` the last + /// time this position was settled + /// TODO(DEC-582): pending margin trading being added. + #[prost(uint64, tag = "3")] + pub index: u64, +} +impl ::prost::Name for IndexerAssetPosition { + const NAME: &'static str = "IndexerAssetPosition"; + const PACKAGE: &'static str = "dydxprotocol.indexer.protocol.v1"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.protocol.v1.IndexerAssetPosition".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.protocol.v1.IndexerAssetPosition".into() + } +} +/// IndexerOrderId refers to a single order belonging to a Subaccount. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IndexerOrderId { + /// The subaccount ID that opened this order. + /// Note that this field has `gogoproto.nullable = false` so that it is + /// generated as a value instead of a pointer. This is because the `OrderId` + /// proto is used as a key within maps, and map comparisons will compare + /// pointers for equality (when the desired behavior is to compare the values). + #[prost(message, optional, tag = "1")] + pub subaccount_id: ::core::option::Option, + /// The client ID of this order, unique with respect to the specific + /// sub account (I.E., the same subaccount can't have two orders with + /// the same ClientId). + #[prost(fixed32, tag = "2")] + pub client_id: u32, + /// order_flags represent order flags for the order. This field is invalid if + /// it's greater than 127 (larger than one byte). Each bit in the first byte + /// represents a different flag. Currently only two flags are supported. + /// + /// Starting from the bit after the most MSB (note that the MSB is used in + /// proto varint encoding, and therefore cannot be used): Bit 1 is set if this + /// order is a Long-Term order (0x40, or 64 as a uint8). Bit 2 is set if this + /// order is a Conditional order (0x20, or 32 as a uint8). + /// + /// If neither bit is set, the order is assumed to be a Short-Term order. + /// + /// If both bits are set or bits other than the 2nd and 3rd are set, the order + /// ID is invalid. + #[prost(uint32, tag = "3")] + pub order_flags: u32, + /// ID of the CLOB the order is created for. + #[prost(uint32, tag = "4")] + pub clob_pair_id: u32, +} +impl ::prost::Name for IndexerOrderId { + const NAME: &'static str = "IndexerOrderId"; + const PACKAGE: &'static str = "dydxprotocol.indexer.protocol.v1"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.protocol.v1.IndexerOrderId".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.protocol.v1.IndexerOrderId".into() + } +} +/// IndexerOrderV1 represents a single order belonging to a `Subaccount` +/// for a particular `ClobPair`. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IndexerOrder { + /// The unique ID of this order. Meant to be unique across all orders. + #[prost(message, optional, tag = "1")] + pub order_id: ::core::option::Option, + #[prost(enumeration = "indexer_order::Side", tag = "2")] + pub side: i32, + /// The size of this order in base quantums. Must be a multiple of + /// `ClobPair.StepBaseQuantums` (where `ClobPair.Id = orderId.ClobPairId`). + #[prost(uint64, tag = "3")] + pub quantums: u64, + /// The price level that this order will be placed at on the orderbook, + /// in subticks. Must be a multiple of ClobPair.SubticksPerTick + /// (where `ClobPair.Id = orderId.ClobPairId`). + #[prost(uint64, tag = "4")] + pub subticks: u64, + /// The time in force of this order. + #[prost(enumeration = "indexer_order::TimeInForce", tag = "7")] + pub time_in_force: i32, + /// Enforces that the order can only reduce the size of an existing position. + /// If a ReduceOnly order would change the side of the existing position, + /// its size is reduced to that of the remaining size of the position. + /// If existing orders on the book with ReduceOnly + /// would already close the position, the least aggressive (out-of-the-money) + /// ReduceOnly orders are resized and canceled first. + #[prost(bool, tag = "8")] + pub reduce_only: bool, + /// Set of bit flags set arbitrarily by clients and ignored by the protocol. + /// Used by indexer to infer information about a placed order. + #[prost(uint32, tag = "9")] + pub client_metadata: u32, + #[prost(enumeration = "indexer_order::ConditionType", tag = "10")] + pub condition_type: i32, + /// conditional_order_trigger_subticks represents the price at which this order + /// will be triggered. If the condition_type is CONDITION_TYPE_UNSPECIFIED, + /// this value is enforced to be 0. If this value is nonzero, condition_type + /// cannot be CONDITION_TYPE_UNSPECIFIED. Value is in subticks. + /// Must be a multiple of ClobPair.SubticksPerTick (where `ClobPair.Id = + /// orderId.ClobPairId`). + #[prost(uint64, tag = "11")] + pub conditional_order_trigger_subticks: u64, + /// Information about when the order expires. + #[prost(oneof = "indexer_order::GoodTilOneof", tags = "5, 6")] + pub good_til_oneof: ::core::option::Option, +} +/// Nested message and enum types in `IndexerOrder`. +pub mod indexer_order { + /// Represents the side of the orderbook the order will be placed on. + /// Note that Side.SIDE_UNSPECIFIED is an invalid order and cannot be + /// placed on the orderbook. + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum Side { + /// Default value. This value is invalid and unused. + Unspecified = 0, + /// SIDE_BUY is used to represent a BUY order. + Buy = 1, + /// SIDE_SELL is used to represent a SELL order. + Sell = 2, + } + impl Side { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Side::Unspecified => "SIDE_UNSPECIFIED", + Side::Buy => "SIDE_BUY", + Side::Sell => "SIDE_SELL", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SIDE_UNSPECIFIED" => Some(Self::Unspecified), + "SIDE_BUY" => Some(Self::Buy), + "SIDE_SELL" => Some(Self::Sell), + _ => None, + } + } + } + /// TimeInForce indicates how long an order will remain active before it + /// is executed or expires. + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum TimeInForce { + /// TIME_IN_FORCE_UNSPECIFIED represents the default behavior where an + /// order will first match with existing orders on the book, and any + /// remaining size will be added to the book as a maker order. + Unspecified = 0, + /// TIME_IN_FORCE_IOC enforces that an order only be matched with + /// maker orders on the book. If the order has remaining size after + /// matching with existing orders on the book, the remaining size + /// is not placed on the book. + Ioc = 1, + /// TIME_IN_FORCE_POST_ONLY enforces that an order only be placed + /// on the book as a maker order. Note this means that validators will cancel + /// any newly-placed post only orders that would cross with other maker + /// orders. + PostOnly = 2, + /// TIME_IN_FORCE_FILL_OR_KILL enforces that an order will either be filled + /// completely and immediately by maker orders on the book or canceled if the + /// entire amount can‘t be matched. + FillOrKill = 3, + } + impl TimeInForce { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + TimeInForce::Unspecified => "TIME_IN_FORCE_UNSPECIFIED", + TimeInForce::Ioc => "TIME_IN_FORCE_IOC", + TimeInForce::PostOnly => "TIME_IN_FORCE_POST_ONLY", + TimeInForce::FillOrKill => "TIME_IN_FORCE_FILL_OR_KILL", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "TIME_IN_FORCE_UNSPECIFIED" => Some(Self::Unspecified), + "TIME_IN_FORCE_IOC" => Some(Self::Ioc), + "TIME_IN_FORCE_POST_ONLY" => Some(Self::PostOnly), + "TIME_IN_FORCE_FILL_OR_KILL" => Some(Self::FillOrKill), + _ => None, + } + } + } + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum ConditionType { + /// CONDITION_TYPE_UNSPECIFIED represents the default behavior where an + /// order will be placed immediately on the orderbook. + Unspecified = 0, + /// CONDITION_TYPE_STOP_LOSS represents a stop order. A stop order will + /// trigger when the oracle price moves at or above the trigger price for + /// buys, and at or below the trigger price for sells. + StopLoss = 1, + /// CONDITION_TYPE_TAKE_PROFIT represents a take profit order. A take profit + /// order will trigger when the oracle price moves at or below the trigger + /// price for buys and at or above the trigger price for sells. + TakeProfit = 2, + } + impl ConditionType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ConditionType::Unspecified => "CONDITION_TYPE_UNSPECIFIED", + ConditionType::StopLoss => "CONDITION_TYPE_STOP_LOSS", + ConditionType::TakeProfit => "CONDITION_TYPE_TAKE_PROFIT", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "CONDITION_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "CONDITION_TYPE_STOP_LOSS" => Some(Self::StopLoss), + "CONDITION_TYPE_TAKE_PROFIT" => Some(Self::TakeProfit), + _ => None, + } + } + } + /// Information about when the order expires. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum GoodTilOneof { + /// The last block this order can be executed at (after which it will be + /// unfillable). Used only for Short-Term orders. If this value is non-zero + /// then the order is assumed to be a Short-Term order. + #[prost(uint32, tag = "5")] + GoodTilBlock(u32), + /// good_til_block_time represents the unix timestamp (in seconds) at which a + /// stateful order will be considered expired. The + /// good_til_block_time is always evaluated against the previous block's + /// `BlockTime` instead of the block in which the order is committed. If this + /// value is non-zero then the order is assumed to be a stateful or + /// conditional order. + #[prost(fixed32, tag = "6")] + GoodTilBlockTime(u32), + } +} +impl ::prost::Name for IndexerOrder { + const NAME: &'static str = "IndexerOrder"; + const PACKAGE: &'static str = "dydxprotocol.indexer.protocol.v1"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.protocol.v1.IndexerOrder".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.protocol.v1.IndexerOrder".into() + } +} +/// Status of the CLOB. +/// Defined in clob.clob_pair +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ClobPairStatus { + /// Default value. This value is invalid and unused. + Unspecified = 0, + /// CLOB_PAIR_STATUS_ACTIVE behavior is unfinalized. + /// TODO(DEC-600): update this documentation. + Active = 1, + /// CLOB_PAIR_STATUS_PAUSED behavior is unfinalized. + /// TODO(DEC-600): update this documentation. + Paused = 2, + /// CLOB_PAIR_STATUS_CANCEL_ONLY behavior is unfinalized. + /// TODO(DEC-600): update this documentation. + CancelOnly = 3, + /// CLOB_PAIR_STATUS_POST_ONLY behavior is unfinalized. + /// TODO(DEC-600): update this documentation. + PostOnly = 4, + /// CLOB_PAIR_STATUS_INITIALIZING represents a newly-added clob pair. + /// Clob pairs in this state only accept orders which are + /// both short-term and post-only. + Initializing = 5, + /// CLOB_PAIR_STATUS_FINAL_SETTLEMENT represents a clob pair that has been + /// deactivated. Clob pairs in this state do not accept new orders and trading + /// is blocked. All open positions are closed and open stateful orders canceled + /// by the protocol when the clob pair transitions to this status. All + /// short-term orders are left to expire. + FinalSettlement = 6, +} +impl ClobPairStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ClobPairStatus::Unspecified => "CLOB_PAIR_STATUS_UNSPECIFIED", + ClobPairStatus::Active => "CLOB_PAIR_STATUS_ACTIVE", + ClobPairStatus::Paused => "CLOB_PAIR_STATUS_PAUSED", + ClobPairStatus::CancelOnly => "CLOB_PAIR_STATUS_CANCEL_ONLY", + ClobPairStatus::PostOnly => "CLOB_PAIR_STATUS_POST_ONLY", + ClobPairStatus::Initializing => "CLOB_PAIR_STATUS_INITIALIZING", + ClobPairStatus::FinalSettlement => "CLOB_PAIR_STATUS_FINAL_SETTLEMENT", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "CLOB_PAIR_STATUS_UNSPECIFIED" => Some(Self::Unspecified), + "CLOB_PAIR_STATUS_ACTIVE" => Some(Self::Active), + "CLOB_PAIR_STATUS_PAUSED" => Some(Self::Paused), + "CLOB_PAIR_STATUS_CANCEL_ONLY" => Some(Self::CancelOnly), + "CLOB_PAIR_STATUS_POST_ONLY" => Some(Self::PostOnly), + "CLOB_PAIR_STATUS_INITIALIZING" => Some(Self::Initializing), + "CLOB_PAIR_STATUS_FINAL_SETTLEMENT" => Some(Self::FinalSettlement), + _ => None, + } + } +} +/// Market type of perpetual. +/// Defined in perpetual. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum PerpetualMarketType { + /// Unspecified market type. + Unspecified = 0, + /// Market type for cross margin perpetual markets. + Cross = 1, + /// Market type for isolated margin perpetual markets. + Isolated = 2, +} +impl PerpetualMarketType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + PerpetualMarketType::Unspecified => "PERPETUAL_MARKET_TYPE_UNSPECIFIED", + PerpetualMarketType::Cross => "PERPETUAL_MARKET_TYPE_CROSS", + PerpetualMarketType::Isolated => "PERPETUAL_MARKET_TYPE_ISOLATED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "PERPETUAL_MARKET_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "PERPETUAL_MARKET_TYPE_CROSS" => Some(Self::Cross), + "PERPETUAL_MARKET_TYPE_ISOLATED" => Some(Self::Isolated), + _ => None, + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.indexer.redis.rs b/v4-proto-rs/src/dydxprotocol.indexer.redis.rs new file mode 100644 index 0000000000..bdb1bdccc3 --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.indexer.redis.rs @@ -0,0 +1,83 @@ +// This file is @generated by prost-build. +/// RedisOrder is a proto for orders stored in Redis. This proto holds some +/// human-readable values such as price, size and ticker as well as the original +/// `Order` proto from the dYdX application. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RedisOrder { + /// uuid of the Order generated by the Indexer based on the `OrderId`. + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Order proto from the protocol. + #[prost(message, optional, tag = "2")] + pub order: ::core::option::Option, + /// Ticker for the exchange pair for the order. + #[prost(string, tag = "3")] + pub ticker: ::prost::alloc::string::String, + /// Type of the ticker, PERPETUAL or SPOT. + #[prost(enumeration = "redis_order::TickerType", tag = "4")] + pub ticker_type: i32, + /// Human-readable price of the order. + #[prost(string, tag = "5")] + pub price: ::prost::alloc::string::String, + /// Human-readable size of the order. + #[prost(string, tag = "6")] + pub size: ::prost::alloc::string::String, +} +/// Nested message and enum types in `RedisOrder`. +pub mod redis_order { + /// Enum for the ticker type, PERPETUAL or SPOT. + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum TickerType { + /// Default value for the enum. Should never be used in an initialized + /// `RedisOrder`. + Unspecified = 0, + /// Ticker is for a perpetual pair. + Perpetual = 1, + /// Ticker is for a spot pair. + Spot = 2, + } + impl TickerType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + TickerType::Unspecified => "TICKER_TYPE_UNSPECIFIED", + TickerType::Perpetual => "TICKER_TYPE_PERPETUAL", + TickerType::Spot => "TICKER_TYPE_SPOT", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "TICKER_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "TICKER_TYPE_PERPETUAL" => Some(Self::Perpetual), + "TICKER_TYPE_SPOT" => Some(Self::Spot), + _ => None, + } + } + } +} +impl ::prost::Name for RedisOrder { + const NAME: &'static str = "RedisOrder"; + const PACKAGE: &'static str = "dydxprotocol.indexer.redis"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.redis.RedisOrder".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.redis.RedisOrder".into() + } +} diff --git a/v4-proto-rs/src/dydxprotocol.indexer.shared.rs b/v4-proto-rs/src/dydxprotocol.indexer.shared.rs new file mode 100644 index 0000000000..570398f54b --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.indexer.shared.rs @@ -0,0 +1,125 @@ +// This file is @generated by prost-build. +/// OrderRemovalReason is an enum of all the reasons an order was removed. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum OrderRemovalReason { + /// Default value, this is invalid and unused. + Unspecified = 0, + /// The order was removed due to being expired. + Expired = 1, + /// The order was removed due to being canceled by a user. + UserCanceled = 2, + /// The order was removed due to being undercollateralized. + Undercollateralized = 3, + /// The order caused an internal error during order placement and was + /// removed. + InternalError = 4, + /// The order would have matched against another order placed by the same + /// subaccount and was removed. + SelfTradeError = 5, + /// The order would have matched against maker orders on the orderbook + /// despite being a post-only order and was removed. + PostOnlyWouldCrossMakerOrder = 6, + /// The order was an ICO order and would have been placed on the orderbook as + /// resting liquidity and was removed. + ImmediateOrCancelWouldRestOnBook = 7, + /// The order was a fill-or-kill order that could not be fully filled and was + /// removed. + FokOrderCouldNotBeFullyFulled = 8, + /// The order was a reduce-only order that was removed due to either: + /// - being a taker order and fully-filling the order would flip the side of + /// the subaccount's position, in this case the remaining size of the + /// order is removed + /// - being a maker order resting on the book and being removed when either + /// the subaccount's position is closed or flipped sides + ReduceOnlyResize = 9, + /// The order should be expired, according to the Indexer's cached data, but + /// the Indexer has yet to receive a message to remove the order. In order to + /// keep the data cached by the Indexer up-to-date and accurate, clear out + /// the data if it's expired by sending an order removal with this reason. + /// Protocol should never send this reason to Indexer. + IndexerExpired = 10, + /// The order has been replaced. + Replaced = 11, + /// The order has been fully-filled. Only sent by the Indexer for stateful + /// orders. + FullyFilled = 12, + /// The order has been removed since the subaccount does not satisfy the + /// equity tier requirements. + EquityTier = 13, + /// The order has been removed since its ClobPair has entered final settlement. + FinalSettlement = 14, + /// The order has been removed since filling it would lead to the subaccount + /// violating isolated subaccount constraints. + ViolatesIsolatedSubaccountConstraints = 15, +} +impl OrderRemovalReason { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + OrderRemovalReason::Unspecified => "ORDER_REMOVAL_REASON_UNSPECIFIED", + OrderRemovalReason::Expired => "ORDER_REMOVAL_REASON_EXPIRED", + OrderRemovalReason::UserCanceled => "ORDER_REMOVAL_REASON_USER_CANCELED", + OrderRemovalReason::Undercollateralized => { + "ORDER_REMOVAL_REASON_UNDERCOLLATERALIZED" + } + OrderRemovalReason::InternalError => "ORDER_REMOVAL_REASON_INTERNAL_ERROR", + OrderRemovalReason::SelfTradeError => "ORDER_REMOVAL_REASON_SELF_TRADE_ERROR", + OrderRemovalReason::PostOnlyWouldCrossMakerOrder => { + "ORDER_REMOVAL_REASON_POST_ONLY_WOULD_CROSS_MAKER_ORDER" + } + OrderRemovalReason::ImmediateOrCancelWouldRestOnBook => { + "ORDER_REMOVAL_REASON_IMMEDIATE_OR_CANCEL_WOULD_REST_ON_BOOK" + } + OrderRemovalReason::FokOrderCouldNotBeFullyFulled => { + "ORDER_REMOVAL_REASON_FOK_ORDER_COULD_NOT_BE_FULLY_FULLED" + } + OrderRemovalReason::ReduceOnlyResize => { + "ORDER_REMOVAL_REASON_REDUCE_ONLY_RESIZE" + } + OrderRemovalReason::IndexerExpired => "ORDER_REMOVAL_REASON_INDEXER_EXPIRED", + OrderRemovalReason::Replaced => "ORDER_REMOVAL_REASON_REPLACED", + OrderRemovalReason::FullyFilled => "ORDER_REMOVAL_REASON_FULLY_FILLED", + OrderRemovalReason::EquityTier => "ORDER_REMOVAL_REASON_EQUITY_TIER", + OrderRemovalReason::FinalSettlement => { + "ORDER_REMOVAL_REASON_FINAL_SETTLEMENT" + } + OrderRemovalReason::ViolatesIsolatedSubaccountConstraints => { + "ORDER_REMOVAL_REASON_VIOLATES_ISOLATED_SUBACCOUNT_CONSTRAINTS" + } + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ORDER_REMOVAL_REASON_UNSPECIFIED" => Some(Self::Unspecified), + "ORDER_REMOVAL_REASON_EXPIRED" => Some(Self::Expired), + "ORDER_REMOVAL_REASON_USER_CANCELED" => Some(Self::UserCanceled), + "ORDER_REMOVAL_REASON_UNDERCOLLATERALIZED" => Some(Self::Undercollateralized), + "ORDER_REMOVAL_REASON_INTERNAL_ERROR" => Some(Self::InternalError), + "ORDER_REMOVAL_REASON_SELF_TRADE_ERROR" => Some(Self::SelfTradeError), + "ORDER_REMOVAL_REASON_POST_ONLY_WOULD_CROSS_MAKER_ORDER" => { + Some(Self::PostOnlyWouldCrossMakerOrder) + } + "ORDER_REMOVAL_REASON_IMMEDIATE_OR_CANCEL_WOULD_REST_ON_BOOK" => { + Some(Self::ImmediateOrCancelWouldRestOnBook) + } + "ORDER_REMOVAL_REASON_FOK_ORDER_COULD_NOT_BE_FULLY_FULLED" => { + Some(Self::FokOrderCouldNotBeFullyFulled) + } + "ORDER_REMOVAL_REASON_REDUCE_ONLY_RESIZE" => Some(Self::ReduceOnlyResize), + "ORDER_REMOVAL_REASON_INDEXER_EXPIRED" => Some(Self::IndexerExpired), + "ORDER_REMOVAL_REASON_REPLACED" => Some(Self::Replaced), + "ORDER_REMOVAL_REASON_FULLY_FILLED" => Some(Self::FullyFilled), + "ORDER_REMOVAL_REASON_EQUITY_TIER" => Some(Self::EquityTier), + "ORDER_REMOVAL_REASON_FINAL_SETTLEMENT" => Some(Self::FinalSettlement), + "ORDER_REMOVAL_REASON_VIOLATES_ISOLATED_SUBACCOUNT_CONSTRAINTS" => { + Some(Self::ViolatesIsolatedSubaccountConstraints) + } + _ => None, + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.indexer.socks.rs b/v4-proto-rs/src/dydxprotocol.indexer.socks.rs new file mode 100644 index 0000000000..b664937294 --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.indexer.socks.rs @@ -0,0 +1,196 @@ +// This file is @generated by prost-build. +/// Message to be sent through the 'to-websockets-orderbooks` kafka topic. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OrderbookMessage { + /// Stringified JSON object of all events to be streamed. + #[prost(string, tag = "1")] + pub contents: ::prost::alloc::string::String, + /// Clob pair id of the Orderbook message. + #[prost(string, tag = "2")] + pub clob_pair_id: ::prost::alloc::string::String, + /// Version of the websocket message. + #[prost(string, tag = "3")] + pub version: ::prost::alloc::string::String, +} +impl ::prost::Name for OrderbookMessage { + const NAME: &'static str = "OrderbookMessage"; + const PACKAGE: &'static str = "dydxprotocol.indexer.socks"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.socks.OrderbookMessage".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.socks.OrderbookMessage".into() + } +} +/// Message to be sent through the 'to-websockets-subaccounts` kafka topic. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubaccountMessage { + /// Block height where the contents occur. + #[prost(string, tag = "1")] + pub block_height: ::prost::alloc::string::String, + /// Transaction index where the contents occur. + #[prost(int32, tag = "2")] + pub transaction_index: i32, + /// Event index where the contents occur. + #[prost(uint32, tag = "3")] + pub event_index: u32, + /// Stringified JSON object of all events to be streamed. + #[prost(string, tag = "4")] + pub contents: ::prost::alloc::string::String, + /// Subaccount id that the content corresponds to. + #[prost(message, optional, tag = "5")] + pub subaccount_id: ::core::option::Option, + /// Version of the websocket message. + #[prost(string, tag = "6")] + pub version: ::prost::alloc::string::String, +} +impl ::prost::Name for SubaccountMessage { + const NAME: &'static str = "SubaccountMessage"; + const PACKAGE: &'static str = "dydxprotocol.indexer.socks"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.socks.SubaccountMessage".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.socks.SubaccountMessage".into() + } +} +/// Message to be sent through the 'to-websockets-trades` kafka topic. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TradeMessage { + /// Block height where the contents occur. + #[prost(string, tag = "1")] + pub block_height: ::prost::alloc::string::String, + /// Stringified JSON object of all events to be streamed. + #[prost(string, tag = "4")] + pub contents: ::prost::alloc::string::String, + /// Clob pair id of the Trade message. + #[prost(string, tag = "5")] + pub clob_pair_id: ::prost::alloc::string::String, + /// Version of the websocket message. + #[prost(string, tag = "6")] + pub version: ::prost::alloc::string::String, +} +impl ::prost::Name for TradeMessage { + const NAME: &'static str = "TradeMessage"; + const PACKAGE: &'static str = "dydxprotocol.indexer.socks"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.socks.TradeMessage".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.socks.TradeMessage".into() + } +} +/// Message to be sent through the 'to-websockets-markets` kafka topic. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketMessage { + /// Stringified JSON object of all events to be streamed. + #[prost(string, tag = "1")] + pub contents: ::prost::alloc::string::String, + /// Version of the websocket message. + #[prost(string, tag = "2")] + pub version: ::prost::alloc::string::String, +} +impl ::prost::Name for MarketMessage { + const NAME: &'static str = "MarketMessage"; + const PACKAGE: &'static str = "dydxprotocol.indexer.socks"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.socks.MarketMessage".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.socks.MarketMessage".into() + } +} +/// Message to be sent through the 'to-websockets-candles` kafka topic. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CandleMessage { + /// Stringified JSON object of all events to be streamed. + #[prost(string, tag = "1")] + pub contents: ::prost::alloc::string::String, + /// Clob pair id of the Candle message. + #[prost(string, tag = "2")] + pub clob_pair_id: ::prost::alloc::string::String, + /// Resolution of the candle update. + #[prost(enumeration = "candle_message::Resolution", tag = "3")] + pub resolution: i32, + /// Version of the websocket message. + #[prost(string, tag = "4")] + pub version: ::prost::alloc::string::String, +} +/// Nested message and enum types in `CandleMessage`. +pub mod candle_message { + /// TODO(IND-210): Make this proto conform and update downstream indexer logic + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum Resolution { + /// buf:lint:ignore ENUM_VALUE_PREFIX + /// buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX + OneMinute = 0, + /// buf:lint:ignore ENUM_VALUE_PREFIX + FiveMinutes = 1, + /// buf:lint:ignore ENUM_VALUE_PREFIX + FifteenMinutes = 2, + /// buf:lint:ignore ENUM_VALUE_PREFIX + ThirtyMinutes = 3, + /// buf:lint:ignore ENUM_VALUE_PREFIX + OneHour = 4, + /// buf:lint:ignore ENUM_VALUE_PREFIX + FourHours = 5, + /// buf:lint:ignore ENUM_VALUE_PREFIX + OneDay = 6, + } + impl Resolution { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Resolution::OneMinute => "ONE_MINUTE", + Resolution::FiveMinutes => "FIVE_MINUTES", + Resolution::FifteenMinutes => "FIFTEEN_MINUTES", + Resolution::ThirtyMinutes => "THIRTY_MINUTES", + Resolution::OneHour => "ONE_HOUR", + Resolution::FourHours => "FOUR_HOURS", + Resolution::OneDay => "ONE_DAY", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ONE_MINUTE" => Some(Self::OneMinute), + "FIVE_MINUTES" => Some(Self::FiveMinutes), + "FIFTEEN_MINUTES" => Some(Self::FifteenMinutes), + "THIRTY_MINUTES" => Some(Self::ThirtyMinutes), + "ONE_HOUR" => Some(Self::OneHour), + "FOUR_HOURS" => Some(Self::FourHours), + "ONE_DAY" => Some(Self::OneDay), + _ => None, + } + } + } +} +impl ::prost::Name for CandleMessage { + const NAME: &'static str = "CandleMessage"; + const PACKAGE: &'static str = "dydxprotocol.indexer.socks"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.indexer.socks.CandleMessage".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.indexer.socks.CandleMessage".into() + } +} diff --git a/v4-proto-rs/src/dydxprotocol.perpetuals.rs b/v4-proto-rs/src/dydxprotocol.perpetuals.rs new file mode 100644 index 0000000000..7fd52a2abb --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.perpetuals.rs @@ -0,0 +1,1152 @@ +// This file is @generated by prost-build. +/// Perpetual represents a perpetual on the dYdX exchange. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Perpetual { + /// PerpetualParams is the parameters of the perpetual. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, + /// The current index determined by the cumulative all-time + /// history of the funding mechanism. Starts at zero. + #[prost(bytes = "vec", tag = "2")] + pub funding_index: ::prost::alloc::vec::Vec, + /// Total size of open long contracts, measured in base_quantums. + #[prost(bytes = "vec", tag = "3")] + pub open_interest: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for Perpetual { + const NAME: &'static str = "Perpetual"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.Perpetual".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.Perpetual".into() + } +} +/// PerpetualParams represents the parameters of a perpetual on the dYdX +/// exchange. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PerpetualParams { + /// Unique, sequentially-generated. + #[prost(uint32, tag = "1")] + pub id: u32, + /// The name of the `Perpetual` (e.g. `BTC-USD`). + #[prost(string, tag = "2")] + pub ticker: ::prost::alloc::string::String, + /// The market associated with this `Perpetual`. It + /// acts as the oracle price for the purposes of calculating + /// collateral, margin requirements, and funding rates. + #[prost(uint32, tag = "3")] + pub market_id: u32, + /// The exponent for converting an atomic amount (`size = 1`) + /// to a full coin. For example, if `AtomicResolution = -8` + /// then a `PerpetualPosition` with `size = 1e8` is equivalent to + /// a position size of one full coin. + #[prost(sint32, tag = "4")] + pub atomic_resolution: i32, + /// The default funding payment if there is no price premium. In + /// parts-per-million. + #[prost(sint32, tag = "5")] + pub default_funding_ppm: i32, + /// The liquidity_tier that this perpetual is associated with. + #[prost(uint32, tag = "6")] + pub liquidity_tier: u32, + /// The market type specifying if this perpetual is cross or isolated + #[prost(enumeration = "PerpetualMarketType", tag = "7")] + pub market_type: i32, +} +impl ::prost::Name for PerpetualParams { + const NAME: &'static str = "PerpetualParams"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.PerpetualParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.PerpetualParams".into() + } +} +/// MarketPremiums stores a list of premiums for a single perpetual market. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketPremiums { + /// perpetual_id is the Id of the perpetual market. + #[prost(uint32, tag = "1")] + pub perpetual_id: u32, + /// premiums is a list of premium values for a perpetual market. Since most + /// premiums are zeros under "stable" market conditions, only non-zero values + /// are stored in this list. + #[prost(sint32, repeated, tag = "2")] + pub premiums: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for MarketPremiums { + const NAME: &'static str = "MarketPremiums"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.MarketPremiums".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.MarketPremiums".into() + } +} +/// PremiumStore is a struct to store a perpetual premiums for all +/// perpetual markets. It stores a list of `MarketPremiums`, each of which +/// corresponds to a perpetual market and stores a list of non-zero premium +/// values for that market. +/// This struct can either be used to store `PremiumVotes` or +/// `PremiumSamples`. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PremiumStore { + /// all_market_premiums a list of `MarketPremiums`, each corresponding to + /// a perpetual market. + #[prost(message, repeated, tag = "1")] + pub all_market_premiums: ::prost::alloc::vec::Vec, + /// number of rounds where premium values were added. This value indicates + /// the total number of premiums (zeros and non-zeros) for each + /// `MarketPremiums` struct. Note that in the edge case a perpetual market was + /// added in the middle of a epoch, we don't keep a seperate count for that + /// market. This means we treat this market as having zero premiums before it + /// was added. + #[prost(uint32, tag = "2")] + pub num_premiums: u32, +} +impl ::prost::Name for PremiumStore { + const NAME: &'static str = "PremiumStore"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.PremiumStore".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.PremiumStore".into() + } +} +/// LiquidityTier stores margin information. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LiquidityTier { + /// Unique id. + #[prost(uint32, tag = "1")] + pub id: u32, + /// The name of the tier purely for mnemonic purposes, e.g. "Gold". + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, + /// The margin fraction needed to open a position. + /// In parts-per-million. + #[prost(uint32, tag = "3")] + pub initial_margin_ppm: u32, + /// The fraction of the initial-margin that the maintenance-margin is, + /// e.g. 50%. In parts-per-million. + #[prost(uint32, tag = "4")] + pub maintenance_fraction_ppm: u32, + /// The maximum position size at which the margin requirements are + /// not increased over the default values. Above this position size, + /// the margin requirements increase at a rate of sqrt(size). + /// + /// Deprecated since v3.x. + #[deprecated] + #[prost(uint64, tag = "5")] + pub base_position_notional: u64, + /// The impact notional amount (in quote quantums) is used to determine impact + /// bid/ask prices and its recommended value is 500 USDC / initial margin + /// fraction. + /// - Impact bid price = average execution price for a market sell of the + /// impact notional value. + /// - Impact ask price = average execution price for a market buy of the + /// impact notional value. + #[prost(uint64, tag = "6")] + pub impact_notional: u64, + /// Lower cap for Open Interest Margin Fracton (OIMF), in quote quantums. + /// IMF is not affected when OI <= open_interest_lower_cap. + #[prost(uint64, tag = "7")] + pub open_interest_lower_cap: u64, + /// Upper cap for Open Interest Margin Fracton (OIMF), in quote quantums. + /// IMF scales linearly to 100% as OI approaches open_interest_upper_cap. + /// If zero, then the IMF does not scale with OI. + #[prost(uint64, tag = "8")] + pub open_interest_upper_cap: u64, +} +impl ::prost::Name for LiquidityTier { + const NAME: &'static str = "LiquidityTier"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.LiquidityTier".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.LiquidityTier".into() + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum PerpetualMarketType { + /// Unspecified market type. + Unspecified = 0, + /// Market type for cross margin perpetual markets. + Cross = 1, + /// Market type for isolated margin perpetual markets. + Isolated = 2, +} +impl PerpetualMarketType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + PerpetualMarketType::Unspecified => "PERPETUAL_MARKET_TYPE_UNSPECIFIED", + PerpetualMarketType::Cross => "PERPETUAL_MARKET_TYPE_CROSS", + PerpetualMarketType::Isolated => "PERPETUAL_MARKET_TYPE_ISOLATED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "PERPETUAL_MARKET_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "PERPETUAL_MARKET_TYPE_CROSS" => Some(Self::Cross), + "PERPETUAL_MARKET_TYPE_ISOLATED" => Some(Self::Isolated), + _ => None, + } + } +} +/// Params defines the parameters for x/perpetuals module. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + /// Funding rate clamp factor in parts-per-million, used for clamping 8-hour + /// funding rates according to equation: |R| <= funding_rate_clamp_factor * + /// (initial margin - maintenance margin). + #[prost(uint32, tag = "1")] + pub funding_rate_clamp_factor_ppm: u32, + /// Premium vote clamp factor in parts-per-million, used for clamping premium + /// votes according to equation: |V| <= premium_vote_clamp_factor * + /// (initial margin - maintenance margin). + #[prost(uint32, tag = "2")] + pub premium_vote_clamp_factor_ppm: u32, + /// Minimum number of premium votes per premium sample. If number of premium + /// votes is smaller than this number, pad with zeros up to this number. + #[prost(uint32, tag = "3")] + pub min_num_votes_per_sample: u32, +} +impl ::prost::Name for Params { + const NAME: &'static str = "Params"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.Params".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.Params".into() + } +} +/// GenesisState defines the perpetuals module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, repeated, tag = "1")] + pub perpetuals: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "2")] + pub liquidity_tiers: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "3")] + pub params: ::core::option::Option, +} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.GenesisState".into() + } +} +/// Queries a Perpetual by id. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPerpetualRequest { + #[prost(uint32, tag = "1")] + pub id: u32, +} +impl ::prost::Name for QueryPerpetualRequest { + const NAME: &'static str = "QueryPerpetualRequest"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.QueryPerpetualRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.QueryPerpetualRequest".into() + } +} +/// QueryPerpetualResponse is response type for the Perpetual RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPerpetualResponse { + #[prost(message, optional, tag = "1")] + pub perpetual: ::core::option::Option, +} +impl ::prost::Name for QueryPerpetualResponse { + const NAME: &'static str = "QueryPerpetualResponse"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.QueryPerpetualResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.QueryPerpetualResponse".into() + } +} +/// Queries a list of Perpetual items. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllPerpetualsRequest { + #[prost(message, optional, tag = "1")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageRequest, + >, +} +impl ::prost::Name for QueryAllPerpetualsRequest { + const NAME: &'static str = "QueryAllPerpetualsRequest"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.QueryAllPerpetualsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.QueryAllPerpetualsRequest".into() + } +} +/// QueryAllPerpetualsResponse is response type for the AllPerpetuals RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllPerpetualsResponse { + #[prost(message, repeated, tag = "1")] + pub perpetual: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageResponse, + >, +} +impl ::prost::Name for QueryAllPerpetualsResponse { + const NAME: &'static str = "QueryAllPerpetualsResponse"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.QueryAllPerpetualsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.QueryAllPerpetualsResponse".into() + } +} +/// Queries a list of LiquidityTier items. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllLiquidityTiersRequest { + #[prost(message, optional, tag = "1")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageRequest, + >, +} +impl ::prost::Name for QueryAllLiquidityTiersRequest { + const NAME: &'static str = "QueryAllLiquidityTiersRequest"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.QueryAllLiquidityTiersRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.QueryAllLiquidityTiersRequest".into() + } +} +/// QueryAllLiquidityTiersResponse is response type for the AllLiquidityTiers RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllLiquidityTiersResponse { + #[prost(message, repeated, tag = "1")] + pub liquidity_tiers: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageResponse, + >, +} +impl ::prost::Name for QueryAllLiquidityTiersResponse { + const NAME: &'static str = "QueryAllLiquidityTiersResponse"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.QueryAllLiquidityTiersResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.QueryAllLiquidityTiersResponse".into() + } +} +/// QueryPremiumVotesRequest is the request type for the PremiumVotes RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPremiumVotesRequest {} +impl ::prost::Name for QueryPremiumVotesRequest { + const NAME: &'static str = "QueryPremiumVotesRequest"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.QueryPremiumVotesRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.QueryPremiumVotesRequest".into() + } +} +/// QueryPremiumVotesResponse is the response type for the PremiumVotes RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPremiumVotesResponse { + #[prost(message, optional, tag = "1")] + pub premium_votes: ::core::option::Option, +} +impl ::prost::Name for QueryPremiumVotesResponse { + const NAME: &'static str = "QueryPremiumVotesResponse"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.QueryPremiumVotesResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.QueryPremiumVotesResponse".into() + } +} +/// QueryPremiumSamplesRequest is the request type for the PremiumSamples RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPremiumSamplesRequest {} +impl ::prost::Name for QueryPremiumSamplesRequest { + const NAME: &'static str = "QueryPremiumSamplesRequest"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.QueryPremiumSamplesRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.QueryPremiumSamplesRequest".into() + } +} +/// QueryPremiumSamplesResponse is the response type for the PremiumSamples RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPremiumSamplesResponse { + #[prost(message, optional, tag = "1")] + pub premium_samples: ::core::option::Option, +} +impl ::prost::Name for QueryPremiumSamplesResponse { + const NAME: &'static str = "QueryPremiumSamplesResponse"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.QueryPremiumSamplesResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.QueryPremiumSamplesResponse".into() + } +} +/// QueryParamsResponse is the response type for the Params RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +impl ::prost::Name for QueryParamsRequest { + const NAME: &'static str = "QueryParamsRequest"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.QueryParamsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.QueryParamsRequest".into() + } +} +/// QueryParamsResponse is the response type for the Params RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +impl ::prost::Name for QueryParamsResponse { + const NAME: &'static str = "QueryParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.QueryParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.QueryParamsResponse".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Queries a Perpetual by id. + pub async fn perpetual( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.perpetuals.Query/Perpetual", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.perpetuals.Query", "Perpetual")); + self.inner.unary(req, path, codec).await + } + /// Queries a list of Perpetual items. + pub async fn all_perpetuals( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.perpetuals.Query/AllPerpetuals", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.perpetuals.Query", "AllPerpetuals"), + ); + self.inner.unary(req, path, codec).await + } + /// Queries a list of LiquidityTiers. + pub async fn all_liquidity_tiers( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.perpetuals.Query/AllLiquidityTiers", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.perpetuals.Query", "AllLiquidityTiers"), + ); + self.inner.unary(req, path, codec).await + } + /// Queries a list of premium votes. + pub async fn premium_votes( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.perpetuals.Query/PremiumVotes", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.perpetuals.Query", "PremiumVotes"), + ); + self.inner.unary(req, path, codec).await + } + /// Queries a list of premium samples. + pub async fn premium_samples( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.perpetuals.Query/PremiumSamples", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.perpetuals.Query", "PremiumSamples"), + ); + self.inner.unary(req, path, codec).await + } + /// Queries the perpetual params. + pub async fn params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.perpetuals.Query/Params", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.perpetuals.Query", "Params")); + self.inner.unary(req, path, codec).await + } + } +} +/// MsgCreatePerpetual is a message used by x/gov to create a new perpetual. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreatePerpetual { + /// The address that controls the module. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// `params` defines parameters for the new perpetual market. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +impl ::prost::Name for MsgCreatePerpetual { + const NAME: &'static str = "MsgCreatePerpetual"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.MsgCreatePerpetual".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.MsgCreatePerpetual".into() + } +} +/// MsgCreatePerpetualResponse defines the CreatePerpetual +/// response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreatePerpetualResponse {} +impl ::prost::Name for MsgCreatePerpetualResponse { + const NAME: &'static str = "MsgCreatePerpetualResponse"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.MsgCreatePerpetualResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.MsgCreatePerpetualResponse".into() + } +} +/// MsgSetLiquidityTier is a message used by x/gov to create or update a +/// liquidity tier. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSetLiquidityTier { + /// The address that controls the module. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// The liquidity tier to create or update. + #[prost(message, optional, tag = "2")] + pub liquidity_tier: ::core::option::Option, +} +impl ::prost::Name for MsgSetLiquidityTier { + const NAME: &'static str = "MsgSetLiquidityTier"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.MsgSetLiquidityTier".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.MsgSetLiquidityTier".into() + } +} +/// MsgSetLiquidityTierResponse defines the SetLiquidityTier response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSetLiquidityTierResponse {} +impl ::prost::Name for MsgSetLiquidityTierResponse { + const NAME: &'static str = "MsgSetLiquidityTierResponse"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.MsgSetLiquidityTierResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.MsgSetLiquidityTierResponse".into() + } +} +/// MsgUpdatePerpetualParams is a message used by x/gov to update the parameters +/// of a perpetual. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdatePerpetualParams { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// The perpetual to update. Each field must be set. + #[prost(message, optional, tag = "2")] + pub perpetual_params: ::core::option::Option, +} +impl ::prost::Name for MsgUpdatePerpetualParams { + const NAME: &'static str = "MsgUpdatePerpetualParams"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.MsgUpdatePerpetualParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.MsgUpdatePerpetualParams".into() + } +} +/// MsgUpdatePerpetualParamsResponse defines the UpdatePerpetualParams +/// response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdatePerpetualParamsResponse {} +impl ::prost::Name for MsgUpdatePerpetualParamsResponse { + const NAME: &'static str = "MsgUpdatePerpetualParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.MsgUpdatePerpetualParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.MsgUpdatePerpetualParamsResponse".into() + } +} +/// FundingPremium represents a funding premium value for a perpetual +/// market. Can be used to represent a premium vote or a premium sample. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FundingPremium { + /// The id of the perpetual market. + #[prost(uint32, tag = "1")] + pub perpetual_id: u32, + /// The sampled premium rate. In parts-per-million. + #[prost(int32, tag = "2")] + pub premium_ppm: i32, +} +impl ::prost::Name for FundingPremium { + const NAME: &'static str = "FundingPremium"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.FundingPremium".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.FundingPremium".into() + } +} +/// MsgAddPremiumVotes is a request type for the AddPremiumVotes method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgAddPremiumVotes { + #[prost(message, repeated, tag = "1")] + pub votes: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for MsgAddPremiumVotes { + const NAME: &'static str = "MsgAddPremiumVotes"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.MsgAddPremiumVotes".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.MsgAddPremiumVotes".into() + } +} +/// MsgAddPremiumVotesResponse defines the AddPremiumVotes +/// response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgAddPremiumVotesResponse {} +impl ::prost::Name for MsgAddPremiumVotesResponse { + const NAME: &'static str = "MsgAddPremiumVotesResponse"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.MsgAddPremiumVotesResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.MsgAddPremiumVotesResponse".into() + } +} +/// MsgUpdateParams is a message used by x/gov to update the parameters of the +/// perpetuals module. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParams { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// The parameters to update. Each field must be set. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +impl ::prost::Name for MsgUpdateParams { + const NAME: &'static str = "MsgUpdateParams"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.MsgUpdateParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.MsgUpdateParams".into() + } +} +/// MsgUpdateParamsResponse defines the UpdateParams response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParamsResponse {} +impl ::prost::Name for MsgUpdateParamsResponse { + const NAME: &'static str = "MsgUpdateParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.perpetuals"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.perpetuals.MsgUpdateParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.perpetuals.MsgUpdateParamsResponse".into() + } +} +/// Generated client implementations. +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// AddPremiumVotes add new samples of the funding premiums to the + /// application. + pub async fn add_premium_votes( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.perpetuals.Msg/AddPremiumVotes", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.perpetuals.Msg", "AddPremiumVotes"), + ); + self.inner.unary(req, path, codec).await + } + /// CreatePerpetual creates a new perpetual object. + pub async fn create_perpetual( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.perpetuals.Msg/CreatePerpetual", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.perpetuals.Msg", "CreatePerpetual"), + ); + self.inner.unary(req, path, codec).await + } + /// SetLiquidityTier creates an liquidity tier if the ID doesn't exist, and + /// updates the existing liquidity tier otherwise. + pub async fn set_liquidity_tier( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.perpetuals.Msg/SetLiquidityTier", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.perpetuals.Msg", "SetLiquidityTier"), + ); + self.inner.unary(req, path, codec).await + } + /// UpdatePerpetualParams updates the parameters of a perpetual market. + pub async fn update_perpetual_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.perpetuals.Msg/UpdatePerpetualParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.perpetuals.Msg", + "UpdatePerpetualParams", + ), + ); + self.inner.unary(req, path, codec).await + } + /// UpdateParams updates the parameters of perpetuals module. + pub async fn update_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.perpetuals.Msg/UpdateParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.perpetuals.Msg", "UpdateParams")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.prices.rs b/v4-proto-rs/src/dydxprotocol.prices.rs new file mode 100644 index 0000000000..a62d3cf018 --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.prices.rs @@ -0,0 +1,737 @@ +// This file is @generated by prost-build. +/// MarketParam represents the x/prices configuration for markets, including +/// representing price values, resolving markets on individual exchanges, and +/// generating price updates. This configuration is specific to the quote +/// currency. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketParam { + /// Unique, sequentially-generated value. + #[prost(uint32, tag = "1")] + pub id: u32, + /// The human-readable name of the market pair (e.g. `BTC-USD`). + #[prost(string, tag = "2")] + pub pair: ::prost::alloc::string::String, + /// Static value. The exponent of the price. + /// For example if `Exponent == -5` then a `Value` of `1,000,000,000` + /// represents ``$10,000`. Therefore `10 ^ Exponent` represents the smallest + /// price step (in dollars) that can be recorded. + #[prost(sint32, tag = "3")] + pub exponent: i32, + /// The minimum number of exchanges that should be reporting a live price for + /// a price update to be considered valid. + #[prost(uint32, tag = "4")] + pub min_exchanges: u32, + /// The minimum allowable change in `price` value that would cause a price + /// update on the network. Measured as `1e-6` (parts per million). + #[prost(uint32, tag = "5")] + pub min_price_change_ppm: u32, + /// A string of json that encodes the configuration for resolving the price + /// of this market on various exchanges. + #[prost(string, tag = "6")] + pub exchange_config_json: ::prost::alloc::string::String, +} +impl ::prost::Name for MarketParam { + const NAME: &'static str = "MarketParam"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.MarketParam".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.MarketParam".into() + } +} +/// MarketPrice is used by the application to store/retrieve oracle price. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketPrice { + /// Unique, sequentially-generated value that matches `MarketParam`. + #[prost(uint32, tag = "1")] + pub id: u32, + /// Static value. The exponent of the price. See the comment on the duplicate + /// MarketParam field for more information. + #[prost(sint32, tag = "2")] + pub exponent: i32, + /// The variable value that is updated by oracle price updates. `0` if it has + /// never been updated, `>0` otherwise. + #[prost(uint64, tag = "3")] + pub price: u64, +} +impl ::prost::Name for MarketPrice { + const NAME: &'static str = "MarketPrice"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.MarketPrice".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.MarketPrice".into() + } +} +/// GenesisState defines the prices module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, repeated, tag = "1")] + pub market_params: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "2")] + pub market_prices: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.GenesisState".into() + } +} +/// QueryMarketPriceRequest is request type for the Query/Params `MarketPrice` +/// RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryMarketPriceRequest { + #[prost(uint32, tag = "1")] + pub id: u32, +} +impl ::prost::Name for QueryMarketPriceRequest { + const NAME: &'static str = "QueryMarketPriceRequest"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.QueryMarketPriceRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.QueryMarketPriceRequest".into() + } +} +/// QueryMarketPriceResponse is response type for the Query/Params `MarketPrice` +/// RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryMarketPriceResponse { + #[prost(message, optional, tag = "1")] + pub market_price: ::core::option::Option, +} +impl ::prost::Name for QueryMarketPriceResponse { + const NAME: &'static str = "QueryMarketPriceResponse"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.QueryMarketPriceResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.QueryMarketPriceResponse".into() + } +} +/// QueryAllMarketPricesRequest is request type for the Query/Params +/// `AllMarketPrices` RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllMarketPricesRequest { + #[prost(message, optional, tag = "1")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageRequest, + >, +} +impl ::prost::Name for QueryAllMarketPricesRequest { + const NAME: &'static str = "QueryAllMarketPricesRequest"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.QueryAllMarketPricesRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.QueryAllMarketPricesRequest".into() + } +} +/// QueryAllMarketPricesResponse is response type for the Query/Params +/// `AllMarketPrices` RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllMarketPricesResponse { + #[prost(message, repeated, tag = "1")] + pub market_prices: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageResponse, + >, +} +impl ::prost::Name for QueryAllMarketPricesResponse { + const NAME: &'static str = "QueryAllMarketPricesResponse"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.QueryAllMarketPricesResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.QueryAllMarketPricesResponse".into() + } +} +/// QueryMarketParamsRequest is request type for the Query/Params `MarketParams` +/// RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryMarketParamRequest { + #[prost(uint32, tag = "1")] + pub id: u32, +} +impl ::prost::Name for QueryMarketParamRequest { + const NAME: &'static str = "QueryMarketParamRequest"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.QueryMarketParamRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.QueryMarketParamRequest".into() + } +} +/// QueryMarketParamResponse is response type for the Query/Params `MarketParams` +/// RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryMarketParamResponse { + #[prost(message, optional, tag = "1")] + pub market_param: ::core::option::Option, +} +impl ::prost::Name for QueryMarketParamResponse { + const NAME: &'static str = "QueryMarketParamResponse"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.QueryMarketParamResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.QueryMarketParamResponse".into() + } +} +/// QueryAllMarketParamsRequest is request type for the Query/Params +/// `AllMarketParams` RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllMarketParamsRequest { + #[prost(message, optional, tag = "1")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageRequest, + >, +} +impl ::prost::Name for QueryAllMarketParamsRequest { + const NAME: &'static str = "QueryAllMarketParamsRequest"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.QueryAllMarketParamsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.QueryAllMarketParamsRequest".into() + } +} +/// QueryAllMarketParamsResponse is response type for the Query/Params +/// `AllMarketParams` RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllMarketParamsResponse { + #[prost(message, repeated, tag = "1")] + pub market_params: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageResponse, + >, +} +impl ::prost::Name for QueryAllMarketParamsResponse { + const NAME: &'static str = "QueryAllMarketParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.QueryAllMarketParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.QueryAllMarketParamsResponse".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Queries a MarketPrice by id. + pub async fn market_price( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.prices.Query/MarketPrice", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.prices.Query", "MarketPrice")); + self.inner.unary(req, path, codec).await + } + /// Queries a list of MarketPrice items. + pub async fn all_market_prices( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.prices.Query/AllMarketPrices", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.prices.Query", "AllMarketPrices")); + self.inner.unary(req, path, codec).await + } + /// Queries a MarketParam by id. + pub async fn market_param( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.prices.Query/MarketParam", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.prices.Query", "MarketParam")); + self.inner.unary(req, path, codec).await + } + /// Queries a list of MarketParam items. + pub async fn all_market_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.prices.Query/AllMarketParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.prices.Query", "AllMarketParams")); + self.inner.unary(req, path, codec).await + } + } +} +/// MsgCreateOracleMarket is a message used by x/gov for creating a new oracle +/// market. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateOracleMarket { + /// The address that controls the module. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// `params` defines parameters for the new oracle market. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +impl ::prost::Name for MsgCreateOracleMarket { + const NAME: &'static str = "MsgCreateOracleMarket"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.MsgCreateOracleMarket".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.MsgCreateOracleMarket".into() + } +} +/// MsgCreateOracleMarketResponse defines the CreateOracleMarket response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateOracleMarketResponse {} +impl ::prost::Name for MsgCreateOracleMarketResponse { + const NAME: &'static str = "MsgCreateOracleMarketResponse"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.MsgCreateOracleMarketResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.MsgCreateOracleMarketResponse".into() + } +} +/// MsgUpdateMarketPrices is a request type for the UpdateMarketPrices method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateMarketPrices { + #[prost(message, repeated, tag = "1")] + pub market_price_updates: ::prost::alloc::vec::Vec< + msg_update_market_prices::MarketPrice, + >, +} +/// Nested message and enum types in `MsgUpdateMarketPrices`. +pub mod msg_update_market_prices { + /// MarketPrice represents a price update for a single market + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct MarketPrice { + /// The id of market to update + #[prost(uint32, tag = "1")] + pub market_id: u32, + /// The updated price + #[prost(uint64, tag = "2")] + pub price: u64, + } + impl ::prost::Name for MarketPrice { + const NAME: &'static str = "MarketPrice"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.MsgUpdateMarketPrices.MarketPrice".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.MsgUpdateMarketPrices.MarketPrice".into() + } + } +} +impl ::prost::Name for MsgUpdateMarketPrices { + const NAME: &'static str = "MsgUpdateMarketPrices"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.MsgUpdateMarketPrices".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.MsgUpdateMarketPrices".into() + } +} +/// MsgUpdateMarketPricesResponse defines the MsgUpdateMarketPrices response +/// type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateMarketPricesResponse {} +impl ::prost::Name for MsgUpdateMarketPricesResponse { + const NAME: &'static str = "MsgUpdateMarketPricesResponse"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.MsgUpdateMarketPricesResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.MsgUpdateMarketPricesResponse".into() + } +} +/// MsgUpdateMarketParam is a message used by x/gov for updating the parameters +/// of an oracle market. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateMarketParam { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// The market param to update. Each field must be set. + #[prost(message, optional, tag = "2")] + pub market_param: ::core::option::Option, +} +impl ::prost::Name for MsgUpdateMarketParam { + const NAME: &'static str = "MsgUpdateMarketParam"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.MsgUpdateMarketParam".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.MsgUpdateMarketParam".into() + } +} +/// MsgUpdateMarketParamResponse defines the UpdateMarketParam response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateMarketParamResponse {} +impl ::prost::Name for MsgUpdateMarketParamResponse { + const NAME: &'static str = "MsgUpdateMarketParamResponse"; + const PACKAGE: &'static str = "dydxprotocol.prices"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.prices.MsgUpdateMarketParamResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.prices.MsgUpdateMarketParamResponse".into() + } +} +/// Generated client implementations. +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// UpdateMarketPrices updates the oracle price of a market relative to + /// quoteCurrency. + pub async fn update_market_prices( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.prices.Msg/UpdateMarketPrices", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.prices.Msg", "UpdateMarketPrices"), + ); + self.inner.unary(req, path, codec).await + } + /// CreateOracleMarket creates a new oracle market. + pub async fn create_oracle_market( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.prices.Msg/CreateOracleMarket", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.prices.Msg", "CreateOracleMarket"), + ); + self.inner.unary(req, path, codec).await + } + /// UpdateMarketParams allows governance to update the parameters of an + /// oracle market. + pub async fn update_market_param( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.prices.Msg/UpdateMarketParam", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.prices.Msg", "UpdateMarketParam")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.ratelimit.rs b/v4-proto-rs/src/dydxprotocol.ratelimit.rs new file mode 100644 index 0000000000..d243ba3c70 --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.ratelimit.rs @@ -0,0 +1,557 @@ +// This file is @generated by prost-build. +/// LimitParams defines rate limit params on a denom. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LimitParams { + /// denom is the denomination of the token being rate limited. + /// e.g. ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5 + #[prost(string, tag = "1")] + pub denom: ::prost::alloc::string::String, + /// limiters is a list of rate-limiters on this denom. All limiters + /// must be satified for a withdrawal to proceed. + #[prost(message, repeated, tag = "2")] + pub limiters: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for LimitParams { + const NAME: &'static str = "LimitParams"; + const PACKAGE: &'static str = "dydxprotocol.ratelimit"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.ratelimit.LimitParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.ratelimit.LimitParams".into() + } +} +/// Limiter defines one rate-limiter on a specfic denom. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Limiter { + /// period is the rolling time period for which the limit applies + /// e.g. 3600 (an hour) + #[prost(message, optional, tag = "1")] + pub period: ::core::option::Option<::prost_types::Duration>, + /// baseline_minimum is the minimum maximum withdrawal coin amount within the + /// time period. + /// e.g. 100_000_000_000 uusdc for 100k USDC; 5e22 adv4tnt for 50k DV4TNT + #[prost(bytes = "vec", tag = "3")] + pub baseline_minimum: ::prost::alloc::vec::Vec, + /// baseline_tvl_ppm is the maximum ratio of TVL withdrawable in + /// the time period, in part-per-million. + /// e.g. 100_000 (10%) + #[prost(uint32, tag = "4")] + pub baseline_tvl_ppm: u32, +} +impl ::prost::Name for Limiter { + const NAME: &'static str = "Limiter"; + const PACKAGE: &'static str = "dydxprotocol.ratelimit"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.ratelimit.Limiter".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.ratelimit.Limiter".into() + } +} +/// DenomCapacity stores a list of rate limit capacity for a denom. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DenomCapacity { + /// denom is the denomination of the token being rate limited. + /// e.g. ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5 + #[prost(string, tag = "1")] + pub denom: ::prost::alloc::string::String, + /// capacity_list is a list of capacity amount tracked for each `Limiter` + /// on the denom. This list has a 1:1 mapping to `limiter` list under + /// `LimitParams`. + #[prost(bytes = "vec", repeated, tag = "2")] + pub capacity_list: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} +impl ::prost::Name for DenomCapacity { + const NAME: &'static str = "DenomCapacity"; + const PACKAGE: &'static str = "dydxprotocol.ratelimit"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.ratelimit.DenomCapacity".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.ratelimit.DenomCapacity".into() + } +} +/// LimiterCapacity contains a pair of limiter and its corresponding capacity. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LimiterCapacity { + #[prost(message, optional, tag = "1")] + pub limiter: ::core::option::Option, + #[prost(bytes = "vec", tag = "2")] + pub capacity: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for LimiterCapacity { + const NAME: &'static str = "LimiterCapacity"; + const PACKAGE: &'static str = "dydxprotocol.ratelimit"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.ratelimit.LimiterCapacity".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.ratelimit.LimiterCapacity".into() + } +} +/// GenesisState defines the ratelimit module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// limit_params_list defines the list of `LimitParams` at genesis. + #[prost(message, repeated, tag = "1")] + pub limit_params_list: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.ratelimit"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.ratelimit.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.ratelimit.GenesisState".into() + } +} +/// PendingSendPacket contains the channel_id and sequence pair to identify a +/// pending packet +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PendingSendPacket { + #[prost(string, tag = "1")] + pub channel_id: ::prost::alloc::string::String, + #[prost(uint64, tag = "2")] + pub sequence: u64, +} +impl ::prost::Name for PendingSendPacket { + const NAME: &'static str = "PendingSendPacket"; + const PACKAGE: &'static str = "dydxprotocol.ratelimit"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.ratelimit.PendingSendPacket".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.ratelimit.PendingSendPacket".into() + } +} +/// ListLimitParamsRequest is a request type of the ListLimitParams RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListLimitParamsRequest {} +impl ::prost::Name for ListLimitParamsRequest { + const NAME: &'static str = "ListLimitParamsRequest"; + const PACKAGE: &'static str = "dydxprotocol.ratelimit"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.ratelimit.ListLimitParamsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.ratelimit.ListLimitParamsRequest".into() + } +} +/// ListLimitParamsResponse is a response type of the ListLimitParams RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListLimitParamsResponse { + #[prost(message, repeated, tag = "1")] + pub limit_params_list: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for ListLimitParamsResponse { + const NAME: &'static str = "ListLimitParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.ratelimit"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.ratelimit.ListLimitParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.ratelimit.ListLimitParamsResponse".into() + } +} +/// QueryCapacityByDenomRequest is a request type for the CapacityByDenom RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryCapacityByDenomRequest { + #[prost(string, tag = "1")] + pub denom: ::prost::alloc::string::String, +} +impl ::prost::Name for QueryCapacityByDenomRequest { + const NAME: &'static str = "QueryCapacityByDenomRequest"; + const PACKAGE: &'static str = "dydxprotocol.ratelimit"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.ratelimit.QueryCapacityByDenomRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.ratelimit.QueryCapacityByDenomRequest".into() + } +} +/// QueryCapacityByDenomResponse is a response type of the CapacityByDenom RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryCapacityByDenomResponse { + #[prost(message, repeated, tag = "1")] + pub limiter_capacity_list: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for QueryCapacityByDenomResponse { + const NAME: &'static str = "QueryCapacityByDenomResponse"; + const PACKAGE: &'static str = "dydxprotocol.ratelimit"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.ratelimit.QueryCapacityByDenomResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.ratelimit.QueryCapacityByDenomResponse".into() + } +} +/// QueryAllPendingSendPacketsRequest is a request type for the +/// AllPendingSendPackets RPC +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllPendingSendPacketsRequest {} +impl ::prost::Name for QueryAllPendingSendPacketsRequest { + const NAME: &'static str = "QueryAllPendingSendPacketsRequest"; + const PACKAGE: &'static str = "dydxprotocol.ratelimit"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.ratelimit.QueryAllPendingSendPacketsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.ratelimit.QueryAllPendingSendPacketsRequest".into() + } +} +/// QueryAllPendingSendPacketsResponse is a response type of the +/// AllPendingSendPackets RPC +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllPendingSendPacketsResponse { + #[prost(message, repeated, tag = "1")] + pub pending_send_packets: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for QueryAllPendingSendPacketsResponse { + const NAME: &'static str = "QueryAllPendingSendPacketsResponse"; + const PACKAGE: &'static str = "dydxprotocol.ratelimit"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.ratelimit.QueryAllPendingSendPacketsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.ratelimit.QueryAllPendingSendPacketsResponse".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// List all limit params. + pub async fn list_limit_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.ratelimit.Query/ListLimitParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.ratelimit.Query", "ListLimitParams"), + ); + self.inner.unary(req, path, codec).await + } + /// Query capacity by denom. + pub async fn capacity_by_denom( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.ratelimit.Query/CapacityByDenom", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.ratelimit.Query", "CapacityByDenom"), + ); + self.inner.unary(req, path, codec).await + } + /// Get all pending send packets + pub async fn all_pending_send_packets( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.ratelimit.Query/AllPendingSendPackets", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.ratelimit.Query", + "AllPendingSendPackets", + ), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// MsgSetLimitParams is the Msg/SetLimitParams request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSetLimitParams { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// Defines the parameters to set. All parameters must be supplied. + #[prost(message, optional, tag = "2")] + pub limit_params: ::core::option::Option, +} +impl ::prost::Name for MsgSetLimitParams { + const NAME: &'static str = "MsgSetLimitParams"; + const PACKAGE: &'static str = "dydxprotocol.ratelimit"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.ratelimit.MsgSetLimitParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.ratelimit.MsgSetLimitParams".into() + } +} +/// MsgSetLimitParamsResponse is the Msg/SetLimitParams response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSetLimitParamsResponse {} +impl ::prost::Name for MsgSetLimitParamsResponse { + const NAME: &'static str = "MsgSetLimitParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.ratelimit"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.ratelimit.MsgSetLimitParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.ratelimit.MsgSetLimitParamsResponse".into() + } +} +/// Generated client implementations. +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// SetLimitParams sets a `LimitParams` object in state. + pub async fn set_limit_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.ratelimit.Msg/SetLimitParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.ratelimit.Msg", "SetLimitParams")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.rewards.rs b/v4-proto-rs/src/dydxprotocol.rewards.rs new file mode 100644 index 0000000000..ec3a05e69f --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.rewards.rs @@ -0,0 +1,366 @@ +// This file is @generated by prost-build. +/// Params defines the parameters for x/rewards module. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + /// The module account to distribute rewards from. + #[prost(string, tag = "1")] + pub treasury_account: ::prost::alloc::string::String, + /// The denom of the rewards token. + #[prost(string, tag = "2")] + pub denom: ::prost::alloc::string::String, + /// The exponent of converting one unit of `denom` to a full coin. + /// For example, `denom=uatom, denom_exponent=-6` defines that + /// `1 uatom = 10^(-6) ATOM`. This conversion is needed since the + /// `market_id` retrieves the price of a full coin of the reward token. + #[prost(sint32, tag = "3")] + pub denom_exponent: i32, + /// The id of the market that has the price of the rewards token. + #[prost(uint32, tag = "4")] + pub market_id: u32, + /// The amount (in ppm) that fees are multiplied by to get + /// the maximum rewards amount. + #[prost(uint32, tag = "5")] + pub fee_multiplier_ppm: u32, +} +impl ::prost::Name for Params { + const NAME: &'static str = "Params"; + const PACKAGE: &'static str = "dydxprotocol.rewards"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.rewards.Params".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.rewards.Params".into() + } +} +/// GenesisState defines the rewards module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// The parameters of the module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.rewards"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.rewards.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.rewards.GenesisState".into() + } +} +/// QueryParamsRequest is a request type for the Params RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +impl ::prost::Name for QueryParamsRequest { + const NAME: &'static str = "QueryParamsRequest"; + const PACKAGE: &'static str = "dydxprotocol.rewards"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.rewards.QueryParamsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.rewards.QueryParamsRequest".into() + } +} +/// QueryParamsResponse is a response type for the Params RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +impl ::prost::Name for QueryParamsResponse { + const NAME: &'static str = "QueryParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.rewards"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.rewards.QueryParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.rewards.QueryParamsResponse".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Queries the Params. + pub async fn params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.rewards.Query/Params", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.rewards.Query", "Params")); + self.inner.unary(req, path, codec).await + } + } +} +/// RewardShare stores the relative weight of rewards that each address is +/// entitled to. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RewardShare { + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "2")] + pub weight: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for RewardShare { + const NAME: &'static str = "RewardShare"; + const PACKAGE: &'static str = "dydxprotocol.rewards"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.rewards.RewardShare".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.rewards.RewardShare".into() + } +} +/// MsgUpdateParams is the Msg/UpdateParams request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParams { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// The parameters to update. Each field must be set. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +impl ::prost::Name for MsgUpdateParams { + const NAME: &'static str = "MsgUpdateParams"; + const PACKAGE: &'static str = "dydxprotocol.rewards"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.rewards.MsgUpdateParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.rewards.MsgUpdateParams".into() + } +} +/// MsgUpdateParamsResponse is the Msg/UpdateParams response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParamsResponse {} +impl ::prost::Name for MsgUpdateParamsResponse { + const NAME: &'static str = "MsgUpdateParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.rewards"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.rewards.MsgUpdateParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.rewards.MsgUpdateParamsResponse".into() + } +} +/// Generated client implementations. +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// UpdateParams updates the Params in state. + pub async fn update_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.rewards.Msg/UpdateParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.rewards.Msg", "UpdateParams")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.sending.rs b/v4-proto-rs/src/dydxprotocol.sending.rs new file mode 100644 index 0000000000..7a3bb775b0 --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.sending.rs @@ -0,0 +1,498 @@ +// This file is @generated by prost-build. +/// GenesisState defines the sending module's genesis state. +/// +/// this line is used by starport scaffolding # genesis/proto/state +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState {} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.sending"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.sending.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.sending.GenesisState".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + } +} +/// Transfer represents a single transfer between two subaccounts. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Transfer { + /// The sender subaccount ID. + #[prost(message, optional, tag = "1")] + pub sender: ::core::option::Option, + /// The recipient subaccount ID. + #[prost(message, optional, tag = "2")] + pub recipient: ::core::option::Option, + /// Id of the asset to transfer. + #[prost(uint32, tag = "3")] + pub asset_id: u32, + /// The amount of asset to transfer + #[prost(uint64, tag = "4")] + pub amount: u64, +} +impl ::prost::Name for Transfer { + const NAME: &'static str = "Transfer"; + const PACKAGE: &'static str = "dydxprotocol.sending"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.sending.Transfer".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.sending.Transfer".into() + } +} +/// MsgDepositToSubaccount represents a single transfer from an `x/bank` +/// account to an `x/subaccounts` subaccount. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgDepositToSubaccount { + /// The sender wallet address. + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + /// The recipient subaccount ID. + #[prost(message, optional, tag = "2")] + pub recipient: ::core::option::Option, + /// Id of the asset to transfer. + #[prost(uint32, tag = "3")] + pub asset_id: u32, + /// The number of quantums of asset to transfer. + #[prost(uint64, tag = "4")] + pub quantums: u64, +} +impl ::prost::Name for MsgDepositToSubaccount { + const NAME: &'static str = "MsgDepositToSubaccount"; + const PACKAGE: &'static str = "dydxprotocol.sending"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.sending.MsgDepositToSubaccount".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.sending.MsgDepositToSubaccount".into() + } +} +/// MsgWithdrawFromSubaccount represents a single transfer from an +/// `x/subaccounts` subaccount to an `x/bank` account. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgWithdrawFromSubaccount { + /// The sender subaccount ID. + #[prost(message, optional, tag = "2")] + pub sender: ::core::option::Option, + /// The recipient wallet address. + #[prost(string, tag = "1")] + pub recipient: ::prost::alloc::string::String, + /// Id of the asset to transfer. + #[prost(uint32, tag = "3")] + pub asset_id: u32, + /// The number of quantums of asset to transfer. + #[prost(uint64, tag = "4")] + pub quantums: u64, +} +impl ::prost::Name for MsgWithdrawFromSubaccount { + const NAME: &'static str = "MsgWithdrawFromSubaccount"; + const PACKAGE: &'static str = "dydxprotocol.sending"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.sending.MsgWithdrawFromSubaccount".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.sending.MsgWithdrawFromSubaccount".into() + } +} +/// MsgSendFromModuleToAccount represents a single transfer from a module +/// to an `x/bank` account (can be either a module account address or a user +/// account address). +/// Should only be executed by governance. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSendFromModuleToAccount { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// The sender module name. + #[prost(string, tag = "2")] + pub sender_module_name: ::prost::alloc::string::String, + /// The recipient account address (can be either a module account address + /// or a user account address). + #[prost(string, tag = "3")] + pub recipient: ::prost::alloc::string::String, + /// The coin to transfer, which specifies both denom and amount. + #[prost(message, optional, tag = "4")] + pub coin: ::core::option::Option, +} +impl ::prost::Name for MsgSendFromModuleToAccount { + const NAME: &'static str = "MsgSendFromModuleToAccount"; + const PACKAGE: &'static str = "dydxprotocol.sending"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.sending.MsgSendFromModuleToAccount".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.sending.MsgSendFromModuleToAccount".into() + } +} +/// MsgCreateTransfer is a request type used for initiating new transfers. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateTransfer { + #[prost(message, optional, tag = "1")] + pub transfer: ::core::option::Option, +} +impl ::prost::Name for MsgCreateTransfer { + const NAME: &'static str = "MsgCreateTransfer"; + const PACKAGE: &'static str = "dydxprotocol.sending"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.sending.MsgCreateTransfer".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.sending.MsgCreateTransfer".into() + } +} +/// MsgCreateTransferResponse is a response type used for new transfers. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateTransferResponse {} +impl ::prost::Name for MsgCreateTransferResponse { + const NAME: &'static str = "MsgCreateTransferResponse"; + const PACKAGE: &'static str = "dydxprotocol.sending"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.sending.MsgCreateTransferResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.sending.MsgCreateTransferResponse".into() + } +} +/// MsgDepositToSubaccountResponse is a response type used for new +/// account-to-subaccount transfers. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgDepositToSubaccountResponse {} +impl ::prost::Name for MsgDepositToSubaccountResponse { + const NAME: &'static str = "MsgDepositToSubaccountResponse"; + const PACKAGE: &'static str = "dydxprotocol.sending"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.sending.MsgDepositToSubaccountResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.sending.MsgDepositToSubaccountResponse".into() + } +} +/// MsgWithdrawFromSubaccountResponse is a response type used for new +/// subaccount-to-account transfers. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgWithdrawFromSubaccountResponse {} +impl ::prost::Name for MsgWithdrawFromSubaccountResponse { + const NAME: &'static str = "MsgWithdrawFromSubaccountResponse"; + const PACKAGE: &'static str = "dydxprotocol.sending"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.sending.MsgWithdrawFromSubaccountResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.sending.MsgWithdrawFromSubaccountResponse".into() + } +} +/// MsgSendFromModuleToAccountResponse is a response type used for new +/// module-to-account transfers. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSendFromModuleToAccountResponse {} +impl ::prost::Name for MsgSendFromModuleToAccountResponse { + const NAME: &'static str = "MsgSendFromModuleToAccountResponse"; + const PACKAGE: &'static str = "dydxprotocol.sending"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.sending.MsgSendFromModuleToAccountResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.sending.MsgSendFromModuleToAccountResponse".into() + } +} +/// Generated client implementations. +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// CreateTransfer initiates a new transfer between subaccounts. + pub async fn create_transfer( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.sending.Msg/CreateTransfer", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.sending.Msg", "CreateTransfer")); + self.inner.unary(req, path, codec).await + } + /// DepositToSubaccount initiates a new transfer from an `x/bank` account + /// to an `x/subaccounts` subaccount. + pub async fn deposit_to_subaccount( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.sending.Msg/DepositToSubaccount", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.sending.Msg", "DepositToSubaccount"), + ); + self.inner.unary(req, path, codec).await + } + /// WithdrawFromSubaccount initiates a new transfer from an `x/subaccounts` + /// subaccount to an `x/bank` account. + pub async fn withdraw_from_subaccount( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.sending.Msg/WithdrawFromSubaccount", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.sending.Msg", "WithdrawFromSubaccount"), + ); + self.inner.unary(req, path, codec).await + } + /// SendFromModuleToAccount initiates a new transfer from a module to an + /// `x/bank` account (should only be executed by governance). + pub async fn send_from_module_to_account( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.sending.Msg/SendFromModuleToAccount", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.sending.Msg", + "SendFromModuleToAccount", + ), + ); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.stats.rs b/v4-proto-rs/src/dydxprotocol.stats.rs new file mode 100644 index 0000000000..68ec458964 --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.stats.rs @@ -0,0 +1,651 @@ +// This file is @generated by prost-build. +/// Params defines the parameters for x/stats module. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + /// The desired number of seconds in the look-back window. + #[prost(message, optional, tag = "1")] + pub window_duration: ::core::option::Option<::prost_types::Duration>, +} +impl ::prost::Name for Params { + const NAME: &'static str = "Params"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.Params".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.Params".into() + } +} +/// GenesisState defines the stats module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// The parameters of the module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.GenesisState".into() + } +} +/// BlockStats is used to store stats transiently within the scope of a block. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockStats { + /// The fills that occured on this block. + #[prost(message, repeated, tag = "1")] + pub fills: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `BlockStats`. +pub mod block_stats { + /// Fill records data about a fill on this block. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Fill { + /// Taker wallet address + #[prost(string, tag = "1")] + pub taker: ::prost::alloc::string::String, + /// Maker wallet address + #[prost(string, tag = "2")] + pub maker: ::prost::alloc::string::String, + /// Notional USDC filled in quantums + #[prost(uint64, tag = "3")] + pub notional: u64, + } + impl ::prost::Name for Fill { + const NAME: &'static str = "Fill"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.BlockStats.Fill".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.BlockStats.Fill".into() + } + } +} +impl ::prost::Name for BlockStats { + const NAME: &'static str = "BlockStats"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.BlockStats".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.BlockStats".into() + } +} +/// StatsMetadata stores metadata for the x/stats module +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StatsMetadata { + /// The oldest epoch that is included in the stats. The next epoch to be + /// removed from the window. + #[prost(uint32, tag = "1")] + pub trailing_epoch: u32, +} +impl ::prost::Name for StatsMetadata { + const NAME: &'static str = "StatsMetadata"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.StatsMetadata".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.StatsMetadata".into() + } +} +/// EpochStats stores stats for a particular epoch +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EpochStats { + /// Epoch end time + #[prost(message, optional, tag = "1")] + pub epoch_end_time: ::core::option::Option<::prost_types::Timestamp>, + /// Stats for each user in this epoch. Sorted by user. + #[prost(message, repeated, tag = "2")] + pub stats: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `EpochStats`. +pub mod epoch_stats { + /// A user and its associated stats + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct UserWithStats { + #[prost(string, tag = "1")] + pub user: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub stats: ::core::option::Option, + } + impl ::prost::Name for UserWithStats { + const NAME: &'static str = "UserWithStats"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.EpochStats.UserWithStats".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.EpochStats.UserWithStats".into() + } + } +} +impl ::prost::Name for EpochStats { + const NAME: &'static str = "EpochStats"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.EpochStats".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.EpochStats".into() + } +} +/// GlobalStats stores global stats +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GlobalStats { + /// Notional USDC traded in quantums + #[prost(uint64, tag = "1")] + pub notional_traded: u64, +} +impl ::prost::Name for GlobalStats { + const NAME: &'static str = "GlobalStats"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.GlobalStats".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.GlobalStats".into() + } +} +/// UserStats stores stats for a User +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UserStats { + /// Taker USDC in quantums + #[prost(uint64, tag = "1")] + pub taker_notional: u64, + /// Maker USDC in quantums + #[prost(uint64, tag = "2")] + pub maker_notional: u64, +} +impl ::prost::Name for UserStats { + const NAME: &'static str = "UserStats"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.UserStats".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.UserStats".into() + } +} +/// QueryParamsRequest is a request type for the Params RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +impl ::prost::Name for QueryParamsRequest { + const NAME: &'static str = "QueryParamsRequest"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.QueryParamsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.QueryParamsRequest".into() + } +} +/// QueryParamsResponse is a response type for the Params RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +impl ::prost::Name for QueryParamsResponse { + const NAME: &'static str = "QueryParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.QueryParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.QueryParamsResponse".into() + } +} +/// QueryStatsMetadataRequest is a request type for the StatsMetadata RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryStatsMetadataRequest {} +impl ::prost::Name for QueryStatsMetadataRequest { + const NAME: &'static str = "QueryStatsMetadataRequest"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.QueryStatsMetadataRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.QueryStatsMetadataRequest".into() + } +} +/// QueryStatsMetadataResponse is a response type for the StatsMetadata RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryStatsMetadataResponse { + #[prost(message, optional, tag = "1")] + pub metadata: ::core::option::Option, +} +impl ::prost::Name for QueryStatsMetadataResponse { + const NAME: &'static str = "QueryStatsMetadataResponse"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.QueryStatsMetadataResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.QueryStatsMetadataResponse".into() + } +} +/// QueryGlobalStatsRequest is a request type for the GlobalStats RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGlobalStatsRequest {} +impl ::prost::Name for QueryGlobalStatsRequest { + const NAME: &'static str = "QueryGlobalStatsRequest"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.QueryGlobalStatsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.QueryGlobalStatsRequest".into() + } +} +/// QueryGlobalStatsResponse is a response type for the GlobalStats RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGlobalStatsResponse { + #[prost(message, optional, tag = "1")] + pub stats: ::core::option::Option, +} +impl ::prost::Name for QueryGlobalStatsResponse { + const NAME: &'static str = "QueryGlobalStatsResponse"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.QueryGlobalStatsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.QueryGlobalStatsResponse".into() + } +} +/// QueryUserStatsRequest is a request type for the UserStats RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryUserStatsRequest { + #[prost(string, tag = "1")] + pub user: ::prost::alloc::string::String, +} +impl ::prost::Name for QueryUserStatsRequest { + const NAME: &'static str = "QueryUserStatsRequest"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.QueryUserStatsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.QueryUserStatsRequest".into() + } +} +/// QueryUserStatsResponse is a request type for the UserStats RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryUserStatsResponse { + #[prost(message, optional, tag = "1")] + pub stats: ::core::option::Option, +} +impl ::prost::Name for QueryUserStatsResponse { + const NAME: &'static str = "QueryUserStatsResponse"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.QueryUserStatsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.QueryUserStatsResponse".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Queries the Params. + pub async fn params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.stats.Query/Params", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.stats.Query", "Params")); + self.inner.unary(req, path, codec).await + } + /// Queries StatsMetadata. + pub async fn stats_metadata( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.stats.Query/StatsMetadata", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.stats.Query", "StatsMetadata")); + self.inner.unary(req, path, codec).await + } + /// Queries GlobalStats. + pub async fn global_stats( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.stats.Query/GlobalStats", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.stats.Query", "GlobalStats")); + self.inner.unary(req, path, codec).await + } + /// Queries UserStats. + pub async fn user_stats( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.stats.Query/UserStats", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.stats.Query", "UserStats")); + self.inner.unary(req, path, codec).await + } + } +} +/// MsgUpdateParams is the Msg/UpdateParams request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParams { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// The parameters to update. Each field must be set. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +impl ::prost::Name for MsgUpdateParams { + const NAME: &'static str = "MsgUpdateParams"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.MsgUpdateParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.MsgUpdateParams".into() + } +} +/// MsgUpdateParamsResponse is the Msg/UpdateParams response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParamsResponse {} +impl ::prost::Name for MsgUpdateParamsResponse { + const NAME: &'static str = "MsgUpdateParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.stats"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.stats.MsgUpdateParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.stats.MsgUpdateParamsResponse".into() + } +} +/// Generated client implementations. +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// UpdateParams updates the Params in state. + pub async fn update_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.stats.Msg/UpdateParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.stats.Msg", "UpdateParams")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.subaccounts.rs b/v4-proto-rs/src/dydxprotocol.subaccounts.rs new file mode 100644 index 0000000000..f08f01ff77 --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.subaccounts.rs @@ -0,0 +1,490 @@ +// This file is @generated by prost-build. +/// AssetPositions define an account’s positions of an `Asset`. +/// Therefore they hold any information needed to trade on Spot and Margin. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AssetPosition { + /// The `Id` of the `Asset`. + #[prost(uint32, tag = "1")] + pub asset_id: u32, + /// The absolute size of the position in base quantums. + #[prost(bytes = "vec", tag = "2")] + pub quantums: ::prost::alloc::vec::Vec, + /// The `Index` (either `LongIndex` or `ShortIndex`) of the `Asset` the last + /// time this position was settled + /// TODO(DEC-582): pending margin trading being added. + #[prost(uint64, tag = "3")] + pub index: u64, +} +impl ::prost::Name for AssetPosition { + const NAME: &'static str = "AssetPosition"; + const PACKAGE: &'static str = "dydxprotocol.subaccounts"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.subaccounts.AssetPosition".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.subaccounts.AssetPosition".into() + } +} +/// PerpetualPositions are an account’s positions of a `Perpetual`. +/// Therefore they hold any information needed to trade perpetuals. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PerpetualPosition { + /// The `Id` of the `Perpetual`. + #[prost(uint32, tag = "1")] + pub perpetual_id: u32, + /// The size of the position in base quantums. + #[prost(bytes = "vec", tag = "2")] + pub quantums: ::prost::alloc::vec::Vec, + /// The funding_index of the `Perpetual` the last time this position was + /// settled. + #[prost(bytes = "vec", tag = "3")] + pub funding_index: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for PerpetualPosition { + const NAME: &'static str = "PerpetualPosition"; + const PACKAGE: &'static str = "dydxprotocol.subaccounts"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.subaccounts.PerpetualPosition".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.subaccounts.PerpetualPosition".into() + } +} +/// SubaccountId defines a unique identifier for a Subaccount. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SubaccountId { + /// The address of the wallet that owns this subaccount. + #[prost(string, tag = "1")] + pub owner: ::prost::alloc::string::String, + /// The unique number of this subaccount for the owner. + /// Currently limited to 128*1000 subaccounts per owner. + #[prost(uint32, tag = "2")] + pub number: u32, +} +impl ::prost::Name for SubaccountId { + const NAME: &'static str = "SubaccountId"; + const PACKAGE: &'static str = "dydxprotocol.subaccounts"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.subaccounts.SubaccountId".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.subaccounts.SubaccountId".into() + } +} +/// Subaccount defines a single sub-account for a given address. +/// Subaccounts are uniquely indexed by a subaccountNumber/owner pair. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Subaccount { + /// The Id of the Subaccount + #[prost(message, optional, tag = "1")] + pub id: ::core::option::Option, + /// All `AssetPosition`s associated with this subaccount. + /// Always sorted ascending by `asset_id`. + #[prost(message, repeated, tag = "2")] + pub asset_positions: ::prost::alloc::vec::Vec, + /// All `PerpetualPosition`s associated with this subaccount. + /// Always sorted ascending by `perpetual_id. + #[prost(message, repeated, tag = "3")] + pub perpetual_positions: ::prost::alloc::vec::Vec, + /// Set by the owner. If true, then margin trades can be made in this + /// subaccount. + #[prost(bool, tag = "4")] + pub margin_enabled: bool, +} +impl ::prost::Name for Subaccount { + const NAME: &'static str = "Subaccount"; + const PACKAGE: &'static str = "dydxprotocol.subaccounts"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.subaccounts.Subaccount".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.subaccounts.Subaccount".into() + } +} +/// GenesisState defines the subaccounts module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, repeated, tag = "1")] + pub subaccounts: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.subaccounts"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.subaccounts.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.subaccounts.GenesisState".into() + } +} +/// QueryGetSubaccountRequest is request type for the Query RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetSubaccountRequest { + #[prost(string, tag = "1")] + pub owner: ::prost::alloc::string::String, + #[prost(uint32, tag = "2")] + pub number: u32, +} +impl ::prost::Name for QueryGetSubaccountRequest { + const NAME: &'static str = "QueryGetSubaccountRequest"; + const PACKAGE: &'static str = "dydxprotocol.subaccounts"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.subaccounts.QueryGetSubaccountRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.subaccounts.QueryGetSubaccountRequest".into() + } +} +/// QuerySubaccountResponse is response type for the Query RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySubaccountResponse { + #[prost(message, optional, tag = "1")] + pub subaccount: ::core::option::Option, +} +impl ::prost::Name for QuerySubaccountResponse { + const NAME: &'static str = "QuerySubaccountResponse"; + const PACKAGE: &'static str = "dydxprotocol.subaccounts"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.subaccounts.QuerySubaccountResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.subaccounts.QuerySubaccountResponse".into() + } +} +/// QueryAllSubaccountRequest is request type for the Query RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllSubaccountRequest { + #[prost(message, optional, tag = "1")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageRequest, + >, +} +impl ::prost::Name for QueryAllSubaccountRequest { + const NAME: &'static str = "QueryAllSubaccountRequest"; + const PACKAGE: &'static str = "dydxprotocol.subaccounts"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.subaccounts.QueryAllSubaccountRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.subaccounts.QueryAllSubaccountRequest".into() + } +} +/// QuerySubaccountAllResponse is response type for the Query RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySubaccountAllResponse { + #[prost(message, repeated, tag = "1")] + pub subaccount: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageResponse, + >, +} +impl ::prost::Name for QuerySubaccountAllResponse { + const NAME: &'static str = "QuerySubaccountAllResponse"; + const PACKAGE: &'static str = "dydxprotocol.subaccounts"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.subaccounts.QuerySubaccountAllResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.subaccounts.QuerySubaccountAllResponse".into() + } +} +/// QueryGetWithdrawalAndTransfersBlockedInfoRequest is a request type for +/// fetching information about whether withdrawals and transfers are blocked for +/// a collateral pool associated with the passed in perpetual id. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetWithdrawalAndTransfersBlockedInfoRequest { + #[prost(uint32, tag = "1")] + pub perpetual_id: u32, +} +impl ::prost::Name for QueryGetWithdrawalAndTransfersBlockedInfoRequest { + const NAME: &'static str = "QueryGetWithdrawalAndTransfersBlockedInfoRequest"; + const PACKAGE: &'static str = "dydxprotocol.subaccounts"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.subaccounts.QueryGetWithdrawalAndTransfersBlockedInfoRequest" + .into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.subaccounts.QueryGetWithdrawalAndTransfersBlockedInfoRequest" + .into() + } +} +/// QueryGetWithdrawalAndTransfersBlockedInfoRequest is a response type for +/// fetching information about whether withdrawals and transfers are blocked. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetWithdrawalAndTransfersBlockedInfoResponse { + #[prost(uint32, tag = "1")] + pub negative_tnc_subaccount_seen_at_block: u32, + #[prost(uint32, tag = "2")] + pub chain_outage_seen_at_block: u32, + #[prost(uint32, tag = "3")] + pub withdrawals_and_transfers_unblocked_at_block: u32, +} +impl ::prost::Name for QueryGetWithdrawalAndTransfersBlockedInfoResponse { + const NAME: &'static str = "QueryGetWithdrawalAndTransfersBlockedInfoResponse"; + const PACKAGE: &'static str = "dydxprotocol.subaccounts"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.subaccounts.QueryGetWithdrawalAndTransfersBlockedInfoResponse" + .into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.subaccounts.QueryGetWithdrawalAndTransfersBlockedInfoResponse" + .into() + } +} +/// QueryCollateralPoolAddressRequest is the request type for fetching the +/// account address of the collateral pool associated with the passed in +/// perpetual id. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryCollateralPoolAddressRequest { + #[prost(uint32, tag = "1")] + pub perpetual_id: u32, +} +impl ::prost::Name for QueryCollateralPoolAddressRequest { + const NAME: &'static str = "QueryCollateralPoolAddressRequest"; + const PACKAGE: &'static str = "dydxprotocol.subaccounts"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.subaccounts.QueryCollateralPoolAddressRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.subaccounts.QueryCollateralPoolAddressRequest".into() + } +} +/// QueryCollateralPoolAddressResponse is a response type for fetching the +/// account address of the collateral pool associated with the passed in +/// perpetual id. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryCollateralPoolAddressResponse { + #[prost(string, tag = "1")] + pub collateral_pool_address: ::prost::alloc::string::String, +} +impl ::prost::Name for QueryCollateralPoolAddressResponse { + const NAME: &'static str = "QueryCollateralPoolAddressResponse"; + const PACKAGE: &'static str = "dydxprotocol.subaccounts"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.subaccounts.QueryCollateralPoolAddressResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.subaccounts.QueryCollateralPoolAddressResponse".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Queries a Subaccount by id + pub async fn subaccount( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.subaccounts.Query/Subaccount", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.subaccounts.Query", "Subaccount")); + self.inner.unary(req, path, codec).await + } + /// Queries a list of Subaccount items. + pub async fn subaccount_all( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.subaccounts.Query/SubaccountAll", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("dydxprotocol.subaccounts.Query", "SubaccountAll"), + ); + self.inner.unary(req, path, codec).await + } + /// Queries information about whether withdrawal and transfers are blocked, and + /// if so which block they are re-enabled on. + pub async fn get_withdrawal_and_transfers_blocked_info( + &mut self, + request: impl tonic::IntoRequest< + super::QueryGetWithdrawalAndTransfersBlockedInfoRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.subaccounts.Query/GetWithdrawalAndTransfersBlockedInfo", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.subaccounts.Query", + "GetWithdrawalAndTransfersBlockedInfo", + ), + ); + self.inner.unary(req, path, codec).await + } + /// Queries the collateral pool account address for a perpetual id. + pub async fn collateral_pool_address( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.subaccounts.Query/CollateralPoolAddress", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "dydxprotocol.subaccounts.Query", + "CollateralPoolAddress", + ), + ); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.vault.rs b/v4-proto-rs/src/dydxprotocol.vault.rs new file mode 100644 index 0000000000..9cf8e3d256 --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.vault.rs @@ -0,0 +1,711 @@ +// This file is @generated by prost-build. +/// Params stores `x/vault` parameters. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + /// The number of layers of orders a vault places. For example if + /// `layers=2`, a vault places 2 asks and 2 bids. + #[prost(uint32, tag = "1")] + pub layers: u32, + /// The minimum base spread when a vault quotes around reservation price. + #[prost(uint32, tag = "2")] + pub spread_min_ppm: u32, + /// The buffer amount to add to min_price_change_ppm to arrive at `spread` + /// according to formula: + /// `spread = max(spread_min_ppm, min_price_change_ppm + spread_buffer_ppm)`. + #[prost(uint32, tag = "3")] + pub spread_buffer_ppm: u32, + /// The factor that determines how aggressive a vault skews its orders. + #[prost(uint32, tag = "4")] + pub skew_factor_ppm: u32, + /// The percentage of vault equity that each order is sized at. + #[prost(uint32, tag = "5")] + pub order_size_pct_ppm: u32, + /// The duration that a vault's orders are valid for. + #[prost(uint32, tag = "6")] + pub order_expiration_seconds: u32, + /// The number of quote quantums in quote asset that a vault with no perpetual + /// positions must have to activate, i.e. if a vault has no perpetual positions + /// and has strictly less than this amount of quote asset, it will not + /// activate. + #[prost(bytes = "vec", tag = "7")] + pub activation_threshold_quote_quantums: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for Params { + const NAME: &'static str = "Params"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.Params".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.Params".into() + } +} +/// GenesisState defines `x/vault`'s genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// The parameters of the module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.GenesisState".into() + } +} +/// VaultId uniquely identifies a vault by its type and number. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VaultId { + /// Type of the vault. + #[prost(enumeration = "VaultType", tag = "1")] + pub r#type: i32, + /// Unique ID of the vault within above type. + #[prost(uint32, tag = "2")] + pub number: u32, +} +impl ::prost::Name for VaultId { + const NAME: &'static str = "VaultId"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.VaultId".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.VaultId".into() + } +} +/// NumShares represents the number of shares in a vault. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NumShares { + /// Number of shares. + #[prost(bytes = "vec", tag = "2")] + pub num_shares: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for NumShares { + const NAME: &'static str = "NumShares"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.NumShares".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.NumShares".into() + } +} +/// VaultType represents different types of vaults. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum VaultType { + /// Default value, invalid and unused. + Unspecified = 0, + /// Vault is associated with a CLOB pair. + Clob = 1, +} +impl VaultType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + VaultType::Unspecified => "VAULT_TYPE_UNSPECIFIED", + VaultType::Clob => "VAULT_TYPE_CLOB", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "VAULT_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "VAULT_TYPE_CLOB" => Some(Self::Clob), + _ => None, + } + } +} +/// QueryParamsRequest is a request type for the Params RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +impl ::prost::Name for QueryParamsRequest { + const NAME: &'static str = "QueryParamsRequest"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.QueryParamsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.QueryParamsRequest".into() + } +} +/// QueryParamsResponse is a response type for the Params RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +impl ::prost::Name for QueryParamsResponse { + const NAME: &'static str = "QueryParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.QueryParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.QueryParamsResponse".into() + } +} +/// QueryVaultRequest is a request type for the Vault RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryVaultRequest { + #[prost(enumeration = "VaultType", tag = "1")] + pub r#type: i32, + #[prost(uint32, tag = "2")] + pub number: u32, +} +impl ::prost::Name for QueryVaultRequest { + const NAME: &'static str = "QueryVaultRequest"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.QueryVaultRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.QueryVaultRequest".into() + } +} +/// QueryVaultResponse is a response type for the Vault RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryVaultResponse { + #[prost(message, optional, tag = "1")] + pub vault_id: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub subaccount_id: ::core::option::Option, + #[prost(uint64, tag = "3")] + pub equity: u64, + #[prost(uint64, tag = "4")] + pub inventory: u64, + #[prost(uint64, tag = "5")] + pub total_shares: u64, +} +impl ::prost::Name for QueryVaultResponse { + const NAME: &'static str = "QueryVaultResponse"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.QueryVaultResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.QueryVaultResponse".into() + } +} +/// QueryAllVaultsRequest is a request type for the AllVaults RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllVaultsRequest { + #[prost(message, optional, tag = "1")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageRequest, + >, +} +impl ::prost::Name for QueryAllVaultsRequest { + const NAME: &'static str = "QueryAllVaultsRequest"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.QueryAllVaultsRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.QueryAllVaultsRequest".into() + } +} +/// QueryAllVaultsResponse is a response type for the AllVaults RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllVaultsResponse { + #[prost(message, repeated, tag = "1")] + pub vaults: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageResponse, + >, +} +impl ::prost::Name for QueryAllVaultsResponse { + const NAME: &'static str = "QueryAllVaultsResponse"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.QueryAllVaultsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.QueryAllVaultsResponse".into() + } +} +/// QueryOwnerSharesRequest is a request type for the OwnerShares RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryOwnerSharesRequest { + #[prost(enumeration = "VaultType", tag = "1")] + pub r#type: i32, + #[prost(uint32, tag = "2")] + pub number: u32, + #[prost(message, optional, tag = "3")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageRequest, + >, +} +impl ::prost::Name for QueryOwnerSharesRequest { + const NAME: &'static str = "QueryOwnerSharesRequest"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.QueryOwnerSharesRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.QueryOwnerSharesRequest".into() + } +} +/// OwnerShare is a type for owner shares in a vault. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OwnerShare { + #[prost(string, tag = "1")] + pub owner: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub shares: ::core::option::Option, +} +impl ::prost::Name for OwnerShare { + const NAME: &'static str = "OwnerShare"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.OwnerShare".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.OwnerShare".into() + } +} +/// QueryOwnerSharesResponse is a response type for the OwnerShares RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryOwnerSharesResponse { + #[prost(message, repeated, tag = "1")] + pub owner_shares: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::cosmos::base::query::v1beta1::PageResponse, + >, +} +impl ::prost::Name for QueryOwnerSharesResponse { + const NAME: &'static str = "QueryOwnerSharesResponse"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.QueryOwnerSharesResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.QueryOwnerSharesResponse".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Queries the Params. + pub async fn params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.vault.Query/Params", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.vault.Query", "Params")); + self.inner.unary(req, path, codec).await + } + /// Queries a Vault by type and number. + pub async fn vault( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.vault.Query/Vault", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.vault.Query", "Vault")); + self.inner.unary(req, path, codec).await + } + /// Queries all vaults. + pub async fn all_vaults( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.vault.Query/AllVaults", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.vault.Query", "AllVaults")); + self.inner.unary(req, path, codec).await + } + /// Queries owner shares of a vault. + pub async fn owner_shares( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.vault.Query/OwnerShares", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.vault.Query", "OwnerShares")); + self.inner.unary(req, path, codec).await + } + } +} +/// MsgDepositToVault is the Msg/DepositToVault request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgDepositToVault { + /// The vault to deposit into. + #[prost(message, optional, tag = "1")] + pub vault_id: ::core::option::Option, + /// The subaccount to deposit from. + #[prost(message, optional, tag = "2")] + pub subaccount_id: ::core::option::Option, + /// Number of quote quantums to deposit. + #[prost(bytes = "vec", tag = "3")] + pub quote_quantums: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for MsgDepositToVault { + const NAME: &'static str = "MsgDepositToVault"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.MsgDepositToVault".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.MsgDepositToVault".into() + } +} +/// MsgDepositToVaultResponse is the Msg/DepositToVault response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgDepositToVaultResponse {} +impl ::prost::Name for MsgDepositToVaultResponse { + const NAME: &'static str = "MsgDepositToVaultResponse"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.MsgDepositToVaultResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.MsgDepositToVaultResponse".into() + } +} +/// MsgUpdateParams is the Msg/UpdateParams request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParams { + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// The parameters to update. Each field must be set. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +impl ::prost::Name for MsgUpdateParams { + const NAME: &'static str = "MsgUpdateParams"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.MsgUpdateParams".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.MsgUpdateParams".into() + } +} +/// MsgUpdateParamsResponse is the Msg/UpdateParams response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParamsResponse {} +impl ::prost::Name for MsgUpdateParamsResponse { + const NAME: &'static str = "MsgUpdateParamsResponse"; + const PACKAGE: &'static str = "dydxprotocol.vault"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vault.MsgUpdateParamsResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vault.MsgUpdateParamsResponse".into() + } +} +/// Generated client implementations. +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// DepositToVault deposits funds into a vault. + pub async fn deposit_to_vault( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.vault.Msg/DepositToVault", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.vault.Msg", "DepositToVault")); + self.inner.unary(req, path, codec).await + } + /// UpdateParams updates the Params in state. + pub async fn update_params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.vault.Msg/UpdateParams", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.vault.Msg", "UpdateParams")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/dydxprotocol.vest.rs b/v4-proto-rs/src/dydxprotocol.vest.rs new file mode 100644 index 0000000000..f875d24e7d --- /dev/null +++ b/v4-proto-rs/src/dydxprotocol.vest.rs @@ -0,0 +1,410 @@ +// This file is @generated by prost-build. +/// VestEntry specifies a Vester Account and the rate at which tokens are +/// dripped into the corresponding Treasury Account. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VestEntry { + /// The module account to vest tokens from. + /// This is also the key to this `VestEntry` in state. + #[prost(string, tag = "1")] + pub vester_account: ::prost::alloc::string::String, + /// The module account to vest tokens to. + #[prost(string, tag = "2")] + pub treasury_account: ::prost::alloc::string::String, + /// The denom of the token to vest. + #[prost(string, tag = "3")] + pub denom: ::prost::alloc::string::String, + /// The start time of vest. Before this time, no vest will occur. + #[prost(message, optional, tag = "4")] + pub start_time: ::core::option::Option<::prost_types::Timestamp>, + /// The end time of vest. At this target date, all funds should be in the + /// Treasury Account and none left in the Vester Account. + #[prost(message, optional, tag = "5")] + pub end_time: ::core::option::Option<::prost_types::Timestamp>, +} +impl ::prost::Name for VestEntry { + const NAME: &'static str = "VestEntry"; + const PACKAGE: &'static str = "dydxprotocol.vest"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vest.VestEntry".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vest.VestEntry".into() + } +} +/// GenesisState defines the vest module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// The vest entries at genesis. + #[prost(message, repeated, tag = "1")] + pub vest_entries: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for GenesisState { + const NAME: &'static str = "GenesisState"; + const PACKAGE: &'static str = "dydxprotocol.vest"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vest.GenesisState".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vest.GenesisState".into() + } +} +/// QueryVestEntryRequest is a request type for the VestEntry RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryVestEntryRequest { + #[prost(string, tag = "1")] + pub vester_account: ::prost::alloc::string::String, +} +impl ::prost::Name for QueryVestEntryRequest { + const NAME: &'static str = "QueryVestEntryRequest"; + const PACKAGE: &'static str = "dydxprotocol.vest"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vest.QueryVestEntryRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vest.QueryVestEntryRequest".into() + } +} +/// QueryVestEntryResponse is a response type for the VestEntry RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryVestEntryResponse { + #[prost(message, optional, tag = "1")] + pub entry: ::core::option::Option, +} +impl ::prost::Name for QueryVestEntryResponse { + const NAME: &'static str = "QueryVestEntryResponse"; + const PACKAGE: &'static str = "dydxprotocol.vest"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vest.QueryVestEntryResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vest.QueryVestEntryResponse".into() + } +} +/// Generated client implementations. +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Queries the VestEntry. + pub async fn vest_entry( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.vest.Query/VestEntry", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.vest.Query", "VestEntry")); + self.inner.unary(req, path, codec).await + } + } +} +/// MsgDeleteVestEntry is the Msg/DeleteVestEntry request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgDeleteVestEntry { + /// authority is the address that controls the module. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// The vester account of the vest entry to delete. + #[prost(string, tag = "2")] + pub vester_account: ::prost::alloc::string::String, +} +impl ::prost::Name for MsgDeleteVestEntry { + const NAME: &'static str = "MsgDeleteVestEntry"; + const PACKAGE: &'static str = "dydxprotocol.vest"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vest.MsgDeleteVestEntry".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vest.MsgDeleteVestEntry".into() + } +} +/// MsgDeleteVestEntryResponse is the Msg/DeleteVestEntry response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgDeleteVestEntryResponse {} +impl ::prost::Name for MsgDeleteVestEntryResponse { + const NAME: &'static str = "MsgDeleteVestEntryResponse"; + const PACKAGE: &'static str = "dydxprotocol.vest"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vest.MsgDeleteVestEntryResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vest.MsgDeleteVestEntryResponse".into() + } +} +/// MsgSetVestEntry is the Msg/SetVestEntry request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSetVestEntry { + /// authority is the address that controls the module. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// The vest entry to set. + #[prost(message, optional, tag = "2")] + pub entry: ::core::option::Option, +} +impl ::prost::Name for MsgSetVestEntry { + const NAME: &'static str = "MsgSetVestEntry"; + const PACKAGE: &'static str = "dydxprotocol.vest"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vest.MsgSetVestEntry".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vest.MsgSetVestEntry".into() + } +} +/// MsgSetVestEntryResponse is the Msg/SetVestEntry response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSetVestEntryResponse {} +impl ::prost::Name for MsgSetVestEntryResponse { + const NAME: &'static str = "MsgSetVestEntryResponse"; + const PACKAGE: &'static str = "dydxprotocol.vest"; + fn full_name() -> ::prost::alloc::string::String { + "dydxprotocol.vest.MsgSetVestEntryResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/dydxprotocol.vest.MsgSetVestEntryResponse".into() + } +} +/// Generated client implementations. +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// SetVestEntry sets a VestEntry in state. + pub async fn set_vest_entry( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.vest.Msg/SetVestEntry", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.vest.Msg", "SetVestEntry")); + self.inner.unary(req, path, codec).await + } + /// DeleteVestEntry deletes a VestEntry from state. + pub async fn delete_vest_entry( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/dydxprotocol.vest.Msg/DeleteVestEntry", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("dydxprotocol.vest.Msg", "DeleteVestEntry")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/v4-proto-rs/src/google.api.rs b/v4-proto-rs/src/google.api.rs new file mode 100644 index 0000000000..08318f49cf --- /dev/null +++ b/v4-proto-rs/src/google.api.rs @@ -0,0 +1,402 @@ +// This file is @generated by prost-build. +/// Defines the HTTP configuration for an API service. It contains a list of +/// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method +/// to one or more HTTP REST API methods. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Http { + /// A list of HTTP configuration rules that apply to individual API methods. + /// + /// **NOTE:** All service configuration rules follow "last one wins" order. + #[prost(message, repeated, tag = "1")] + pub rules: ::prost::alloc::vec::Vec, + /// When set to true, URL path parameters will be fully URI-decoded except in + /// cases of single segment matches in reserved expansion, where "%2F" will be + /// left encoded. + /// + /// The default behavior is to not decode RFC 6570 reserved characters in multi + /// segment matches. + #[prost(bool, tag = "2")] + pub fully_decode_reserved_expansion: bool, +} +impl ::prost::Name for Http { + const NAME: &'static str = "Http"; + const PACKAGE: &'static str = "google.api"; + fn full_name() -> ::prost::alloc::string::String { + "google.api.Http".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/google.api.Http".into() + } +} +/// # gRPC Transcoding +/// +/// gRPC Transcoding is a feature for mapping between a gRPC method and one or +/// more HTTP REST endpoints. It allows developers to build a single API service +/// that supports both gRPC APIs and REST APIs. Many systems, including [Google +/// APIs](), +/// [Cloud Endpoints](), [gRPC +/// Gateway](), +/// and [Envoy]() proxy support this feature +/// and use it for large scale production services. +/// +/// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies +/// how different portions of the gRPC request message are mapped to the URL +/// path, URL query parameters, and HTTP request body. It also controls how the +/// gRPC response message is mapped to the HTTP response body. `HttpRule` is +/// typically specified as an `google.api.http` annotation on the gRPC method. +/// +/// Each mapping specifies a URL path template and an HTTP method. The path +/// template may refer to one or more fields in the gRPC request message, as long +/// as each field is a non-repeated field with a primitive (non-message) type. +/// The path template controls how fields of the request message are mapped to +/// the URL path. +/// +/// Example: +/// +/// service Messaging { +/// rpc GetMessage(GetMessageRequest) returns (Message) { +/// option (google.api.http) = { +/// get: "/v1/{name=messages/*}" +/// }; +/// } +/// } +/// message GetMessageRequest { +/// string name = 1; // Mapped to URL path. +/// } +/// message Message { +/// string text = 1; // The resource content. +/// } +/// +/// This enables an HTTP REST to gRPC mapping as below: +/// +/// HTTP | gRPC +/// -----|----- +/// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` +/// +/// Any fields in the request message which are not bound by the path template +/// automatically become HTTP query parameters if there is no HTTP request body. +/// For example: +/// +/// service Messaging { +/// rpc GetMessage(GetMessageRequest) returns (Message) { +/// option (google.api.http) = { +/// get:"/v1/messages/{message_id}" +/// }; +/// } +/// } +/// message GetMessageRequest { +/// message SubMessage { +/// string subfield = 1; +/// } +/// string message_id = 1; // Mapped to URL path. +/// int64 revision = 2; // Mapped to URL query parameter `revision`. +/// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. +/// } +/// +/// This enables a HTTP JSON to RPC mapping as below: +/// +/// HTTP | gRPC +/// -----|----- +/// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | +/// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: +/// "foo"))` +/// +/// Note that fields which are mapped to URL query parameters must have a +/// primitive type or a repeated primitive type or a non-repeated message type. +/// In the case of a repeated type, the parameter can be repeated in the URL +/// as `...?param=A¶m=B`. In the case of a message type, each field of the +/// message is mapped to a separate parameter, such as +/// `...?foo.a=A&foo.b=B&foo.c=C`. +/// +/// For HTTP methods that allow a request body, the `body` field +/// specifies the mapping. Consider a REST update method on the +/// message resource collection: +/// +/// service Messaging { +/// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { +/// option (google.api.http) = { +/// patch: "/v1/messages/{message_id}" +/// body: "message" +/// }; +/// } +/// } +/// message UpdateMessageRequest { +/// string message_id = 1; // mapped to the URL +/// Message message = 2; // mapped to the body +/// } +/// +/// The following HTTP JSON to RPC mapping is enabled, where the +/// representation of the JSON in the request body is determined by +/// protos JSON encoding: +/// +/// HTTP | gRPC +/// -----|----- +/// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: +/// "123456" message { text: "Hi!" })` +/// +/// The special name `*` can be used in the body mapping to define that +/// every field not bound by the path template should be mapped to the +/// request body. This enables the following alternative definition of +/// the update method: +/// +/// service Messaging { +/// rpc UpdateMessage(Message) returns (Message) { +/// option (google.api.http) = { +/// patch: "/v1/messages/{message_id}" +/// body: "*" +/// }; +/// } +/// } +/// message Message { +/// string message_id = 1; +/// string text = 2; +/// } +/// +/// +/// The following HTTP JSON to RPC mapping is enabled: +/// +/// HTTP | gRPC +/// -----|----- +/// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: +/// "123456" text: "Hi!")` +/// +/// Note that when using `*` in the body mapping, it is not possible to +/// have HTTP parameters, as all fields not bound by the path end in +/// the body. This makes this option more rarely used in practice when +/// defining REST APIs. The common usage of `*` is in custom methods +/// which don't use the URL at all for transferring data. +/// +/// It is possible to define multiple HTTP methods for one RPC by using +/// the `additional_bindings` option. Example: +/// +/// service Messaging { +/// rpc GetMessage(GetMessageRequest) returns (Message) { +/// option (google.api.http) = { +/// get: "/v1/messages/{message_id}" +/// additional_bindings { +/// get: "/v1/users/{user_id}/messages/{message_id}" +/// } +/// }; +/// } +/// } +/// message GetMessageRequest { +/// string message_id = 1; +/// string user_id = 2; +/// } +/// +/// This enables the following two alternative HTTP JSON to RPC mappings: +/// +/// HTTP | gRPC +/// -----|----- +/// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` +/// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: +/// "123456")` +/// +/// ## Rules for HTTP mapping +/// +/// 1. Leaf request fields (recursive expansion nested messages in the request +/// message) are classified into three categories: +/// - Fields referred by the path template. They are passed via the URL path. +/// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They +/// are passed via the HTTP +/// request body. +/// - All other fields are passed via the URL query parameters, and the +/// parameter name is the field path in the request message. A repeated +/// field can be represented as multiple query parameters under the same +/// name. +/// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL +/// query parameter, all fields +/// are passed via URL path and HTTP request body. +/// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP +/// request body, all +/// fields are passed via URL path and URL query parameters. +/// +/// ### Path template syntax +/// +/// Template = "/" Segments \[ Verb \] ; +/// Segments = Segment { "/" Segment } ; +/// Segment = "*" | "**" | LITERAL | Variable ; +/// Variable = "{" FieldPath \[ "=" Segments \] "}" ; +/// FieldPath = IDENT { "." IDENT } ; +/// Verb = ":" LITERAL ; +/// +/// The syntax `*` matches a single URL path segment. The syntax `**` matches +/// zero or more URL path segments, which must be the last part of the URL path +/// except the `Verb`. +/// +/// The syntax `Variable` matches part of the URL path as specified by its +/// template. A variable template must not contain other variables. If a variable +/// matches a single path segment, its template may be omitted, e.g. `{var}` +/// is equivalent to `{var=*}`. +/// +/// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` +/// contains any reserved character, such characters should be percent-encoded +/// before the matching. +/// +/// If a variable contains exactly one path segment, such as `"{var}"` or +/// `"{var=*}"`, when such a variable is expanded into a URL path on the client +/// side, all characters except `\[-_.~0-9a-zA-Z\]` are percent-encoded. The +/// server side does the reverse decoding. Such variables show up in the +/// [Discovery +/// Document]() as +/// `{var}`. +/// +/// If a variable contains multiple path segments, such as `"{var=foo/*}"` +/// or `"{var=**}"`, when such a variable is expanded into a URL path on the +/// client side, all characters except `\[-_.~/0-9a-zA-Z\]` are percent-encoded. +/// The server side does the reverse decoding, except "%2F" and "%2f" are left +/// unchanged. Such variables show up in the +/// [Discovery +/// Document]() as +/// `{+var}`. +/// +/// ## Using gRPC API Service Configuration +/// +/// gRPC API Service Configuration (service config) is a configuration language +/// for configuring a gRPC service to become a user-facing product. The +/// service config is simply the YAML representation of the `google.api.Service` +/// proto message. +/// +/// As an alternative to annotating your proto file, you can configure gRPC +/// transcoding in your service config YAML files. You do this by specifying a +/// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same +/// effect as the proto annotation. This can be particularly useful if you +/// have a proto that is reused in multiple services. Note that any transcoding +/// specified in the service config will override any matching transcoding +/// configuration in the proto. +/// +/// Example: +/// +/// http: +/// rules: +/// # Selects a gRPC method and applies HttpRule to it. +/// - selector: example.v1.Messaging.GetMessage +/// get: /v1/messages/{message_id}/{sub.subfield} +/// +/// ## Special notes +/// +/// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the +/// proto to JSON conversion must follow the [proto3 +/// specification](). +/// +/// While the single segment variable follows the semantics of +/// [RFC 6570]() Section 3.2.2 Simple String +/// Expansion, the multi segment variable **does not** follow RFC 6570 Section +/// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion +/// does not expand special characters like `?` and `#`, which would lead +/// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding +/// for multi segment variables. +/// +/// The path variables **must not** refer to any repeated or mapped field, +/// because client libraries are not capable of handling such variable expansion. +/// +/// The path variables **must not** capture the leading "/" character. The reason +/// is that the most common use case "{var}" does not capture the leading "/" +/// character. For consistency, all path variables must share the same behavior. +/// +/// Repeated message fields must not be mapped to URL query parameters, because +/// no client library can support such complicated mapping. +/// +/// If an API needs to use a JSON array for request or response body, it can map +/// the request or response body to a repeated field. However, some gRPC +/// Transcoding implementations may not support this feature. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HttpRule { + /// Selects a method to which this rule applies. + /// + /// Refer to [selector][google.api.DocumentationRule.selector] for syntax + /// details. + #[prost(string, tag = "1")] + pub selector: ::prost::alloc::string::String, + /// The name of the request field whose value is mapped to the HTTP request + /// body, or `*` for mapping all request fields not captured by the path + /// pattern to the HTTP body, or omitted for not having any HTTP request body. + /// + /// NOTE: the referred field must be present at the top-level of the request + /// message type. + #[prost(string, tag = "7")] + pub body: ::prost::alloc::string::String, + /// Optional. The name of the response field whose value is mapped to the HTTP + /// response body. When omitted, the entire response message will be used + /// as the HTTP response body. + /// + /// NOTE: The referred field must be present at the top-level of the response + /// message type. + #[prost(string, tag = "12")] + pub response_body: ::prost::alloc::string::String, + /// Additional HTTP bindings for the selector. Nested bindings must + /// not contain an `additional_bindings` field themselves (that is, + /// the nesting may only be one level deep). + #[prost(message, repeated, tag = "11")] + pub additional_bindings: ::prost::alloc::vec::Vec, + /// Determines the URL pattern is matched by this rules. This pattern can be + /// used with any of the {get|put|post|delete|patch} methods. A custom method + /// can be defined using the 'custom' field. + #[prost(oneof = "http_rule::Pattern", tags = "2, 3, 4, 5, 6, 8")] + pub pattern: ::core::option::Option, +} +/// Nested message and enum types in `HttpRule`. +pub mod http_rule { + /// Determines the URL pattern is matched by this rules. This pattern can be + /// used with any of the {get|put|post|delete|patch} methods. A custom method + /// can be defined using the 'custom' field. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Pattern { + /// Maps to HTTP GET. Used for listing and getting information about + /// resources. + #[prost(string, tag = "2")] + Get(::prost::alloc::string::String), + /// Maps to HTTP PUT. Used for replacing a resource. + #[prost(string, tag = "3")] + Put(::prost::alloc::string::String), + /// Maps to HTTP POST. Used for creating a resource or performing an action. + #[prost(string, tag = "4")] + Post(::prost::alloc::string::String), + /// Maps to HTTP DELETE. Used for deleting a resource. + #[prost(string, tag = "5")] + Delete(::prost::alloc::string::String), + /// Maps to HTTP PATCH. Used for updating a resource. + #[prost(string, tag = "6")] + Patch(::prost::alloc::string::String), + /// The custom pattern is used for specifying an HTTP method that is not + /// included in the `pattern` field, such as HEAD, or "*" to leave the + /// HTTP method unspecified for this rule. The wild-card rule is useful + /// for services that provide content to Web (HTML) clients. + #[prost(message, tag = "8")] + Custom(super::CustomHttpPattern), + } +} +impl ::prost::Name for HttpRule { + const NAME: &'static str = "HttpRule"; + const PACKAGE: &'static str = "google.api"; + fn full_name() -> ::prost::alloc::string::String { + "google.api.HttpRule".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/google.api.HttpRule".into() + } +} +/// A custom pattern is used for defining custom HTTP verb. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CustomHttpPattern { + /// The name of this custom HTTP verb. + #[prost(string, tag = "1")] + pub kind: ::prost::alloc::string::String, + /// The path matched by this custom verb. + #[prost(string, tag = "2")] + pub path: ::prost::alloc::string::String, +} +impl ::prost::Name for CustomHttpPattern { + const NAME: &'static str = "CustomHttpPattern"; + const PACKAGE: &'static str = "google.api"; + fn full_name() -> ::prost::alloc::string::String { + "google.api.CustomHttpPattern".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/google.api.CustomHttpPattern".into() + } +} diff --git a/v4-proto-rs/src/lib.rs b/v4-proto-rs/src/lib.rs new file mode 100644 index 0000000000..0e372c984a --- /dev/null +++ b/v4-proto-rs/src/lib.rs @@ -0,0 +1,45 @@ +/// re-export of cosmos-sdk +pub use cosmos_sdk_proto; + +include!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/_includes.rs")); + +use prost::Name; + +pub trait ToAny: Name + Sized { + /// Converts the type to `prost_types::Any`. + fn to_any(self) -> prost_types::Any { + let value = self.encode_to_vec(); + let type_url = Self::type_url(); + prost_types::Any { type_url, value } + } +} + +impl ToAny for M {} + +#[cfg(test)] +mod test { + use super::ToAny; + use crate::cosmos_sdk_proto::cosmos::bank::v1beta1::MsgSend; + use crate::dydxprotocol::clob::MsgCancelOrder; + + #[test] + pub fn test_any_conversion() { + /// Tests the conversion of `MsgCancelOrder` to `prost_types::Any`. + let msg = MsgCancelOrder { + order_id: None, + good_til_oneof: None, + }; + let any = msg.to_any(); + let url = "/dydxprotocol.clob.MsgCancelOrder"; + assert_eq!(any.type_url, url); + } + + #[test] + pub fn test_any_conversion_wrapped() { + /// Tests the conversion of `MsgSend` to `prost_types::Any`. + let msg = MsgSend::default(); + let any = msg.to_any(); + let url = "/cosmos.bank.v1beta1.MsgSend"; + assert_eq!(any.type_url, url); + } +}