From d8b21fee0118e540f247c99000a07681cc23179b Mon Sep 17 00:00:00 2001 From: lubkoll <11710767+lubkoll@users.noreply.github.com> Date: Wed, 24 Jul 2024 13:56:05 +0000 Subject: [PATCH] Add rust code-generation from proto files (#706) --- scripts/generate-proto.sh | 7 +- scripts/git/post-merge | 0 scripts/git/pre-commit | 0 smart-contracts/osmosis/Cargo.toml | 2 + smart-contracts/quasar/Cargo.lock | 1069 +++++++++++++++++ smart-contracts/quasar/Cargo.toml | 18 + .../quasar/packages/quasar-std/Cargo.toml | 9 + .../quasar/packages/quasar-std/src/lib.rs | 59 + .../quasar-std/src/osmosis.epochs.v1beta1.rs | 77 ++ ...smosis.gamm.poolmodels.balancer.v1beta1.rs | 20 + .../quasar-std/src/osmosis.gamm.v1beta1.rs | 389 ++++++ .../quasar-std/src/osmosis.incentives.rs | 46 + .../packages/quasar-std/src/osmosis.lockup.rs | 153 +++ .../quasar-std/src/osmosis.mint.v1beta1.rs | 99 ++ .../src/osmosis.poolincentives.v1beta1.rs | 111 ++ .../src/quasarlabs.quasarnode.epochs.rs | 42 + .../quasarlabs.quasarnode.qoracle.osmosis.rs | 107 ++ .../src/quasarlabs.quasarnode.qoracle.rs | 74 ++ .../src/quasarlabs.quasarnode.qtransfer.rs | 24 + .../src/quasarlabs.quasarnode.qvesting.rs | 94 ++ ...sarlabs.quasarnode.tokenfactory.v1beta1.rs | 171 +++ smart-contracts/quasar/proto-build/Cargo.toml | 14 + .../quasar/proto-build/buf.quasar.gen.yaml | 8 + smart-contracts/quasar/proto-build/buf.yaml | 4 + .../quasar/proto-build/src/main.rs | 287 +++++ 25 files changed, 2883 insertions(+), 1 deletion(-) mode change 100644 => 100755 scripts/git/post-merge mode change 100644 => 100755 scripts/git/pre-commit create mode 100644 smart-contracts/quasar/Cargo.lock create mode 100644 smart-contracts/quasar/Cargo.toml create mode 100644 smart-contracts/quasar/packages/quasar-std/Cargo.toml create mode 100644 smart-contracts/quasar/packages/quasar-std/src/lib.rs create mode 100644 smart-contracts/quasar/packages/quasar-std/src/osmosis.epochs.v1beta1.rs create mode 100644 smart-contracts/quasar/packages/quasar-std/src/osmosis.gamm.poolmodels.balancer.v1beta1.rs create mode 100644 smart-contracts/quasar/packages/quasar-std/src/osmosis.gamm.v1beta1.rs create mode 100644 smart-contracts/quasar/packages/quasar-std/src/osmosis.incentives.rs create mode 100644 smart-contracts/quasar/packages/quasar-std/src/osmosis.lockup.rs create mode 100644 smart-contracts/quasar/packages/quasar-std/src/osmosis.mint.v1beta1.rs create mode 100644 smart-contracts/quasar/packages/quasar-std/src/osmosis.poolincentives.v1beta1.rs create mode 100644 smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.epochs.rs create mode 100644 smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.qoracle.osmosis.rs create mode 100644 smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.qoracle.rs create mode 100644 smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.qtransfer.rs create mode 100644 smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.qvesting.rs create mode 100644 smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.tokenfactory.v1beta1.rs create mode 100644 smart-contracts/quasar/proto-build/Cargo.toml create mode 100644 smart-contracts/quasar/proto-build/buf.quasar.gen.yaml create mode 100644 smart-contracts/quasar/proto-build/buf.yaml create mode 100644 smart-contracts/quasar/proto-build/src/main.rs diff --git a/scripts/generate-proto.sh b/scripts/generate-proto.sh index 3f87eb305..e76e5a6af 100644 --- a/scripts/generate-proto.sh +++ b/scripts/generate-proto.sh @@ -41,4 +41,9 @@ echo "PWD is - $PWD" # Copy the generated Go files to the desired location cp -r github.com/quasarlabs/quasarnode/* . -cp -r github.com github.com.bkp \ No newline at end of file +cp -r github.com github.com.bkp + +# Generate rust files +cd ${project_dir}/smart-contracts/quasar +cargo run --bin proto-build +cd - \ No newline at end of file diff --git a/scripts/git/post-merge b/scripts/git/post-merge old mode 100644 new mode 100755 diff --git a/scripts/git/pre-commit b/scripts/git/pre-commit old mode 100644 new mode 100755 diff --git a/smart-contracts/osmosis/Cargo.toml b/smart-contracts/osmosis/Cargo.toml index 270f37c13..e083fd6e9 100644 --- a/smart-contracts/osmosis/Cargo.toml +++ b/smart-contracts/osmosis/Cargo.toml @@ -17,6 +17,7 @@ members = [ "contracts/dex-router-osmosis", "contracts/lst-dex-adapter-osmosis", "contracts/lst-adapter-osmosis", + "packages/quasar-types", ] [workspace.dependencies] @@ -34,6 +35,7 @@ cw20-base = {version = "1.1.2", features = ["library"]} cw20-staking = "0.11.1" apollo-cw-asset = "0.1.2" mars-owner = "2.0.0" +quasar-std = { path = "../quasar/packages/quasar-std" } quasar-types = { path = "packages/quasar-types" } dex-router-osmosis = { path = "contracts/dex-router-osmosis", features = ["library"] } lst-dex-adapter-osmosis = { path = "contracts/lst-dex-adapter-osmosis", features = ["library"] } diff --git a/smart-contracts/quasar/Cargo.lock b/smart-contracts/quasar/Cargo.lock new file mode 100644 index 000000000..6ec6df246 --- /dev/null +++ b/smart-contracts/quasar/Cargo.lock @@ -0,0 +1,1069 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "async-stream" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "async-trait" +version = "0.1.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "axum" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" +dependencies = [ + "async-trait", + "axum-core", + "bitflags 1.3.2", + "bytes", + "futures-util", + "http", + "http-body", + "hyper", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "mime", + "rustversion", + "tower-layer", + "tower-service", +] + +[[package]] +name = "backtrace" +version = "0.3.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "bytes" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" + +[[package]] +name = "cc" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fastrand" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" + +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper", + "pin-project-lite", + "tokio", + "tokio-io-timeout", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" +dependencies = [ + "hermit-abi", + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "multimap" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" + +[[package]] +name = "object" +version = "0.36.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap 2.2.6", +] + +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "prettyplease" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prost" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" +dependencies = [ + "bytes", + "heck", + "itertools", + "log", + "multimap", + "once_cell", + "petgraph", + "prettyplease", + "prost", + "prost-types", + "regex", + "syn", + "tempfile", +] + +[[package]] +name = "prost-derive" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "prost-types" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" +dependencies = [ + "prost", +] + +[[package]] +name = "proto-build" +version = "0.1.0" +dependencies = [ + "prost", + "prost-build", + "regex", + "tonic", + "tonic-build", + "walkdir", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "regex" +version = "1.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags 2.6.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "serde" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "syn" +version = "2.0.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "tempfile" +version = "3.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +dependencies = [ + "cfg-if", + "fastrand", + "rustix", + "windows-sys", +] + +[[package]] +name = "tokio" +version = "1.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d040ac2b29ab03b09d4129c2f5bbd012a3ac2f79d38ff506a4bf8dd34b0eac8a" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys", +] + +[[package]] +name = "tokio-io-timeout" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" +dependencies = [ + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tonic" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" +dependencies = [ + "async-stream", + "async-trait", + "axum", + "base64", + "bytes", + "h2", + "http", + "http-body", + "hyper", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost", + "tokio", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tonic-build" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d021fc044c18582b9a2408cd0dd05b1596e3ecdb5c4df822bb0183545683889" +dependencies = [ + "prettyplease", + "proc-macro2", + "prost-build", + "quote", + "syn", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "indexmap 1.9.3", + "pin-project", + "pin-project-lite", + "rand", + "slab", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "winapi-util" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/smart-contracts/quasar/Cargo.toml b/smart-contracts/quasar/Cargo.toml new file mode 100644 index 000000000..aac9d7e03 --- /dev/null +++ b/smart-contracts/quasar/Cargo.toml @@ -0,0 +1,18 @@ +[workspace] +resolver = "2" + +members = [ + # "packages/quasar-std", + "proto-build", +] + +[workspace.dependencies] +prost = {version = "0.12.3", default-features = false, features = ["std"]} +prost-types = {version = "0.12.3", default-features = false} +prost-build = { version = "0.12.3" } +tonic = { version = "0.10" } +tonic-build = { version = "0.10" } +regex = { version = "1" } +walkdir = { version = "2" } +cosmos-sdk-proto = {version = "0.21.1", default-features = false} + diff --git a/smart-contracts/quasar/packages/quasar-std/Cargo.toml b/smart-contracts/quasar/packages/quasar-std/Cargo.toml new file mode 100644 index 000000000..b425b33b2 --- /dev/null +++ b/smart-contracts/quasar/packages/quasar-std/Cargo.toml @@ -0,0 +1,9 @@ +[package] +edition = "2021" +name = "quasar-std" +version = "0.1.0" + +[dependencies] +prost = { workspace = true } +prost-types = { workspace = true } +cosmos-sdk-proto = { workspace = true } diff --git a/smart-contracts/quasar/packages/quasar-std/src/lib.rs b/smart-contracts/quasar/packages/quasar-std/src/lib.rs new file mode 100644 index 000000000..fca887174 --- /dev/null +++ b/smart-contracts/quasar/packages/quasar-std/src/lib.rs @@ -0,0 +1,59 @@ +pub mod osmosis { + pub mod epochs { + pub mod v1beta1 { + include!("osmosis.epochs.v1beta1.rs"); + } + } + pub mod gamm { + pub mod poolmodels { + pub mod balancer { + pub mod v1beta1 { + include!("osmosis.gamm.poolmodels.balancer.v1beta1.rs"); + } + } + } + pub mod v1beta1 { + include!("osmosis.gamm.v1beta1.rs"); + } + } + pub mod incentives { + include!("osmosis.incentives.rs"); + } + pub mod lockup { + include!("osmosis.lockup.rs"); + } + pub mod mint { + pub mod v1beta1 { + include!("osmosis.mint.v1beta1.rs"); + } + } + pub mod poolincentives { + pub mod v1beta1 { + include!("osmosis.poolincentives.v1beta1.rs"); + } + } +} +pub mod quasarlabs { + pub mod quasarnode { + pub mod epochs { + include!("quasarlabs.quasarnode.epochs.rs"); + } + pub mod qoracle { + pub mod osmosis { + include!("quasarlabs.quasarnode.qoracle.osmosis.rs"); + } + include!("quasarlabs.quasarnode.qoracle.rs"); + } + pub mod qtransfer { + include!("quasarlabs.quasarnode.qtransfer.rs"); + } + pub mod qvesting { + include!("quasarlabs.quasarnode.qvesting.rs"); + } + pub mod tokenfactory { + pub mod v1beta1 { + include!("quasarlabs.quasarnode.tokenfactory.v1beta1.rs"); + } + } + } +} diff --git a/smart-contracts/quasar/packages/quasar-std/src/osmosis.epochs.v1beta1.rs b/smart-contracts/quasar/packages/quasar-std/src/osmosis.epochs.v1beta1.rs new file mode 100644 index 000000000..33ea83e3f --- /dev/null +++ b/smart-contracts/quasar/packages/quasar-std/src/osmosis.epochs.v1beta1.rs @@ -0,0 +1,77 @@ +// @generated +/// EpochInfo is a struct that describes the data going into +/// a timer defined by the x/epochs module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EpochInfo { + /// identifier is a unique reference to this particular timer. + #[prost(string, tag = "1")] + pub identifier: ::prost::alloc::string::String, + /// start_time is the time at which the timer first ever ticks. + /// If start_time is in the future, the epoch will not begin until the start + /// time. + #[prost(message, optional, tag = "2")] + pub start_time: ::core::option::Option<::prost_types::Timestamp>, + /// duration is the time in between epoch ticks. + /// In order for intended behavior to be met, duration should + /// be greater than the chains expected block time. + /// Duration must be non-zero. + #[prost(message, optional, tag = "3")] + pub duration: ::core::option::Option<::prost_types::Duration>, + /// current_epoch is the current epoch number, or in other words, + /// how many times has the timer 'ticked'. + /// The first tick (current_epoch=1) is defined as + /// the first block whose blocktime is greater than the EpochInfo start_time. + #[prost(int64, tag = "4")] + pub current_epoch: i64, + /// current_epoch_start_time describes the start time of the current timer + /// interval. The interval is (current_epoch_start_time, + /// current_epoch_start_time + duration] When the timer ticks, this is set to + /// current_epoch_start_time = last_epoch_start_time + duration only one timer + /// tick for a given identifier can occur per block. + /// + /// NOTE! The current_epoch_start_time may diverge significantly from the + /// wall-clock time the epoch began at. Wall-clock time of epoch start may be + /// >> current_epoch_start_time. Suppose current_epoch_start_time = 10, + /// duration = 5. Suppose the chain goes offline at t=14, and comes back online + /// at t=30, and produces blocks at every successive time. (t=31, 32, etc.) + /// * The t=30 block will start the epoch for (10, 15] + /// * The t=31 block will start the epoch for (15, 20] + /// * The t=32 block will start the epoch for (20, 25] + /// * The t=33 block will start the epoch for (25, 30] + /// * The t=34 block will start the epoch for (30, 35] + /// * The **t=36** block will start the epoch for (35, 40] + #[prost(message, optional, tag = "5")] + pub current_epoch_start_time: ::core::option::Option<::prost_types::Timestamp>, + /// epoch_counting_started is a boolean, that indicates whether this + /// epoch timer has began yet. + #[prost(bool, tag = "6")] + pub epoch_counting_started: bool, + /// current_epoch_start_height is the block height at which the current epoch + /// started. (The block height at which the timer last ticked) + #[prost(int64, tag = "8")] + pub current_epoch_start_height: i64, +} +/// GenesisState defines the epochs module's genesis state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, repeated, tag = "1")] + pub epochs: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEpochsInfoRequest {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEpochsInfoResponse { + #[prost(message, repeated, tag = "1")] + pub epochs: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryCurrentEpochRequest { + #[prost(string, tag = "1")] + pub identifier: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryCurrentEpochResponse { + #[prost(int64, tag = "1")] + pub current_epoch: i64, +} +// @@protoc_insertion_point(module) diff --git a/smart-contracts/quasar/packages/quasar-std/src/osmosis.gamm.poolmodels.balancer.v1beta1.rs b/smart-contracts/quasar/packages/quasar-std/src/osmosis.gamm.poolmodels.balancer.v1beta1.rs new file mode 100644 index 000000000..5d1a4d0c5 --- /dev/null +++ b/smart-contracts/quasar/packages/quasar-std/src/osmosis.gamm.poolmodels.balancer.v1beta1.rs @@ -0,0 +1,20 @@ +// @generated +/// ===================== MsgCreatePool +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateBalancerPool { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub pool_params: ::core::option::Option, + #[prost(message, repeated, tag = "3")] + pub pool_assets: ::prost::alloc::vec::Vec, + #[prost(string, tag = "4")] + pub future_pool_governor: ::prost::alloc::string::String, +} +/// Returns the poolID +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateBalancerPoolResponse { + #[prost(uint64, tag = "1")] + pub pool_id: u64, +} +// @@protoc_insertion_point(module) diff --git a/smart-contracts/quasar/packages/quasar-std/src/osmosis.gamm.v1beta1.rs b/smart-contracts/quasar/packages/quasar-std/src/osmosis.gamm.v1beta1.rs new file mode 100644 index 000000000..080bf6444 --- /dev/null +++ b/smart-contracts/quasar/packages/quasar-std/src/osmosis.gamm.v1beta1.rs @@ -0,0 +1,389 @@ +// @generated +/// Parameters for changing the weights in a balancer pool smoothly from +/// a start weight and end weight over a period of time. +/// Currently, the only smooth change supported is linear changing between +/// the two weights, but more types may be added in the future. +/// When these parameters are set, the weight w(t) for pool time `t` is the +/// following: +/// t <= start_time: w(t) = initial_pool_weights +/// start_time < t <= start_time + duration: +/// w(t) = initial_pool_weights + (t - start_time) * +/// (target_pool_weights - initial_pool_weights) / (duration) +/// t > start_time + duration: w(t) = target_pool_weights +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SmoothWeightChangeParams { + /// The start time for beginning the weight change. + /// If a parameter change / pool instantiation leaves this blank, + /// it should be generated by the state_machine as the current time. + #[prost(message, optional, tag = "1")] + pub start_time: ::core::option::Option<::prost_types::Timestamp>, + /// Duration for the weights to change over + #[prost(message, optional, tag = "2")] + pub duration: ::core::option::Option<::prost_types::Duration>, + /// The initial pool weights. These are copied from the pool's settings + /// at the time of weight change instantiation. + /// The amount PoolAsset.token.amount field is ignored if present, + /// future type refactorings should just have a type with the denom & weight + /// here. + #[prost(message, repeated, tag = "3")] + pub initial_pool_weights: ::prost::alloc::vec::Vec, + /// The target pool weights. The pool weights will change linearly with respect + /// to time between start_time, and start_time + duration. The amount + /// PoolAsset.token.amount field is ignored if present, future type + /// refactorings should just have a type with the denom & weight here. + /// + /// Intermediate variable for the 'slope' of pool weights. This is equal to + /// (target_pool_weights - initial_pool_weights) / (duration) + /// TODO: Work out precision, and decide if this is good to add + /// repeated PoolAsset poolWeightSlope = 5 [ + /// (gogoproto.moretags) = "yaml:\"pool_weight_slope\"", + /// (gogoproto.nullable) = false + /// ]; + #[prost(message, repeated, tag = "4")] + pub target_pool_weights: ::prost::alloc::vec::Vec, +} +/// PoolParams defined the parameters that will be managed by the pool +/// governance in the future. This params are not managed by the chain +/// governance. Instead they will be managed by the token holders of the pool. +/// The pool's token holders are specified in future_pool_governor. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PoolParams { + #[prost(string, tag = "1")] + pub swap_fee: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub exit_fee: ::prost::alloc::string::String, + #[prost(message, optional, tag = "3")] + pub smooth_weight_change_params: ::core::option::Option, +} +/// Pool asset is an internal struct that combines the amount of the +/// token in the pool, and its balancer weight. +/// This is an awkward packaging of data, +/// and should be revisited in a future state migration. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PoolAsset { + /// Coins we are talking about, + /// the denomination must be unique amongst all PoolAssets for this pool. + #[prost(message, optional, tag = "1")] + pub token: ::core::option::Option, + /// Weight that is not normalized. This weight must be less than 2^50 + #[prost(string, tag = "2")] + pub weight: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Pool { + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + #[prost(uint64, tag = "2")] + pub id: u64, + #[prost(message, optional, tag = "3")] + pub pool_params: ::core::option::Option, + /// This string specifies who will govern the pool in the future. + /// Valid forms of this are: + /// {token name},{duration} + /// {duration} + /// where {token name} if specified is the token which determines the + /// governor, and if not specified is the LP token for this pool.duration is + /// a time specified as 0w,1w,2w, etc. which specifies how long the token + /// would need to be locked up to count in governance. 0w means no lockup. + /// TODO: Further improve these docs + #[prost(string, tag = "4")] + pub future_pool_governor: ::prost::alloc::string::String, + /// sum of all LP tokens sent out + #[prost(message, optional, tag = "5")] + pub total_shares: ::core::option::Option, + /// These are assumed to be sorted by denomiation. + /// They contain the pool asset and the information about the weight + #[prost(message, repeated, tag = "6")] + pub pool_assets: ::prost::alloc::vec::Vec, + /// sum of all non-normalized pool weights + #[prost(string, tag = "7")] + pub total_weight: ::prost::alloc::string::String, +} +/// ===================== MsgJoinPool +/// This is really MsgJoinPoolNoSwap +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgJoinPool { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(uint64, tag = "2")] + pub pool_id: u64, + #[prost(string, tag = "3")] + pub share_out_amount: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "4")] + pub token_in_maxs: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgJoinPoolResponse { + #[prost(string, tag = "1")] + pub share_out_amount: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "2")] + pub token_in: ::prost::alloc::vec::Vec, +} +/// ===================== MsgExitPool +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgExitPool { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(uint64, tag = "2")] + pub pool_id: u64, + #[prost(string, tag = "3")] + pub share_in_amount: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "4")] + pub token_out_mins: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgExitPoolResponse { + #[prost(message, repeated, tag = "1")] + pub token_out: ::prost::alloc::vec::Vec, +} +/// ===================== MsgSwapExactAmountIn +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SwapAmountInRoute { + #[prost(uint64, tag = "1")] + pub pool_id: u64, + #[prost(string, tag = "2")] + pub token_out_denom: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSwapExactAmountIn { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "2")] + pub routes: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "3")] + pub token_in: ::core::option::Option, + #[prost(string, tag = "4")] + pub token_out_min_amount: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSwapExactAmountInResponse { + #[prost(string, tag = "1")] + pub token_out_amount: ::prost::alloc::string::String, +} +/// ===================== MsgSwapExactAmountOut +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SwapAmountOutRoute { + #[prost(uint64, tag = "1")] + pub pool_id: u64, + #[prost(string, tag = "2")] + pub token_in_denom: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSwapExactAmountOut { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "2")] + pub routes: ::prost::alloc::vec::Vec, + #[prost(string, tag = "3")] + pub token_in_max_amount: ::prost::alloc::string::String, + #[prost(message, optional, tag = "4")] + pub token_out: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSwapExactAmountOutResponse { + #[prost(string, tag = "1")] + pub token_in_amount: ::prost::alloc::string::String, +} +/// ===================== MsgJoinSwapExternAmountIn +/// TODO: Rename to MsgJoinSwapExactAmountIn +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgJoinSwapExternAmountIn { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(uint64, tag = "2")] + pub pool_id: u64, + #[prost(message, optional, tag = "3")] + pub token_in: ::core::option::Option, + #[prost(string, tag = "4")] + pub share_out_min_amount: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgJoinSwapExternAmountInResponse { + #[prost(string, tag = "1")] + pub share_out_amount: ::prost::alloc::string::String, +} +/// ===================== MsgJoinSwapShareAmountOut +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgJoinSwapShareAmountOut { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(uint64, tag = "2")] + pub pool_id: u64, + #[prost(string, tag = "3")] + pub token_in_denom: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub share_out_amount: ::prost::alloc::string::String, + #[prost(string, tag = "5")] + pub token_in_max_amount: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgJoinSwapShareAmountOutResponse { + #[prost(string, tag = "1")] + pub token_in_amount: ::prost::alloc::string::String, +} +/// ===================== MsgExitSwapShareAmountIn +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgExitSwapShareAmountIn { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(uint64, tag = "2")] + pub pool_id: u64, + #[prost(string, tag = "3")] + pub token_out_denom: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub share_in_amount: ::prost::alloc::string::String, + #[prost(string, tag = "5")] + pub token_out_min_amount: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgExitSwapShareAmountInResponse { + #[prost(string, tag = "1")] + pub token_out_amount: ::prost::alloc::string::String, +} +/// ===================== MsgExitSwapExternAmountOut +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgExitSwapExternAmountOut { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(uint64, tag = "2")] + pub pool_id: u64, + #[prost(message, optional, tag = "3")] + pub token_out: ::core::option::Option, + #[prost(string, tag = "4")] + pub share_in_max_amount: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgExitSwapExternAmountOutResponse { + #[prost(string, tag = "1")] + pub share_in_amount: ::prost::alloc::string::String, +} +/// =============================== Pool +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPoolRequest { + #[prost(uint64, tag = "1")] + pub pool_id: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPoolResponse { + #[prost(message, optional, tag = "1")] + pub pool: ::core::option::Option<::prost_types::Any>, +} +/// =============================== Pools +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPoolsRequest { + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPoolsResponse { + #[prost(message, repeated, tag = "1")] + pub pools: ::prost::alloc::vec::Vec<::prost_types::Any>, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +/// =============================== NumPools +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryNumPoolsRequest {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryNumPoolsResponse { + #[prost(uint64, tag = "1")] + pub num_pools: u64, +} +/// =============================== PoolParams +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPoolParamsRequest { + #[prost(uint64, tag = "1")] + pub pool_id: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPoolParamsResponse { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option<::prost_types::Any>, +} +/// =============================== PoolLiquidity +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryTotalPoolLiquidityRequest { + #[prost(uint64, tag = "1")] + pub pool_id: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryTotalPoolLiquidityResponse { + #[prost(message, repeated, tag = "1")] + pub liquidity: ::prost::alloc::vec::Vec, +} +/// =============================== TotalShares +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryTotalSharesRequest { + #[prost(uint64, tag = "1")] + pub pool_id: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryTotalSharesResponse { + #[prost(message, optional, tag = "1")] + pub total_shares: ::core::option::Option, +} +/// QuerySpotPriceRequest defines the gRPC request structure for a SpotPrice +/// query. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySpotPriceRequest { + #[prost(uint64, tag = "1")] + pub pool_id: u64, + #[prost(string, tag = "2")] + pub base_asset_denom: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub quote_asset_denom: ::prost::alloc::string::String, +} +/// QuerySpotPriceResponse defines the gRPC response structure for a SpotPrice +/// query. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySpotPriceResponse { + /// String of the Dec. Ex) 10.203uatom + #[prost(string, tag = "1")] + pub spot_price: ::prost::alloc::string::String, +} +/// =============================== EstimateSwapExactAmountIn +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySwapExactAmountInRequest { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(uint64, tag = "2")] + pub pool_id: u64, + #[prost(string, tag = "3")] + pub token_in: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "4")] + pub routes: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySwapExactAmountInResponse { + #[prost(string, tag = "1")] + pub token_out_amount: ::prost::alloc::string::String, +} +/// =============================== EstimateSwapExactAmountOut +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySwapExactAmountOutRequest { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(uint64, tag = "2")] + pub pool_id: u64, + #[prost(message, repeated, tag = "3")] + pub routes: ::prost::alloc::vec::Vec, + #[prost(string, tag = "4")] + pub token_out: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySwapExactAmountOutResponse { + #[prost(string, tag = "1")] + pub token_in_amount: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryTotalLiquidityRequest {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryTotalLiquidityResponse { + #[prost(message, repeated, tag = "1")] + pub liquidity: ::prost::alloc::vec::Vec, +} +// @@protoc_insertion_point(module) diff --git a/smart-contracts/quasar/packages/quasar-std/src/osmosis.incentives.rs b/smart-contracts/quasar/packages/quasar-std/src/osmosis.incentives.rs new file mode 100644 index 000000000..e8232eae2 --- /dev/null +++ b/smart-contracts/quasar/packages/quasar-std/src/osmosis.incentives.rs @@ -0,0 +1,46 @@ +// @generated +/// Gauge is an object that stores and distributes yields to recipients who +/// satisfy certain conditions. Currently gauges support conditions around the +/// duration for which a given denom is locked. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Gauge { + /// id is the unique ID of a Gauge + #[prost(uint64, tag = "1")] + pub id: u64, + /// is_perpetual is a flag to show if it's a perpetual or non-perpetual gauge + /// Non-perpetual gauges distribute their tokens equally per epoch while the + /// gauge is in the active period. Perpetual gauges distribute all their tokens + /// at a single time and only distribute their tokens again once the gauge is + /// refilled, Intended for use with incentives that get refilled daily. + #[prost(bool, tag = "2")] + pub is_perpetual: bool, + /// distribute_to is where the gauge rewards are distributed to. + /// This is queried via lock duration or by timestamp + #[prost(message, optional, tag = "3")] + pub distribute_to: ::core::option::Option, + /// coins is the total amount of coins that have been in the gauge + /// Can distribute multiple coin denoms + #[prost(message, repeated, tag = "4")] + pub coins: ::prost::alloc::vec::Vec, + /// start_time is the distribution start time + #[prost(message, optional, tag = "5")] + pub start_time: ::core::option::Option<::prost_types::Timestamp>, + /// num_epochs_paid_over is the number of total epochs distribution will be + /// completed over + #[prost(uint64, tag = "6")] + pub num_epochs_paid_over: u64, + /// filled_epochs is the number of epochs distribution has been completed on + /// already + #[prost(uint64, tag = "7")] + pub filled_epochs: u64, + /// distributed_coins are coins that have been distributed already + #[prost(message, repeated, tag = "8")] + pub distributed_coins: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LockableDurationsInfo { + /// List of incentivised durations that gauges will pay out to + #[prost(message, repeated, tag = "1")] + pub lockable_durations: ::prost::alloc::vec::Vec<::prost_types::Duration>, +} +// @@protoc_insertion_point(module) diff --git a/smart-contracts/quasar/packages/quasar-std/src/osmosis.lockup.rs b/smart-contracts/quasar/packages/quasar-std/src/osmosis.lockup.rs new file mode 100644 index 000000000..a8f78c90a --- /dev/null +++ b/smart-contracts/quasar/packages/quasar-std/src/osmosis.lockup.rs @@ -0,0 +1,153 @@ +// @generated +/// PeriodLock is a single lock unit by period defined by the x/lockup module. +/// It's a record of a locked coin at a specific time. It stores owner, duration, +/// unlock time and the number of coins locked. A state of a period lock is +/// created upon lock creation, and deleted once the lock has been matured after +/// the `duration` has passed since unbonding started. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PeriodLock { + /// ID is the unique id of the lock. + /// The ID of the lock is decided upon lock creation, incrementing by 1 for + /// every lock. + #[prost(uint64, tag = "1")] + pub id: u64, + /// Owner is the account address of the lock owner. + /// Only the owner can modify the state of the lock. + #[prost(string, tag = "2")] + pub owner: ::prost::alloc::string::String, + /// Duration is the time needed for a lock to mature after unlocking has + /// started. + #[prost(message, optional, tag = "3")] + pub duration: ::core::option::Option<::prost_types::Duration>, + /// EndTime refers to the time at which the lock would mature and get deleted. + /// This value is first initialized when an unlock has started for the lock, + /// end time being block time + duration. + #[prost(message, optional, tag = "4")] + pub end_time: ::core::option::Option<::prost_types::Timestamp>, + /// Coins are the tokens locked within the lock, kept in the module account. + #[prost(message, repeated, tag = "5")] + pub coins: ::prost::alloc::vec::Vec, +} +/// QueryCondition is a struct used for querying locks upon different conditions. +/// Duration field and timestamp fields could be optional, depending on the +/// LockQueryType. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryCondition { + /// LockQueryType is a type of lock query, ByLockDuration | ByLockTime + #[prost(enumeration = "LockQueryType", tag = "1")] + pub lock_query_type: i32, + /// Denom represents the token denomination we are looking to lock up + #[prost(string, tag = "2")] + pub denom: ::prost::alloc::string::String, + /// Duration is used to query locks with longer duration than the specified + /// duration. Duration field must not be nil when the lock query type is + /// `ByLockDuration`. + #[prost(message, optional, tag = "3")] + pub duration: ::core::option::Option<::prost_types::Duration>, + /// Timestamp is used by locks started before the specified duration. + /// Timestamp field must not be nil when the lock query type is `ByLockTime`. + /// Querying locks with timestamp is currently not implemented. + #[prost(message, optional, tag = "4")] + pub timestamp: ::core::option::Option<::prost_types::Timestamp>, +} +/// SyntheticLock is creating virtual lockup where new denom is combination of +/// original denom and synthetic suffix. At the time of synthetic lockup creation +/// and deletion, accumulation store is also being updated and on querier side, +/// they can query as freely as native lockup. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SyntheticLock { + /// Underlying Lock ID is the underlying native lock's id for this synthetic + /// lockup. A synthetic lock MUST have an underlying lock. + #[prost(uint64, tag = "1")] + pub underlying_lock_id: u64, + /// SynthDenom is the synthetic denom that is a combination of + /// gamm share + bonding status + validator address. + #[prost(string, tag = "2")] + pub synth_denom: ::prost::alloc::string::String, + /// used for unbonding synthetic lockups, for active synthetic lockups, this + /// value is set to uninitialized value + #[prost(message, optional, tag = "3")] + pub end_time: ::core::option::Option<::prost_types::Timestamp>, + /// Duration is the duration for a synthetic lock to mature + /// at the point of unbonding has started. + #[prost(message, optional, tag = "4")] + pub duration: ::core::option::Option<::prost_types::Duration>, +} +/// LockQueryType defines the type of the lock query that can +/// either be by duration or start time of the lock. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum LockQueryType { + ByDuration = 0, + ByTime = 1, +} +impl LockQueryType { + /// 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 { + LockQueryType::ByDuration => "ByDuration", + LockQueryType::ByTime => "ByTime", + } + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgLockTokens { + #[prost(string, tag = "1")] + pub owner: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub duration: ::core::option::Option<::prost_types::Duration>, + #[prost(message, repeated, tag = "3")] + pub coins: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgLockTokensResponse { + #[prost(uint64, tag = "1")] + pub id: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgBeginUnlockingAll { + #[prost(string, tag = "1")] + pub owner: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgBeginUnlockingAllResponse { + #[prost(message, repeated, tag = "1")] + pub unlocks: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgBeginUnlocking { + #[prost(string, tag = "1")] + pub owner: ::prost::alloc::string::String, + #[prost(uint64, tag = "2")] + pub id: u64, + /// Amount of unlocking coins. Unlock all if not set. + #[prost(message, repeated, tag = "3")] + pub coins: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgBeginUnlockingResponse { + #[prost(bool, tag = "1")] + pub success: bool, +} +/// MsgExtendLockup extends the existing lockup's duration. +/// The new duration is longer than the original. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgExtendLockup { + #[prost(string, tag = "1")] + pub owner: ::prost::alloc::string::String, + #[prost(uint64, tag = "2")] + pub id: u64, + /// duration to be set. fails if lower than the current duration, or is + /// unlocking + #[prost(message, optional, tag = "3")] + pub duration: ::core::option::Option<::prost_types::Duration>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgExtendLockupResponse { + #[prost(bool, tag = "1")] + pub success: bool, +} +// @@protoc_insertion_point(module) diff --git a/smart-contracts/quasar/packages/quasar-std/src/osmosis.mint.v1beta1.rs b/smart-contracts/quasar/packages/quasar-std/src/osmosis.mint.v1beta1.rs new file mode 100644 index 000000000..86b19e908 --- /dev/null +++ b/smart-contracts/quasar/packages/quasar-std/src/osmosis.mint.v1beta1.rs @@ -0,0 +1,99 @@ +// @generated +/// Minter represents the minting state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Minter { + /// epoch_provisions represent rewards for the current epoch. + #[prost(string, tag = "1")] + pub epoch_provisions: ::prost::alloc::string::String, +} +/// WeightedAddress represents an address with a weight assigned to it. +/// The weight is used to determine the proportion of the total minted +/// tokens to be minted to the address. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WeightedAddress { + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub weight: ::prost::alloc::string::String, +} +/// DistributionProportions defines the distribution proportions of the minted +/// denom. In other words, defines which stakeholders will receive the minted +/// denoms and how much. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DistributionProportions { + /// staking defines the proportion of the minted mint_denom that is to be + /// allocated as staking rewards. + #[prost(string, tag = "1")] + pub staking: ::prost::alloc::string::String, + /// pool_incentives defines the proportion of the minted mint_denom that is + /// to be allocated as pool incentives. + #[prost(string, tag = "2")] + pub pool_incentives: ::prost::alloc::string::String, + /// developer_rewards defines the proportion of the minted mint_denom that is + /// to be allocated to developer rewards address. + #[prost(string, tag = "3")] + pub developer_rewards: ::prost::alloc::string::String, + /// community_pool defines the proportion of the minted mint_denom that is + /// to be allocated to the community pool. + #[prost(string, tag = "4")] + pub community_pool: ::prost::alloc::string::String, +} +/// Params holds parameters for the x/mint module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + /// mint_denom is the denom of the coin to mint. + #[prost(string, tag = "1")] + pub mint_denom: ::prost::alloc::string::String, + /// genesis_epoch_provisions epoch provisions from the first epoch. + #[prost(string, tag = "2")] + pub genesis_epoch_provisions: ::prost::alloc::string::String, + /// epoch_identifier mint epoch identifier e.g. (day, week). + #[prost(string, tag = "3")] + pub epoch_identifier: ::prost::alloc::string::String, + /// reduction_period_in_epochs the number of epochs it takes + /// to reduce the rewards. + #[prost(int64, tag = "4")] + pub reduction_period_in_epochs: i64, + /// reduction_factor is the reduction multiplier to execute + /// at the end of each period set by reduction_period_in_epochs. + #[prost(string, tag = "5")] + pub reduction_factor: ::prost::alloc::string::String, + /// distribution_proportions defines the distribution proportions of the minted + /// denom. In other words, defines which stakeholders will receive the minted + /// denoms and how much. + #[prost(message, optional, tag = "6")] + pub distribution_proportions: ::core::option::Option, + /// weighted_developer_rewards_receivers is the address to receive developer + /// rewards with weights assignedt to each address. The final amount that each + /// address receives is: epoch_provisions * + /// distribution_proportions.developer_rewards * Address's Weight. + #[prost(message, repeated, tag = "7")] + pub weighted_developer_rewards_receivers: ::prost::alloc::vec::Vec, + /// minting_rewards_distribution_start_epoch start epoch to distribute minting + /// rewards + #[prost(int64, tag = "8")] + pub minting_rewards_distribution_start_epoch: i64, +} +/// QueryParamsRequest is the request type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +/// QueryParamsResponse is the response type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params defines the parameters of the module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +/// QueryEpochProvisionsRequest is the request type for the +/// Query/EpochProvisions RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEpochProvisionsRequest {} +/// QueryEpochProvisionsResponse is the response type for the +/// Query/EpochProvisions RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEpochProvisionsResponse { + /// epoch_provisions is the current minting per epoch provisions value. + #[prost(bytes = "vec", tag = "1")] + pub epoch_provisions: ::prost::alloc::vec::Vec, +} +// @@protoc_insertion_point(module) diff --git a/smart-contracts/quasar/packages/quasar-std/src/osmosis.poolincentives.v1beta1.rs b/smart-contracts/quasar/packages/quasar-std/src/osmosis.poolincentives.v1beta1.rs new file mode 100644 index 000000000..f8cbcffd7 --- /dev/null +++ b/smart-contracts/quasar/packages/quasar-std/src/osmosis.poolincentives.v1beta1.rs @@ -0,0 +1,111 @@ +// @generated +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + /// minted_denom is the denomination of the coin expected to be minted by the + /// minting module. Pool-incentives module doesn’t actually mint the coin + /// itself, but rather manages the distribution of coins that matches the + /// defined minted_denom. + #[prost(string, tag = "1")] + pub minted_denom: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LockableDurationsInfo { + #[prost(message, repeated, tag = "1")] + pub lockable_durations: ::prost::alloc::vec::Vec<::prost_types::Duration>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DistrInfo { + #[prost(string, tag = "1")] + pub total_weight: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "2")] + pub records: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DistrRecord { + #[prost(uint64, tag = "1")] + pub gauge_id: u64, + #[prost(string, tag = "2")] + pub weight: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PoolToGauge { + #[prost(uint64, tag = "1")] + pub pool_id: u64, + #[prost(uint64, tag = "2")] + pub gauge_id: u64, + #[prost(message, optional, tag = "3")] + pub duration: ::core::option::Option<::prost_types::Duration>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PoolToGauges { + #[prost(message, repeated, tag = "2")] + pub pool_to_gauge: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGaugeIdsRequest { + #[prost(uint64, tag = "1")] + pub pool_id: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGaugeIdsResponse { + #[prost(message, repeated, tag = "1")] + pub gauge_ids_with_duration: + ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `QueryGaugeIdsResponse`. +pub mod query_gauge_ids_response { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct GaugeIdWithDuration { + #[prost(uint64, tag = "1")] + pub gauge_id: u64, + #[prost(message, optional, tag = "2")] + pub duration: ::core::option::Option<::prost_types::Duration>, + #[prost(string, tag = "3")] + pub gauge_incentive_percentage: ::prost::alloc::string::String, + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDistrInfoRequest {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDistrInfoResponse { + #[prost(message, optional, tag = "1")] + pub distr_info: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryLockableDurationsRequest {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryLockableDurationsResponse { + #[prost(message, repeated, tag = "1")] + pub lockable_durations: ::prost::alloc::vec::Vec<::prost_types::Duration>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryIncentivizedPoolsRequest {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IncentivizedPool { + #[prost(uint64, tag = "1")] + pub pool_id: u64, + #[prost(message, optional, tag = "2")] + pub lockable_duration: ::core::option::Option<::prost_types::Duration>, + #[prost(uint64, tag = "3")] + pub gauge_id: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryIncentivizedPoolsResponse { + #[prost(message, repeated, tag = "1")] + pub incentivized_pools: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryExternalIncentiveGaugesRequest {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryExternalIncentiveGaugesResponse { + #[prost(message, repeated, tag = "1")] + pub data: ::prost::alloc::vec::Vec, +} +// @@protoc_insertion_point(module) diff --git a/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.epochs.rs b/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.epochs.rs new file mode 100644 index 000000000..a5bf03b8f --- /dev/null +++ b/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.epochs.rs @@ -0,0 +1,42 @@ +// @generated +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EpochInfo { + #[prost(string, tag = "1")] + pub identifier: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub start_time: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag = "3")] + pub duration: ::core::option::Option<::prost_types::Duration>, + #[prost(int64, tag = "4")] + pub current_epoch: i64, + #[prost(message, optional, tag = "5")] + pub current_epoch_start_time: ::core::option::Option<::prost_types::Timestamp>, + #[prost(bool, tag = "6")] + pub epoch_counting_started: bool, + #[prost(int64, tag = "8")] + pub current_epoch_start_height: i64, +} +/// GenesisState defines the epochs module's genesis state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, repeated, tag = "1")] + pub epochs: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEpochsInfoRequest {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEpochsInfoResponse { + #[prost(message, repeated, tag = "1")] + pub epochs: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryCurrentEpochRequest { + #[prost(string, tag = "1")] + pub identifier: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryCurrentEpochResponse { + #[prost(int64, tag = "1")] + pub current_epoch: i64, +} +// @@protoc_insertion_point(module) diff --git a/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.qoracle.osmosis.rs b/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.qoracle.osmosis.rs new file mode 100644 index 000000000..319a4d1c9 --- /dev/null +++ b/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.qoracle.osmosis.rs @@ -0,0 +1,107 @@ +// @generated +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + #[prost(bool, tag = "1")] + pub enabled: bool, + /// Identifier of the epoch that we trigger the icq request + #[prost(string, tag = "2")] + pub epoch_identifier: ::prost::alloc::string::String, + /// Identifier of authorized channel that we are allowed to send/receive packets + #[prost(string, tag = "3")] + pub authorized_channel: ::prost::alloc::string::String, + /// Timeout height relative to the current block height. The timeout is disabled when set to 0. + #[prost(message, optional, tag = "4")] + pub packet_timeout_height: + ::core::option::Option, + /// Timeout timestamp relative to counterparty chain current time. The timeout is disabled when set to 0. + #[prost(uint64, tag = "5")] + pub packet_timeout_timestamp: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OsmosisRequestState { + #[prost(uint64, tag = "1")] + pub packet_sequence: u64, + #[prost(bool, tag = "2")] + pub acknowledged: bool, + #[prost(bool, tag = "3")] + pub failed: bool, + #[prost(int64, tag = "4")] + pub updated_at_height: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IncentivizedPools { + #[prost(message, repeated, tag = "1")] + pub incentivized_pools: ::prost::alloc::vec::Vec< + super::super::super::super::osmosis::poolincentives::v1beta1::IncentivizedPool, + >, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EpochsInfo { + #[prost(message, repeated, tag = "1")] + pub epochs_info: + ::prost::alloc::vec::Vec, +} +/// QueryParamsRequest is request type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +/// QueryParamsResponse is response type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params holds all the parameters of this module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryStateRequest {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryStateResponse { + #[prost(message, optional, tag = "2")] + pub params_request_state: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub incentivized_pools_state: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub pools_state: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryChainParamsRequest {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryChainParamsResponse { + #[prost(message, repeated, tag = "1")] + pub epochs_info: + ::prost::alloc::vec::Vec, + #[prost(int64, repeated, packed = "false", tag = "2")] + pub lockable_durations: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "3")] + pub mint_params: + ::core::option::Option, + #[prost(bytes = "vec", tag = "4")] + pub mint_epoch_provisions: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "5")] + pub distr_info: ::core::option::Option< + super::super::super::super::osmosis::poolincentives::v1beta1::DistrInfo, + >, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryIncentivizedPoolsRequest {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryIncentivizedPoolsResponse { + #[prost(message, repeated, tag = "1")] + pub incentivized_pools: ::prost::alloc::vec::Vec< + super::super::super::super::osmosis::poolincentives::v1beta1::IncentivizedPool, + >, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPoolsRequest { + #[prost(message, optional, tag = "1")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPoolsResponse { + #[prost(message, repeated, tag = "1")] + pub pools: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +// @@protoc_insertion_point(module) diff --git a/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.qoracle.rs b/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.qoracle.rs new file mode 100644 index 000000000..3d314851e --- /dev/null +++ b/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.qoracle.rs @@ -0,0 +1,74 @@ +// @generated +/// Params defines the parameters for the module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params {} +/// GenesisState defines the qoracle module's genesis state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub osmosis_genesis_state: ::core::option::Option, +} +/// OsmosisGenesisState defines the qoracle osmosis submodule's genesis state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OsmosisGenesisState { + #[prost(string, tag = "1")] + pub port: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +/// Pool defines the generalized structure of a liquidity pool coming from any source chain to qoracle. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Pool { + /// The identifier of this pool in the source chain + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// List of assets with their current volume in pool + #[prost(message, repeated, tag = "2")] + pub assets: ::prost::alloc::vec::Vec, + /// Total volume locked in the pool + #[prost(bytes = "vec", tag = "3")] + pub tvl: ::prost::alloc::vec::Vec, + /// Annual percentage yield of the pool + #[prost(bytes = "vec", tag = "4")] + pub apy: ::prost::alloc::vec::Vec, + /// Raw data of pool structure stored in the source chain + #[prost(message, optional, tag = "5")] + pub raw: ::core::option::Option<::prost_types::Any>, + /// Last time this pool was updated + #[prost(message, optional, tag = "6")] + pub updated_at: ::core::option::Option<::prost_types::Timestamp>, +} +/// QueryParamsRequest is request type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +/// QueryParamsResponse is response type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params holds all the parameters of this module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +/// QueryPoolsRequest is request type for the Query/Pools RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPoolsRequest { + /// denom filters the pools by their denom. If empty, pools with any denom returned. + #[prost(string, tag = "1")] + pub denom: ::prost::alloc::string::String, + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +/// QueryPoolsResponse is response type for the Query/Pools RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPoolsResponse { + #[prost(message, repeated, tag = "1")] + pub pools: ::prost::alloc::vec::Vec, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +// @@protoc_insertion_point(module) diff --git a/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.qtransfer.rs b/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.qtransfer.rs new file mode 100644 index 000000000..acbc6313a --- /dev/null +++ b/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.qtransfer.rs @@ -0,0 +1,24 @@ +// @generated +/// Params defines the parameters for the module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + #[prost(bool, tag = "1")] + pub wasm_hooks_enabled: bool, +} +/// GenesisState defines the qtransfer module's genesis state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +/// QueryParamsRequest is request type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +/// QueryParamsResponse is response type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params holds all the parameters of this module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +// @@protoc_insertion_point(module) diff --git a/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.qvesting.rs b/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.qvesting.rs new file mode 100644 index 000000000..2d67ab82e --- /dev/null +++ b/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.qvesting.rs @@ -0,0 +1,94 @@ +// @generated +/// Params defines the parameters for the module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params {} +/// GenesisState defines the qvesting module's genesis state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +/// QueryParamsRequest is request type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +/// QueryParamsResponse is response type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params holds all the parameters of this module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +/// QuerySpendableBalancesRequest defines the gRPC request structure for querying +/// an account's spendable balances. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySpendableBalancesRequest { + /// address is the address to query spendable balances for. + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +/// QuerySpendableBalancesResponse defines the gRPC response structure for querying +/// an account's spendable balances. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySpendableBalancesResponse { + /// balances is the spendable balances of all the coins. + #[prost(message, repeated, tag = "1")] + pub balances: ::prost::alloc::vec::Vec, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +/// QueryVestingAccountsRequest is the request type for the Query/Accounts RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryVestingAccountsRequest { + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "1")] + pub pagination: + ::core::option::Option, +} +/// QueryVestingAccountsResponse is the response type for the Query/Accounts RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryVestingAccountsResponse { + /// accounts are the existing vesting accounts + /// repeated google.protobuf.Any accounts = 1 [(cosmos_proto.accepts_interface) = "VestingAccount"]; + #[prost(message, repeated, tag = "1")] + pub accounts: ::prost::alloc::vec::Vec<::prost_types::Any>, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +/// QueryVestingLockedSupplyRequest is the request type for the Query/VestingLockedSupply RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryVestingLockedSupplyRequest { + /// denom is the coin denom to query locked supply for. + #[prost(string, tag = "1")] + pub denom: ::prost::alloc::string::String, +} +/// QueryVestingAccountsResponse is the response type for the Query/VestingLockedSupply RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryVestingLockedSupplyResponse { + /// amount is the supply of the coin. + #[prost(message, optional, tag = "1")] + pub amount: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateVestingAccount { + #[prost(string, tag = "1")] + pub from_address: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub to_address: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "3")] + pub amount: ::prost::alloc::vec::Vec, + #[prost(int64, tag = "4")] + pub start_time: i64, + #[prost(int64, tag = "5")] + pub end_time: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateVestingAccountResponse {} +// @@protoc_insertion_point(module) diff --git a/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.tokenfactory.v1beta1.rs b/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.tokenfactory.v1beta1.rs new file mode 100644 index 000000000..079694864 --- /dev/null +++ b/smart-contracts/quasar/packages/quasar-std/src/quasarlabs.quasarnode.tokenfactory.v1beta1.rs @@ -0,0 +1,171 @@ +// @generated +/// DenomAuthorityMetadata specifies metadata for addresses that have specific +/// capabilities over a token factory denom. Right now there is only one Admin +/// permission, but is planned to be extended to the future. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DenomAuthorityMetadata { + /// Can be empty for no admin, or a valid osmosis address + #[prost(string, tag = "1")] + pub admin: ::prost::alloc::string::String, +} +/// Params defines the parameters for the tokenfactory module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + #[prost(message, repeated, tag = "1")] + pub denom_creation_fee: ::prost::alloc::vec::Vec, + /// if denom_creation_fee is an empty array, then this field is used to add more gas consumption + /// to the base cost. + /// + #[prost(uint64, tag = "2")] + pub denom_creation_gas_consume: u64, +} +/// GenesisState defines the tokenfactory module's genesis state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// params defines the paramaters of the module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub factory_denoms: ::prost::alloc::vec::Vec, +} +/// GenesisDenom defines a tokenfactory denom that is defined within genesis +/// state. The structure contains DenomAuthorityMetadata which defines the +/// denom's admin. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisDenom { + #[prost(string, tag = "1")] + pub denom: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub authority_metadata: ::core::option::Option, +} +/// QueryParamsRequest is the request type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +/// QueryParamsResponse is the response type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params defines the parameters of the module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +/// QueryDenomAuthorityMetadataRequest defines the request structure for the +/// DenomAuthorityMetadata gRPC query. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDenomAuthorityMetadataRequest { + #[prost(string, tag = "1")] + pub denom: ::prost::alloc::string::String, +} +/// QueryDenomAuthorityMetadataResponse defines the response structure for the +/// DenomAuthorityMetadata gRPC query. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDenomAuthorityMetadataResponse { + #[prost(message, optional, tag = "1")] + pub authority_metadata: ::core::option::Option, +} +/// QueryDenomsFromCreatorRequest defines the request structure for the +/// DenomsFromCreator gRPC query. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDenomsFromCreatorRequest { + #[prost(string, tag = "1")] + pub creator: ::prost::alloc::string::String, +} +/// QueryDenomsFromCreatorRequest defines the response structure for the +/// DenomsFromCreator gRPC query. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDenomsFromCreatorResponse { + #[prost(string, repeated, tag = "1")] + pub denoms: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// MsgCreateDenom defines the message structure for the CreateDenom gRPC service +/// method. It allows an account to create a new denom. It requires a sender +/// address and a sub denomination. The (sender_address, sub_denomination) tuple +/// must be unique and cannot be re-used. +/// +/// The resulting denom created is defined as +/// . The resulting denom's admin is +/// originally set to be the creator, but this can be changed later. The token +/// denom does not indicate the current admin. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateDenom { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + /// subdenom can be up to 44 "alphanumeric" characters long. + #[prost(string, tag = "2")] + pub subdenom: ::prost::alloc::string::String, +} +/// MsgCreateDenomResponse is the return value of MsgCreateDenom +/// It returns the full string of the newly created denom +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateDenomResponse { + #[prost(string, tag = "1")] + pub new_token_denom: ::prost::alloc::string::String, +} +/// MsgMint is the sdk.Msg type for allowing an admin account to mint +/// more of a token. For now, we only support minting to the sender account +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgMint { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub amount: ::core::option::Option, + #[prost(string, tag = "3")] + pub mint_to_address: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgMintResponse {} +/// MsgBurn is the sdk.Msg type for allowing an admin account to burn +/// a token. For now, we only support burning from the sender account. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgBurn { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub amount: ::core::option::Option, + #[prost(string, tag = "3")] + pub burn_from_address: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgBurnResponse {} +/// MsgChangeAdmin is the sdk.Msg type for allowing an admin account to reassign +/// adminship of a denom to a new account +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgChangeAdmin { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub denom: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub new_admin: ::prost::alloc::string::String, +} +/// MsgChangeAdminResponse defines the response structure for an executed +/// MsgChangeAdmin message. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgChangeAdminResponse {} +// message MsgForceTransfer { +// string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; +// cosmos.base.v1beta1.Coin amount = 2 [ +// (gogoproto.moretags) = "yaml:\"amount\"", +// (gogoproto.nullable) = false +// ]; +// string transferFromAddress = 3 +// [ (gogoproto.moretags) = "yaml:\"transfer_from_address\"" ]; +// string transferToAddress = 4 +// [ (gogoproto.moretags) = "yaml:\"transfer_to_address\"" ]; +// } + +// message MsgForceTransferResponse {} + +/// MsgSetDenomMetadata is the sdk.Msg type for allowing an admin account to set +/// the denom's bank metadata +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSetDenomMetadata { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub metadata: ::core::option::Option, +} +/// MsgSetDenomMetadataResponse defines the response structure for an executed +/// MsgSetDenomMetadata message. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSetDenomMetadataResponse {} +// @@protoc_insertion_point(module) diff --git a/smart-contracts/quasar/proto-build/Cargo.toml b/smart-contracts/quasar/proto-build/Cargo.toml new file mode 100644 index 000000000..66fbf6d30 --- /dev/null +++ b/smart-contracts/quasar/proto-build/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "proto-build" +version = "0.1.0" +authors = ["Quasar"] +edition = "2018" +publish = false + +[dependencies] +prost = { workspace = true } +prost-build = { workspace = true } +tonic = { workspace = true } +tonic-build = { workspace = true } +regex = { workspace = true } +walkdir = { workspace = true } \ No newline at end of file diff --git a/smart-contracts/quasar/proto-build/buf.quasar.gen.yaml b/smart-contracts/quasar/proto-build/buf.quasar.gen.yaml new file mode 100644 index 000000000..24638da20 --- /dev/null +++ b/smart-contracts/quasar/proto-build/buf.quasar.gen.yaml @@ -0,0 +1,8 @@ +version: v1 +plugins: + - plugin: buf.build/community/neoeinstein-prost:v0.2.1 + out: . + opt: + - extern_path=.cosmos=.cosmos_sdk_proto::cosmos + - extern_path=.ibc=.cosmos_sdk_proto::ibc + - extern_path=.tendermint=tendermint_proto::v0_38 \ No newline at end of file diff --git a/smart-contracts/quasar/proto-build/buf.yaml b/smart-contracts/quasar/proto-build/buf.yaml new file mode 100644 index 000000000..4e57cc82c --- /dev/null +++ b/smart-contracts/quasar/proto-build/buf.yaml @@ -0,0 +1,4 @@ +version: v1 +name: buf.build/quasar/quasar-std +deps: + - buf.build/cosmos/ibc diff --git a/smart-contracts/quasar/proto-build/src/main.rs b/smart-contracts/quasar/proto-build/src/main.rs new file mode 100644 index 000000000..1cb5c162e --- /dev/null +++ b/smart-contracts/quasar/proto-build/src/main.rs @@ -0,0 +1,287 @@ +//! This is based on the proto-compiler code in github.com/informalsystems/ibc-rs. + +use regex::Regex; +use std::collections::BTreeMap; +use std::io::Write; +use std::{ + ffi::{OsStr, OsString}, + fs::{self, create_dir_all, File}, + io, + path::{Path, PathBuf}, + process, +}; +use walkdir::WalkDir; + +const PROTO_BUILD_DIR: &str = "proto-build"; +const BUF_CONFIG_FILE: &str = "buf.yaml"; +const BUF_GEN_CONFIG_FILE: &str = "buf.quasar.gen.yaml"; +const PROTO_DIR: &str = "packages/quasar-std/src"; +const TMP_BUILD_DIR: &str = "/tmp/tmp-protobuf/"; +const QUASAR_DIR: &str = "../../"; + +macro_rules! info { + ($msg:expr) => { + println!("[info] {}", $msg) + }; + ($fmt:expr, $($arg:tt)+) => { + info!(&format!($fmt, $($arg)+)) + }; +} + +fn main() { + let tmp_build_dir: PathBuf = TMP_BUILD_DIR.parse().unwrap(); + let proto_dir: PathBuf = PROTO_DIR.parse().unwrap(); + + if tmp_build_dir.exists() { + fs::remove_dir_all(tmp_build_dir.clone()).unwrap(); + } + + let temp_dir = tmp_build_dir.join("quasar"); + + compile_proto_and_services(&temp_dir); + copy_generated_files(&temp_dir, &proto_dir); + + if tmp_build_dir.exists() { + fs::remove_dir_all(tmp_build_dir.clone()).unwrap(); + } + + info!("Running rustfmt on prost/tonic-generated code"); + run_rustfmt(&proto_dir); +} + +fn run_cmd(cmd: impl AsRef, args: impl IntoIterator>) { + let stdout = process::Stdio::inherit(); + let exit_status = process::Command::new(&cmd) + .args(args) + .stdout(stdout) + .status() + .unwrap_or_else(|e| match e.kind() { + io::ErrorKind::NotFound => panic!( + "error running '{:?}': command not found. Is it installed?", + cmd.as_ref() + ), + _ => panic!("error running '{:?}': {:?}", cmd.as_ref(), e), + }); + + if !exit_status.success() { + match exit_status.code() { + Some(code) => panic!("{:?} exited with error code: {:?}", cmd.as_ref(), code), + None => panic!("{:?} exited without error code", cmd.as_ref()), + } + } +} + +fn run_buf(proto_path: impl AsRef, out_dir: impl AsRef) { + let proto_build_dir = Path::new(PROTO_BUILD_DIR); + let buf_cfg_path = proto_build_dir.join(BUF_CONFIG_FILE); + let buf_gen_cfg_path = proto_build_dir.join(BUF_GEN_CONFIG_FILE); + run_cmd( + "buf", + [ + "generate", + "--template", + buf_gen_cfg_path.to_str().unwrap(), + "--config", + buf_cfg_path.to_str().unwrap(), + "-o", + &out_dir.as_ref().display().to_string(), + &proto_path.as_ref().display().to_string(), + ], + ); +} + +fn run_rustfmt(dir: &Path) { + let mut args = ["--edition", "2021"] + .iter() + .map(Into::into) + .collect::>(); + + args.extend( + WalkDir::new(dir) + .into_iter() + .filter_map(|e| e.ok()) + .filter(|e| e.file_type().is_file() && e.path().extension() == Some(OsStr::new("rs"))) + .map(|e| e.into_path()) + .map(Into::into), + ); + + run_cmd("rustfmt", args); +} + +fn compile_proto_and_services(out_dir: &Path) { + let sdk_dir = Path::new(QUASAR_DIR); + let proto_path = sdk_dir.join("proto"); + let proto_paths = [format!("{}/proto/", sdk_dir.display())]; + + // List available proto files + let mut protos: Vec = vec![]; + collect_protos(&proto_paths, &mut protos); + + // Compile all proto client for GRPC services + info!("Compiling proto clients for GRPC services!"); + run_buf(proto_path, out_dir); + info!("=> Done!"); +} + +/// collect_protos walks every path in `proto_paths` and recursively locates all .proto +/// files in each path's subdirectories, adding the full path of each file to `protos` +/// +/// Any errors encountered will cause failure for the path provided to WalkDir::new() +fn collect_protos(proto_paths: &[String], protos: &mut Vec) { + for proto_path in proto_paths { + protos.append( + &mut WalkDir::new(proto_path) + .into_iter() + .filter_map(|e| e.ok()) + .filter(|e| { + e.file_type().is_file() + && e.path().extension().is_some() + && e.path().extension().unwrap() == "proto" + }) + .map(|e| e.into_path()) + .collect(), + ); + } +} + +fn copy_generated_files(from_dir: &Path, to_dir: &Path) { + info!("Copying generated files into '{}'...", to_dir.display()); + + // Remove old compiled files + // remove_dir_all(to_dir).unwrap_or_default(); + create_dir_all(to_dir).unwrap(); + + // Copy new compiled files (prost does not use folder structures) + let files = WalkDir::new(from_dir) + .into_iter() + .filter_map(|e| e.ok()) + .filter(|e| { + e.file_type().is_file() + && str::ends_with(e.file_name().to_str().unwrap_or_default(), ".rs") + }) + .map(|e| { + let filename = e.file_name().to_os_string().to_str().unwrap().to_string(); + copy_and_patch(e.path(), format!("{}/{}", to_dir.display(), filename)).unwrap(); + filename + }) + .collect::>(); + + let mut file = File::create("packages/quasar-std/src/lib.rs").expect("Unable to create file"); + file.write_all(generate_mod_rs(files).as_bytes()) + .expect("Unable to write data"); +} + +fn copy_and_patch(src: impl AsRef, dest: impl AsRef) -> io::Result<()> { + /// Regex substitutions to apply to the prost-generated output + const REPLACEMENTS: &[(&str, &str)] = &[ + // Use `tendermint-proto` proto definitions + ("(super::)+tendermint", "tendermint_proto"), + // Feature-gate gRPC client modules + ( + "/// Generated client implementations.", + "/// Generated client implementations.\n\ + #[cfg(feature = \"grpc\")]", + ), + // Feature-gate gRPC impls which use `tonic::transport` + ( + "impl(.+)tonic::transport(.+)", + "#[cfg(feature = \"grpc-transport\")]\n \ + impl${1}tonic::transport${2}", + ), + // Feature-gate gRPC server modules + ( + "/// Generated server implementations.", + "/// Generated server implementations.\n\ + #[cfg(feature = \"grpc\")]", + ), + ]; + + let mut contents = fs::read_to_string(src)?; + + for &(regex, replacement) in REPLACEMENTS { + contents = Regex::new(regex) + .unwrap_or_else(|_| panic!("invalid regex: {}", regex)) + .replace_all(&contents, replacement) + .to_string(); + } + + fs::write(dest, &contents) +} + +enum ModuleContent { + Submodule(BTreeMap), + File(String), +} + +fn generate_mod_rs(file_names: Vec) -> String { + let mut mod_rs = String::new(); + let mut modules = BTreeMap::new(); + + for file_name in file_names { + let parts: Vec<&str> = file_name.split('.').collect(); + insert_into_module(&mut modules, &parts, file_name.clone()); + } + + fn insert_into_module( + modules: &mut BTreeMap, + parts: &[&str], + file_name: String, + ) { + if parts.len() == 1 { + modules.insert( + parts[0].to_string(), + ModuleContent::File(file_name.to_string()), + ); + } else { + let module_name = parts[0]; + let sub_parts = &parts[1..]; + let sub_module = modules + .entry(module_name.to_string()) + .or_insert_with(|| ModuleContent::Submodule(BTreeMap::new())); + match sub_module { + ModuleContent::Submodule(sub_module_map) => { + insert_into_module(sub_module_map, sub_parts, file_name); + } + ModuleContent::File(_) => { + modules.insert( + module_name.to_string(), + ModuleContent::File(file_name.to_string()), + ); + } + } + } + } + + fn generate_module( + module_dict: &BTreeMap, + mod_rs: &mut String, + indentation: &str, + ) { + for (module_name, content) in module_dict { + if module_name != "rs" { + mod_rs.push_str(&format!("{}pub mod {} {{\n", indentation, module_name)); + match content { + ModuleContent::Submodule(submodule) => { + generate_module(submodule, mod_rs, &format!("{} ", indentation)); + } + ModuleContent::File(file) => { + mod_rs.push_str(&format!("{} include!(\"{}\");\n", indentation, file)); + } + } + mod_rs.push_str(&format!("{}}}\n", indentation)); + } else { + match content { + ModuleContent::Submodule(submodule) => { + generate_module(submodule, mod_rs, indentation); + } + ModuleContent::File(file) => { + mod_rs.push_str(&format!("{}include!(\"{}\");\n", indentation, file)); + } + } + } + } + } + + generate_module(&modules, &mut mod_rs, ""); + mod_rs +}