diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 0000000..bf71b83 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,20 @@ +# ref: https://docs.codecov.com/docs/codecovyml-reference + +coverage: + range: 40..92 + round: down + precision: 2 + # status: See https://docs.codecov.com/docs/commit-status + status: + project: + default: + target: auto + threshold: 1% # Allow coverage to drop by X%, posting a success status. + # removed_code_behavior: Takes values [off, removals_only, adjust_base] + removed_code_behavior: adjust_base + +# See https://docs.codecov.com/docs/pull-request-comments +comment: + layout: "files" + behavior: default + require_changes: true # if true: only post the comment if coverage changes \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 0e99569..e4e7c41 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,7 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ - "gimli", + "gimli 0.28.0", ] [[package]] @@ -72,7 +72,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -82,7 +82,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -94,6 +94,12 @@ dependencies = [ "backtrace", ] +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + [[package]] name = "assert_cmd" version = "2.0.12" @@ -177,6 +183,18 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "block-buffer" version = "0.9.0" @@ -218,6 +236,28 @@ version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +[[package]] +name = "bytecheck" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" +dependencies = [ + "bytecheck_derive", + "ptr_meta", + "simdutf8", +] + +[[package]] +name = "bytecheck_derive" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "byteorder" version = "1.5.0" @@ -285,6 +325,12 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +[[package]] +name = "clru" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8191fa7302e03607ff0e237d4246cc043ff5b3cb9409d995172ba3bea16b807" + [[package]] name = "colorchoice" version = "1.0.0" @@ -304,7 +350,6 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus", - "nibiru-macro", "nibiru-std", "schemars", "serde", @@ -327,6 +372,19 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +[[package]] +name = "corosensei" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80128832c58ea9cbd041d2a759ec449224487b2c1e400453d99d244eead87a8e" +dependencies = [ + "autocfg", + "cfg-if", + "libc", + "scopeguard", + "windows-sys 0.33.0", +] + [[package]] name = "cosmwasm-crypto" version = "1.5.0" @@ -396,6 +454,31 @@ dependencies = [ "thiserror", ] +[[package]] +name = "cosmwasm-vm" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ce190445de4a64d1b046f453b1f52e1e3df1fb481ad5cb039f82d7d47375cb9" +dependencies = [ + "bitflags 1.3.2", + "bytecheck", + "bytes", + "clru", + "cosmwasm-crypto", + "cosmwasm-std", + "crc32fast", + "derivative", + "enumset", + "hex", + "schemars", + "serde", + "serde_json", + "sha2 0.10.8", + "thiserror", + "wasmer", + "wasmer-middlewares", +] + [[package]] name = "cpufeatures" version = "0.2.9" @@ -405,6 +488,141 @@ dependencies = [ "libc", ] +[[package]] +name = "cranelift-bforest" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2ab4512dfd3a6f4be184403a195f76e81a8a9f9e6c898e19d2dc3ce20e0115" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98b022ed2a5913a38839dfbafe6cf135342661293b08049843362df4301261dc" +dependencies = [ + "arrayvec", + "bumpalo", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-egraph", + "cranelift-entity", + "cranelift-isle", + "gimli 0.26.2", + "log", + "regalloc2", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "639307b45434ad112a98f8300c0f0ab085cbefcd767efcdef9ef19d4c0756e74" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "278e52e29c53fcf32431ef08406c295699a70306d05a0715c5b1bf50e33a9ab7" + +[[package]] +name = "cranelift-egraph" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624b54323b06e675293939311943ba82d323bb340468ce1889be5da7932c8d73" +dependencies = [ + "cranelift-entity", + "fxhash", + "hashbrown 0.12.3", + "indexmap", + "log", + "smallvec", +] + +[[package]] +name = "cranelift-entity" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a59bcbca89c3f1b70b93ab3cbba5e5e0cbf3e63dadb23c7525cb142e21a9d4c" + +[[package]] +name = "cranelift-frontend" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d70abacb8cfef3dc8ff7e8836e9c1d70f7967dfdac824a4cd5e30223415aca6" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "393bc73c451830ff8dbb3a07f61843d6cb41a084f9996319917c0b291ed785bb" + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset 0.9.0", + "scopeguard", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + [[package]] name = "crypto-bigint" version = "0.5.3" @@ -475,7 +693,7 @@ dependencies = [ "cw-storage-plus", "cw-utils", "derivative", - "itertools", + "itertools 0.11.0", "prost", "schemars", "serde", @@ -485,16 +703,17 @@ dependencies = [ [[package]] name = "cw-multi-test" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579e2c2f2c0877b839c5cad85e67811074e854a50c1ff3085eb8290b1c27809c" +checksum = "561604d987be2ef3e34db1f01f0c98544106d84d8be2af92c0737bb199af452c" dependencies = [ "anyhow", + "bech32", "cosmwasm-std", "cw-storage-plus", "cw-utils", "derivative", - "itertools", + "itertools 0.12.0", "prost", "schemars", "serde", @@ -530,9 +749,9 @@ dependencies = [ [[package]] name = "cw-storage-plus" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f0e92a069d62067f3472c62e30adedb4cab1754725c0f2a682b3128d2bf3c79" +checksum = "d5ff29294ee99373e2cd5fd21786a3c0ced99a52fec2ca347d565489c61b723c" dependencies = [ "cosmwasm-std", "schemars", @@ -541,9 +760,9 @@ dependencies = [ [[package]] name = "cw-utils" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9f351a4e4d81ef7c890e44d903f8c0bdcdc00f094fd3a181eaf70c0eec7a3a" +checksum = "1c4a657e5caacc3a0d00ee96ca8618745d050b8f757c709babafb81208d4239c" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -683,6 +902,53 @@ dependencies = [ "thiserror", ] +[[package]] +name = "darling" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "darling_macro" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown 0.14.3", + "lock_api", + "once_cell", + "parking_lot_core", +] + [[package]] name = "der" version = "0.7.8" @@ -743,6 +1009,32 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23d2f3407d9a573d666de4b5bdf10569d73ca9478087346697dcbae6244bfbcd" +[[package]] +name = "dynasm" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "add9a102807b524ec050363f09e06f1504214b0e1c7797f64261c891022dce8b" +dependencies = [ + "bitflags 1.3.2", + "byteorder", + "lazy_static", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "dynasmrt" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64fba5a42bd76a17cad4bfa00de168ee1cbfa06a5e8ce992ae880218c05641a9" +dependencies = [ + "byteorder", + "dynasm", + "memmap2 0.5.10", +] + [[package]] name = "ecdsa" version = "0.16.8" @@ -764,7 +1056,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" dependencies = [ "curve25519-dalek", - "hashbrown", + "hashbrown 0.12.3", "hex", "rand_core 0.6.4", "serde", @@ -806,6 +1098,47 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enum-iterator" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eeac5c5edb79e4e39fe8439ef35207780a11f69c52cbe424ce3dfad4cb78de6" +dependencies = [ + "enum-iterator-derive", +] + +[[package]] +name = "enum-iterator-derive" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "enumset" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "226c0da7462c13fb57e5cc9e0dc8f0635e7d27f276a3a7fd30054647f669007d" +dependencies = [ + "enumset_derive", +] + +[[package]] +name = "enumset_derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "errno" version = "0.3.4" @@ -814,7 +1147,7 @@ checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480" dependencies = [ "errno-dragonfly", "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -827,6 +1160,12 @@ dependencies = [ "libc", ] +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + [[package]] name = "fastrand" version = "2.0.1" @@ -879,44 +1218,50 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8cbd1169bd7b4a0a20d92b9af7a7e0422888bd38a6f5ec29c1fd8c1558a272e" +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-core", "futures-io", @@ -927,6 +1272,15 @@ dependencies = [ "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -949,6 +1303,17 @@ dependencies = [ "wasi", ] +[[package]] +name = "gimli" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +dependencies = [ + "fallible-iterator", + "indexmap", + "stable_deref_trait", +] + [[package]] name = "gimli" version = "0.28.0" @@ -994,6 +1359,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + [[package]] name = "heck" version = "0.4.1" @@ -1027,7 +1398,7 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" dependencies = [ - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1101,6 +1472,12 @@ dependencies = [ "tokio-native-tls", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.4.0" @@ -1117,7 +1494,7 @@ version = "0.2.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-multi-test 0.18.0", + "cw-multi-test 0.19.0", "cw-storage-plus", "cw-utils", "cw2", @@ -1136,7 +1513,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -1154,6 +1531,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.9" @@ -1189,6 +1575,12 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + [[package]] name = "libc" version = "0.2.149" @@ -1201,6 +1593,16 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45786cec4d5e54a224b15cb9f06751883103a27c19c93eda09b0b4f5f08fefac" +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "lockup" version = "0.2.0" @@ -1222,6 +1624,15 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + [[package]] name = "memchr" version = "2.6.4" @@ -1229,13 +1640,49 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] -name = "mime" -version = "0.3.17" +name = "memmap2" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] [[package]] -name = "miniz_oxide" +name = "memmap2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d28bba84adfe6646737845bc5ebbfa2c08424eb1c37e94a1fd2a82adb56a872" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + +[[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.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" @@ -1251,9 +1698,15 @@ checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", "wasi", - "windows-sys", + "windows-sys 0.48.0", ] +[[package]] +name = "more-asserts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" + [[package]] name = "native-tls" version = "0.2.11" @@ -1303,6 +1756,24 @@ dependencies = [ "thiserror", ] +[[package]] +name = "nibi-stargate-perp" +version = "0.2.0" +dependencies = [ + "anyhow", + "cosmwasm-schema", + "cosmwasm-std", + "cosmwasm-vm", + "cw-storage-plus", + "cw-utils", + "cw2", + "nibiru-std", + "schemars", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "nibiru-macro" version = "0.1.0" @@ -1315,12 +1786,11 @@ dependencies = [ [[package]] name = "nibiru-std" -version = "0.0.2" +version = "0.0.3" dependencies = [ "anyhow", "cosmwasm-schema", "cosmwasm-std", - "nibiru-macro", "prost", "prost-types", "serde", @@ -1420,6 +1890,19 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.4.1", + "smallvec", + "windows-targets", +] + [[package]] name = "percent-encoding" version = "2.3.0" @@ -1462,7 +1945,7 @@ checksum = "6dfc28575c2e3f19cb3c73b93af36460ae898d426eba6fc15b9bd2a5220758a0" dependencies = [ "anstyle", "difflib", - "itertools", + "itertools 0.11.0", "predicates-core", ] @@ -1497,6 +1980,30 @@ dependencies = [ "thiserror", ] +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro2" version = "1.0.68" @@ -1508,9 +2015,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fdd22f3b9c31b53c060df4a0613a1c7f062d4115a2b984dd15b1858f7e340d" +checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" dependencies = [ "bytes", "prost-derive", @@ -1518,12 +2025,12 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32" +checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" dependencies = [ "anyhow", - "itertools", + "itertools 0.11.0", "proc-macro2", "quote", "syn 2.0.38", @@ -1538,6 +2045,26 @@ dependencies = [ "prost", ] +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "quote" version = "1.0.33" @@ -1547,6 +2074,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand_core" version = "0.5.1" @@ -1562,6 +2095,26 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rayon" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.3.5" @@ -1571,6 +2124,27 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "regalloc2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300d4fbfb40c1c66a78ba3ddd41c1110247cf52f97b87d0f2fc9209bd49b030c" +dependencies = [ + "fxhash", + "log", + "slice-group-by", + "smallvec", +] + [[package]] name = "regex" version = "1.9.6" @@ -1600,6 +2174,27 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +[[package]] +name = "region" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" +dependencies = [ + "bitflags 1.3.2", + "libc", + "mach", + "winapi", +] + +[[package]] +name = "rend" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" +dependencies = [ + "bytecheck", +] + [[package]] name = "reqwest" version = "0.11.22" @@ -1648,6 +2243,35 @@ dependencies = [ "subtle", ] +[[package]] +name = "rkyv" +version = "0.7.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" +dependencies = [ + "bitvec", + "bytecheck", + "hashbrown 0.12.3", + "indexmap", + "ptr_meta", + "rend", + "rkyv_derive", + "seahash", + "tinyvec", + "uuid", +] + +[[package]] +name = "rkyv_derive" +version = "0.7.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -1664,7 +2288,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1688,14 +2312,14 @@ version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "schemars" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f7b0ce13155372a76ee2e1c5ffba1fe61ede73fbea5630d61eee6fac4929c0c" +checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29" dependencies = [ "dyn-clone", "schemars_derive", @@ -1705,9 +2329,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e85e2a16b12bdb763244c69ab79363d71db2b4b918a2def53f80b02e0574b13c" +checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967" dependencies = [ "proc-macro2", "quote", @@ -1715,6 +2339,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + [[package]] name = "scripts" version = "0.1.0" @@ -1729,6 +2359,12 @@ dependencies = [ "walkdir", ] +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + [[package]] name = "sec1" version = "0.7.3" @@ -1766,6 +2402,12 @@ dependencies = [ "libc", ] +[[package]] +name = "self_cell" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e388332cd64eb80cd595a00941baf513caffae8dce9cfd0467fc9c66397dade6" + [[package]] name = "semver" version = "1.0.20" @@ -1774,9 +2416,9 @@ checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "serde" -version = "1.0.190" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] @@ -1799,11 +2441,22 @@ dependencies = [ "serde", ] +[[package]] +name = "serde-wasm-bindgen" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b4c031cd0d9014307d82b8abf653c0290fbdaeb4c02d00c63cf52f728628bf" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + [[package]] name = "serde_derive" -version = "1.0.190" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", @@ -1868,14 +2521,26 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "shared-buffer" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cf61602ee61e2f83dd016b3e6387245291cf728ea071c378b35088125b4d995" +dependencies = [ + "bytes", + "memmap2 0.6.2", +] + [[package]] name = "shifter" version = "0.2.0" dependencies = [ + "anyhow", "cosmwasm-schema", "cosmwasm-std", + "cw-ownable", "cw-storage-plus", - "nibiru-macro", + "cw2", "nibiru-std", "schemars", "serde", @@ -1892,6 +2557,12 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "simdutf8" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" + [[package]] name = "slab" version = "0.4.9" @@ -1901,6 +2572,18 @@ dependencies = [ "autocfg", ] +[[package]] +name = "slice-group-by" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" + +[[package]] +name = "smallvec" +version = "1.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" + [[package]] name = "socket2" version = "0.4.9" @@ -1918,7 +2601,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1931,6 +2614,12 @@ dependencies = [ "der", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -1992,6 +2681,18 @@ dependencies = [ "libc", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "target-lexicon" +version = "0.12.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" + [[package]] name = "tempfile" version = "3.8.0" @@ -2000,9 +2701,9 @@ checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", + "redox_syscall 0.3.5", "rustix", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2075,7 +2776,7 @@ dependencies = [ "num_cpus", "pin-project-lite", "socket2 0.5.4", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2116,9 +2817,21 @@ checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "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 2.0.38", +] + [[package]] name = "tracing-core" version = "0.1.31" @@ -2178,6 +2891,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "uuid" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" + [[package]] name = "vcpkg" version = "0.2.15" @@ -2249,6 +2968,29 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-downcast" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dac026d43bcca6e7ce1c0956ba68f59edf6403e8e930a5d891be72c31a44340" +dependencies = [ + "js-sys", + "once_cell", + "wasm-bindgen", + "wasm-bindgen-downcast-macros", +] + +[[package]] +name = "wasm-bindgen-downcast-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5020cfa87c7cecefef118055d44e3c1fc122c7ec25701d528ee458a0b45f38f" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "wasm-bindgen-futures" version = "0.4.37" @@ -2290,6 +3032,177 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +[[package]] +name = "wasmer" +version = "4.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e626f958755a90a6552b9528f59b58a62ae288e6c17fcf40e99495bc33c60f0" +dependencies = [ + "bytes", + "cfg-if", + "derivative", + "indexmap", + "js-sys", + "more-asserts", + "rustc-demangle", + "serde", + "serde-wasm-bindgen", + "shared-buffer", + "target-lexicon", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-downcast", + "wasmer-compiler", + "wasmer-compiler-cranelift", + "wasmer-compiler-singlepass", + "wasmer-derive", + "wasmer-types", + "wasmer-vm", + "winapi", +] + +[[package]] +name = "wasmer-compiler" +version = "4.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "848e1922694cf97f4df680a0534c9d72c836378b5eb2313c1708fe1a75b40044" +dependencies = [ + "backtrace", + "bytes", + "cfg-if", + "enum-iterator", + "enumset", + "lazy_static", + "leb128", + "memmap2 0.5.10", + "more-asserts", + "region", + "rkyv", + "self_cell", + "shared-buffer", + "smallvec", + "thiserror", + "wasmer-types", + "wasmer-vm", + "wasmparser", + "winapi", +] + +[[package]] +name = "wasmer-compiler-cranelift" +version = "4.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d96bce6fad15a954edcfc2749b59e47ea7de524b6ef3df392035636491a40b4" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "gimli 0.26.2", + "more-asserts", + "rayon", + "smallvec", + "target-lexicon", + "tracing", + "wasmer-compiler", + "wasmer-types", +] + +[[package]] +name = "wasmer-compiler-singlepass" +version = "4.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebaa865b40ffb3351b03dab9fe9930a5248c25daebd55b464b79b862d9b55ccd" +dependencies = [ + "byteorder", + "dynasm", + "dynasmrt", + "enumset", + "gimli 0.26.2", + "lazy_static", + "more-asserts", + "rayon", + "smallvec", + "wasmer-compiler", + "wasmer-types", +] + +[[package]] +name = "wasmer-derive" +version = "4.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f08f80d166a9279671b7af7a09409c28ede2e0b4e3acabbf0e3cb22c8038ba7" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "wasmer-middlewares" +version = "4.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeb4b87c0ea9f8636c81a8ab8f52bad01c8623c9fcbb3db5f367d5f157fada30" +dependencies = [ + "wasmer", + "wasmer-types", + "wasmer-vm", +] + +[[package]] +name = "wasmer-types" +version = "4.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae2c892882f0b416783fb4310e5697f5c30587f6f9555f9d4f2be85ab39d5d3d" +dependencies = [ + "bytecheck", + "enum-iterator", + "enumset", + "indexmap", + "more-asserts", + "rkyv", + "target-lexicon", + "thiserror", +] + +[[package]] +name = "wasmer-vm" +version = "4.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c0a9a57b627fb39e5a491058d4365f099bc9b140031c000fded24a3306d9480" +dependencies = [ + "backtrace", + "cc", + "cfg-if", + "corosensei", + "crossbeam-queue", + "dashmap", + "derivative", + "enum-iterator", + "fnv", + "indexmap", + "lazy_static", + "libc", + "mach", + "memoffset 0.8.0", + "more-asserts", + "region", + "scopeguard", + "thiserror", + "wasmer-types", + "winapi", +] + +[[package]] +name = "wasmparser" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ea896273ea99b15132414be1da01ab0d8836415083298ecaffbe308eaac87a" +dependencies = [ + "indexmap", + "url", +] + [[package]] name = "web-sys" version = "0.3.64" @@ -2331,6 +3244,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43dbb096663629518eb1dfa72d80243ca5a6aca764cae62a2df70af760a9be75" +dependencies = [ + "windows_aarch64_msvc 0.33.0", + "windows_i686_gnu 0.33.0", + "windows_i686_msvc 0.33.0", + "windows_x86_64_gnu 0.33.0", + "windows_x86_64_msvc 0.33.0", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -2347,12 +3273,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2361,24 +3287,48 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd761fd3eb9ab8cc1ed81e56e567f02dd82c4c837e48ac3b2181b9ffc5060807" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_i686_gnu" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab0cf703a96bab2dc0c02c0fa748491294bf9b7feb27e1f4f96340f208ada0e" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cfdbe89cc9ad7ce618ba34abc34bbb6c36d99e96cae2245b7943cd75ee773d0" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_x86_64_gnu" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4dd9b0c0e9ece7bb22e84d70d01b71c6d6248b81a3c60d11869451b4cb24784" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -2391,6 +3341,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff1e4aa646495048ec7f3ffddc411e1d829c026a2ec62b39da15c1055e406eaa" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -2404,7 +3360,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ "cfg-if", - "windows-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 32e841a..85c0b0c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,8 +27,8 @@ bash-rs = { path = "packages/bash-rs" } # deps: CosmWasm cosmwasm-std = { version = "1.5.0", features = ["stargate"] } cosmwasm-schema = "1.5.0" -cw-storage-plus = { version = "1.1.0" } -cw-multi-test = { version = "0.18.0" } +cw-storage-plus = { version = "1.2.0" } +cw-multi-test = { version = "0.19.0" } cw-utils = { version = "1.0.2" } # Macros for controlling ownership of CosmWasm smart contracts cw-ownable = { version = "0.5.1"} diff --git a/artifacts/bindings_perp.wasm b/artifacts/bindings_perp.wasm deleted file mode 100644 index a15f987..0000000 Binary files a/artifacts/bindings_perp.wasm and /dev/null differ diff --git a/artifacts/checksums.txt b/artifacts/checksums.txt index 1bdadb7..f499110 100644 --- a/artifacts/checksums.txt +++ b/artifacts/checksums.txt @@ -1,9 +1,10 @@ -65548e00849045afabb51ec80f357dc1306198ffbfd548d03660ef40fba29017 bindings_perp.wasm 382c05baf544f2886de849933ecf59e8bc3bcdcdd552d5a63537bd6d63f2ecf1 controller.wasm -715ee1e374074d61da6f9f31b3c645430099368c40f2d310ecec9035ab36bbb9 cw3_flex_multisig.wasm -d8da804212d8936dd83cabd3a72bdf9736177b860fee90e27bd8cdf19081abe7 incentives.wasm -894be8cd463a9342f8844d7877b6d6b92d31977d3b3b63f75a04dece87ebc794 lockup.wasm -48882c2a3cb6a4d660876956a1f3ed20128aaad0b2a42d28db83ce08c47f2ee1 nibi_stargate.wasm -847b7f4da9f1b4691af6a637980f9076b4d467268f40a628dd5730e10fbbaea4 pricefeed.wasm -ac216371a86908eadbe99f5cfd83785eee30b70d6214a3ea5a112c2fc2b33321 shifter.wasm -daeacf4a9738b716d4447e2e843c41cc4e1d69245334d5f7f409250c2c6ff149 token_vesting.wasm +83d726be3842b4df7179b9cfd84c3c9f8856d4252738cf4a6d27fc699f5b43bf cw3_flex_multisig.wasm +f44fd4d9a266f9281bdbedec277d82484c88688ac436d908d41ded1643b0b3f3 incentives.wasm +4c3932c7bcf99112053da52ab15d7718e827d9e71a64d57181c3816dff141e71 lockup.wasm +c7640a727d7216ef76dd70747c5f90c38db2de8d51d9932b1c9df057acf6c265 nibi_stargate.wasm +0e02e84cdfc34c87033d5d21fe973b1f63b29ca8b57d49587b0251321e1312bb nibi_stargate_perp.wasm +ff4971ed2d575eaeafdb1daaed6560422145a0583943729d65dd63e886912134 nusd_valuator.wasm +d4b6a34c5c51c1e080b953fcc43b011f6616e7a49b50fb18bf93ec7dddbe9a95 pricefeed.wasm +f8bc85b93ac5f4bda8c07a2be22b180a9b442440af522fd36866a450561728bf shifter.wasm +dd8fb20aefaf69951c09f42bfe5d9678678d51b9f3e2bba098f3175fb86785a9 token_vesting.wasm diff --git a/artifacts/checksums_intermediate.txt b/artifacts/checksums_intermediate.txt index 003d3e1..1817a17 100644 --- a/artifacts/checksums_intermediate.txt +++ b/artifacts/checksums_intermediate.txt @@ -1,8 +1,10 @@ 2ab8bde9574144e1c77e28658e2bbb8fe3f650ce893d16c7a0ae09caf4d5f20c target/wasm32-unknown-unknown/release/controller.wasm -5880bd966316aa68c8674017b66a0fe1d969365e91cf7cc6c0f5c9138afc0c7f target/wasm32-unknown-unknown/release/cw3_flex_multisig.wasm -f05b9f9728f6d1beea36b183f790cc02223b9cef3ad17eff627b44614d022a53 target/wasm32-unknown-unknown/release/nibi_stargate.wasm -d0f9b859d13e40e5ba0062c60a31626b2db078d4e7c2d177c30d3cf4c8ec93b4 target/wasm32-unknown-unknown/release/shifter.wasm -9b021b82d0b818dd53888ce8874664c991b13969cf8bcc465fe82093a7e4849b target/wasm32-unknown-unknown/release/incentives.wasm -289eab8de64b6e5e162a2e5f10beb351883f9c5db64d8b6a27909167f5ce6916 target/wasm32-unknown-unknown/release/lockup.wasm -80657dbf13a68f0f36eb6e5e336d034418ee29b226f2404979c9880fa08c3d5a target/wasm32-unknown-unknown/release/pricefeed.wasm -73cf16d252f15867edbe4508d08524654f719fa873ace1fd2f7cfea74228f89c target/wasm32-unknown-unknown/release/token_vesting.wasm +677b73186dd1ee83c6b75af4a81163dc1339018c6e4debf55a3b599d8cb38342 target/wasm32-unknown-unknown/release/cw3_flex_multisig.wasm +9f67eabfa924253c2c952d460445ec88735745ba5e93bbc0a2a7f34c6f9657ce target/wasm32-unknown-unknown/release/incentives.wasm +4714efc1737ae3a5be19d88fcf8adf8c904a3820f82e13ab5d684e2e50b1910a target/wasm32-unknown-unknown/release/lockup.wasm +e24d58bfffb5e32d61da22a7571017617376c8ee6018a05a5a8d24a7c0c9cad3 target/wasm32-unknown-unknown/release/pricefeed.wasm +c2b0bf03c5467fb861465a2ce22235e5bf64e9dcd267036fed387b9a13177ee4 target/wasm32-unknown-unknown/release/token_vesting.wasm +7b6c7ee6eca509ccc1024220d02fbd50bfeb14127c4ad403840975c38ee0136a target/wasm32-unknown-unknown/release/nibi_stargate.wasm +ecdbb49f98bc421a7128d7badcb1c08155c1e2feccadf8fedaa194ef0cbe2028 target/wasm32-unknown-unknown/release/nibi_stargate_perp.wasm +42575f7d252f217bace9c06246325b1e8a0938287e7a0b6ec9d0d31165539d45 target/wasm32-unknown-unknown/release/nusd_valuator.wasm +d200f977312ec9b1acc5b0cecafd8d0eed1bec37e34f2afec75689e055f6df1e target/wasm32-unknown-unknown/release/shifter.wasm diff --git a/artifacts/cw3_flex_multisig.wasm b/artifacts/cw3_flex_multisig.wasm index 9bb62ea..85062c1 100644 Binary files a/artifacts/cw3_flex_multisig.wasm and b/artifacts/cw3_flex_multisig.wasm differ diff --git a/artifacts/incentives.wasm b/artifacts/incentives.wasm index 684e60c..08b11b5 100644 Binary files a/artifacts/incentives.wasm and b/artifacts/incentives.wasm differ diff --git a/artifacts/lockup.wasm b/artifacts/lockup.wasm index a641498..b404cce 100644 Binary files a/artifacts/lockup.wasm and b/artifacts/lockup.wasm differ diff --git a/artifacts/nibi_stargate.wasm b/artifacts/nibi_stargate.wasm index 347d08a..6165b12 100644 Binary files a/artifacts/nibi_stargate.wasm and b/artifacts/nibi_stargate.wasm differ diff --git a/artifacts/nibi_stargate_perp.wasm b/artifacts/nibi_stargate_perp.wasm new file mode 100644 index 0000000..e101ee7 Binary files /dev/null and b/artifacts/nibi_stargate_perp.wasm differ diff --git a/artifacts/nusd_valuator.wasm b/artifacts/nusd_valuator.wasm new file mode 100644 index 0000000..454b7c0 Binary files /dev/null and b/artifacts/nusd_valuator.wasm differ diff --git a/artifacts/pricefeed.wasm b/artifacts/pricefeed.wasm index 4568bd2..88d6dd1 100644 Binary files a/artifacts/pricefeed.wasm and b/artifacts/pricefeed.wasm differ diff --git a/artifacts/shifter.wasm b/artifacts/shifter.wasm index 99a850b..5577b4d 100644 Binary files a/artifacts/shifter.wasm and b/artifacts/shifter.wasm differ diff --git a/artifacts/token_vesting.wasm b/artifacts/token_vesting.wasm index ae367a3..1d42183 100644 Binary files a/artifacts/token_vesting.wasm and b/artifacts/token_vesting.wasm differ diff --git a/contracts/core-shifter/Cargo.toml b/contracts/core-shifter/Cargo.toml index 1e0f3a9..3ab9070 100644 --- a/contracts/core-shifter/Cargo.toml +++ b/contracts/core-shifter/Cargo.toml @@ -19,9 +19,11 @@ cosmwasm-std = { workspace = true } cosmwasm-schema = { workspace = true } cw-storage-plus = { workspace = true } nibiru-std = { workspace = true } -nibiru-macro = { workspace = true } thiserror = { workspace = true } schemars = "0.8.15" serde = { version = "1.0.188", default-features = false, features = ["derive"] } +cw-ownable = { workspace = true } +cw2 = { workspace = true } -[dev-dependencies] \ No newline at end of file +[dev-dependencies] +anyhow = { workspace = true } \ No newline at end of file diff --git a/contracts/core-shifter/src/contract.rs b/contracts/core-shifter/src/contract.rs index 1d70ed4..a869b57 100644 --- a/contracts/core-shifter/src/contract.rs +++ b/contracts/core-shifter/src/contract.rs @@ -1,275 +1,233 @@ -use cosmwasm_schema::cw_serde; use cosmwasm_std::{ - attr, entry_point, Binary, CosmosMsg, CustomMsg, Deps, DepsMut, Env, - MessageInfo, Response, StdResult, + attr, entry_point, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, + Response, }; -use nibiru_macro::cw_custom; -use nibiru_std::bindings::msg::NibiruRoute; +use cw2::set_contract_version; +use nibiru_std::proto::{nibiru, NibiruStargateMsg}; use crate::{ - msgs::{ExecuteMsg, InitMsg, IsMemberResponse, QueryMsg, WhitelistResponse}, - state::{Whitelist, WHITELIST}, + error::ContractError, + msgs::{ + operator_perms, ExecuteMsg, HasPermsResponse, InitMsg, PermsResponse, + QueryMsg, + }, + state::{instantiate_perms, Permissions, OPERATORS}, }; -#[entry_point] +pub const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); +pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); + +#[cfg_attr(not(feature = "library"), entry_point)] pub fn instantiate( deps: DepsMut, _env: Env, _info: MessageInfo, msg: InitMsg, -) -> StdResult { - let whitelist = Whitelist { - members: vec![msg.admin.clone()].into_iter().collect(), - admin: msg.admin, - }; - WHITELIST.save(deps.storage, &whitelist)?; +) -> Result { + set_contract_version( + deps.storage, + format!("crates.io:{CONTRACT_NAME}"), + CONTRACT_VERSION, + )?; + instantiate_perms(Some(&msg.owner), deps.storage, deps.api)?; Ok(Response::default()) } -fn check_admin(can: CanExecute) -> Result<(), cosmwasm_std::StdError> { - match can.is_admin { - true => Ok(()), - false => Err(cosmwasm_std::StdError::generic_err(format!( - "unauthorized : sender {} is not an admin", - can.sender, - ))), - } -} - -fn check_member(can: CanExecute) -> Result<(), cosmwasm_std::StdError> { - match can.is_member { - true => Ok(()), - false => Err(cosmwasm_std::StdError::generic_err(format!( - "unauthorized : sender {} is not a whitelist member", - can.sender, - ))), - } -} - -/// ExecuteResponse allows the execute entry point to return different response -/// types depending on the input. This is possible because we wrap the Response -/// type with variants of ExecuteResponse. These variants store a Response type. -/// -/// In CosmWasm, there are multiple entry points for handling different message -/// types, such as instantiate, execute, query, sudo, and migrate. However, -/// each entry point returns a single type of response. You cannot have multiple -/// entry points return different returning different response types for the -/// same message type. Ref: https://book.cosmwasm.com/basics/entry-points.html -#[cw_serde] -#[cw_custom] -pub struct ContractExecMsg { - pub route: NibiruRoute, - pub msg: ExecuteMsg, -} - -#[entry_point] +#[cfg_attr(not(feature = "library"), entry_point)] pub fn execute( deps: DepsMut, - _env: Env, + env: Env, info: MessageInfo, msg: ExecuteMsg, -) -> StdResult> { +) -> Result { let deps_for_check = &deps; - let check: CanExecute = - can_execute(deps_for_check.as_ref(), info.sender.as_ref())?; - let mut whitelist = check.whitelist.clone(); + let check = CanExecute::new(deps_for_check.as_ref(), info.sender.as_ref())?; + let mut perms = check.perms.clone(); + let contract_addr = env.contract.address.to_string(); match msg { - ExecuteMsg::DepthShift { pair, depth_mult } => { - check_member(check)?; - let cw_msg = ContractExecMsg { - route: NibiruRoute::Perp, - msg: ExecuteMsg::DepthShift { pair, depth_mult }, - }; + ExecuteMsg::ShiftSwapInvariant { + pair, + new_swap_invariant, + } => { + check.check_perms_operator()?; + let cosmos_msg: CosmosMsg = nibiru::perp::MsgShiftSwapInvariant { + sender: contract_addr, + pair, + new_swap_invariant: new_swap_invariant.to_string(), + } + .into_stargate_msg(); let res = Response::new() - .add_message(cw_msg) - .add_attributes(vec![attr("action", "depth_shift")]); + .add_message(cosmos_msg) + .add_attributes(vec![attr("action", "shift_swap_invariant")]); Ok(res) } - ExecuteMsg::PegShift { pair, peg_mult } => { - check_member(check)?; - let cw_msg = ContractExecMsg { - route: NibiruRoute::Perp, - msg: ExecuteMsg::PegShift { pair, peg_mult }, - }; + ExecuteMsg::ShiftPegMultiplier { pair, new_peg_mult } => { + check.check_perms_operator()?; + let cosmos_msg: CosmosMsg = nibiru::perp::MsgShiftPegMultiplier { + sender: contract_addr, + pair, + new_peg_mult: new_peg_mult.to_string(), + } + .into_stargate_msg(); let res = Response::new() - .add_message(cw_msg) - .add_attributes(vec![attr("action", "peg_shift")]); + .add_message(cosmos_msg) + .add_attributes(vec![attr("action", "shift_peg_multiplier")]); Ok(res) } - ExecuteMsg::AddMember { address } => { - check_admin(check)?; + ExecuteMsg::EditOpers(action) => { + check.check_perms_operator()?; let api = deps.api; - let addr = api.addr_validate(address.as_str()).unwrap(); - whitelist.members.insert(addr.into_string()); - WHITELIST.save(deps.storage, &whitelist)?; - - let cw_msg = ContractExecMsg { - route: NibiruRoute::NoOp, - msg: ExecuteMsg::NoOp {}, - }; - let res = Response::new().add_message(cw_msg).add_attributes(vec![ - attr("action", "add_member"), - attr("address", address), - ]); - Ok(res) - } - - ExecuteMsg::RemoveMember { address } => { - check_admin(check)?; - whitelist.members.remove(address.as_str()); - WHITELIST.save(deps.storage, &whitelist)?; - - let cw_msg = ContractExecMsg { - route: NibiruRoute::NoOp, - msg: ExecuteMsg::NoOp {}, - }; - let res = Response::new().add_message(cw_msg).add_attributes(vec![ - attr("action", "remove_member"), - attr("address", address), - ]); - Ok(res) + match action { + operator_perms::Action::AddOper { address } => { + let addr = api.addr_validate(address.as_str())?; + perms.operators.insert(addr.into_string()); + OPERATORS.save(deps.storage, &perms.operators)?; + + let res = Response::new().add_attributes(vec![ + attr("action", "add_operator"), + attr("address", address), + ]); + Ok(res) + } + + operator_perms::Action::RemoveOper { address } => { + perms.operators.remove(address.as_str()); + OPERATORS.save(deps.storage, &perms.operators)?; + + let res = Response::new().add_attributes(vec![ + attr("action", "remove_operator"), + attr("address", address), + ]); + Ok(res) + } + } } - ExecuteMsg::ChangeAdmin { address } => { - check_admin(check)?; - let api = deps.api; - let new_admin = api.addr_validate(address.as_str()).unwrap(); - whitelist.admin = new_admin.clone().into_string(); - whitelist.members.insert(new_admin.to_string()); - WHITELIST.save(deps.storage, &whitelist)?; - - let cw_msg = ContractExecMsg { - route: NibiruRoute::NoOp, - msg: ExecuteMsg::NoOp {}, - }; - let res = Response::new().add_message(cw_msg).add_attributes(vec![ - attr("action", "change_admin"), - attr("address", address), - ]); - Ok(res) - } - - // Purely here to satisfy the enum. - ExecuteMsg::NoOp {} => { - let cw_msg = ContractExecMsg { - route: NibiruRoute::NoOp, - msg: ExecuteMsg::NoOp {}, - }; - let res = Response::new().add_message(cw_msg); - Ok(res) + ExecuteMsg::UpdateOwnership(action) => { + Ok(execute_update_ownership(deps, env, info, action)?) } } } +fn execute_update_ownership( + deps: DepsMut, + env: Env, + info: MessageInfo, + action: cw_ownable::Action, +) -> Result { + let ownership = + cw_ownable::update_ownership(deps, &env.block, &info.sender, action)?; + Ok(Response::new().add_attributes(ownership.into_attributes())) +} + struct CanExecute { - is_admin: bool, - is_member: bool, + is_owner: bool, + is_operator: bool, sender: String, - whitelist: Whitelist, + perms: Permissions, } -fn can_execute(deps: Deps, sender: &str) -> StdResult { - let whitelist = WHITELIST.load(deps.storage).unwrap(); - Ok(CanExecute { - is_admin: whitelist.is_admin(sender), - is_member: whitelist.is_member(sender), - sender: sender.into(), - whitelist, - }) +impl CanExecute { + pub fn new(deps: Deps, sender: &str) -> Result { + let perms = Permissions::load(deps.storage)?; + Ok(CanExecute { + is_owner: perms.is_owner(sender), + is_operator: perms.is_operator(sender), + sender: sender.into(), + perms, + }) + } + + /// Errors if the sender does not have operator permissions. + pub fn check_perms_operator(&self) -> Result<(), ContractError> { + match self.is_operator || self.is_owner { + true => Ok(()), + false => Err(ContractError::NoOperatorPerms { + sender: self.sender.to_string(), + }), + } + } } -#[entry_point] -pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn query( + deps: Deps, + _env: Env, + msg: QueryMsg, +) -> Result { match msg { - QueryMsg::IsMember { address } => { - let whitelist = WHITELIST.load(deps.storage)?; - let is_member: bool = whitelist.is_member(address); - let res = IsMemberResponse { - is_member, - whitelist, + QueryMsg::HasPerms { address } => { + let perms = Permissions::load(deps.storage)?; + let has_perms: bool = perms.is_operator(&address); + let res = HasPermsResponse { + has_perms, + perms, + addr: address, }; - cosmwasm_std::to_json_binary(&res) + Ok(cosmwasm_std::to_json_binary(&res)?) } - QueryMsg::Whitelist {} => { - let whitelist = WHITELIST.load(deps.storage)?; - let res = WhitelistResponse { whitelist }; - cosmwasm_std::to_json_binary(&res) + QueryMsg::Perms {} => { + let perms = Permissions::load(deps.storage)?; + let res = PermsResponse { perms }; + Ok(cosmwasm_std::to_json_binary(&res)?) } } } #[cfg(test)] -mod tests { +pub mod tests { use super::*; use crate::{ msgs::{ExecuteMsg, InitMsg}, - state::WHITELIST, + state::OPERATORS, + testing::{self as t, TestResult}, }; - use cosmwasm_std::{coins, testing, Addr}; - use std::collections::HashSet; + use cosmwasm_std::{coins, testing}; + use std::collections::BTreeSet; // --------------------------------------------------------------------------- // Tests // --------------------------------------------------------------------------- #[test] - fn test_instantiate() { + fn test_instantiate() -> TestResult { let mut deps = testing::mock_dependencies(); let msg = InitMsg { - admin: "admin".to_string(), + owner: "admin".to_string(), }; let info: MessageInfo = testing::mock_info("addr0000", &coins(2, "token")); - let result = - instantiate(deps.as_mut(), testing::mock_env(), info, msg).unwrap(); + let result = instantiate(deps.as_mut(), testing::mock_env(), info, msg)?; + assert_eq!(result.messages.len(), 0); + Ok(()) } #[test] - fn test_has_admin_power() { - let admin = Addr::unchecked("admin"); - let msg = &InitMsg { - admin: admin.to_string(), - }; - + fn test_has_admin_power() -> TestResult { let sender = "not-admin"; - let mut deps = testing::mock_dependencies(); - let msg_info = testing::mock_info(sender, &coins(2, "token")); - instantiate(deps.as_mut(), testing::mock_env(), msg_info, msg.clone()) - .unwrap(); - let whitelist = WHITELIST.load(&deps.storage).unwrap(); - let has: bool = whitelist.is_admin(sender); - assert!(!has); - - let sender = "admin"; - let mut deps = testing::mock_dependencies(); - let msg_info = testing::mock_info(sender, &coins(2, "token")); - instantiate(deps.as_mut(), testing::mock_env(), msg_info, msg.clone()) - .unwrap(); - let whitelist = WHITELIST.load(&deps.storage).unwrap(); - let has: bool = whitelist.is_admin(sender); + let (deps, _env, _info) = t::setup_contract()?; + let perms = Permissions::load(&deps.storage)?; + let not_has: bool = !perms.is_owner(sender); + assert!(not_has); + let sender = t::TEST_OWNER; + let has: bool = perms.is_owner(sender); assert!(has); + Ok(()) } #[test] - fn test_execute_unauthorized() { - let mut deps = testing::mock_dependencies(); - let admin = Addr::unchecked("admin"); - - let msg = InitMsg { - admin: admin.as_str().to_string(), - }; - let msg_info = testing::mock_info("addr0000", &coins(2, "token")); - instantiate(deps.as_mut(), testing::mock_env(), msg_info, msg).unwrap(); - - let execute_msg = ExecuteMsg::AddMember { - address: "addr0001".to_string(), - }; + fn test_exec_unauthorized() -> TestResult { + let (mut deps, _env, _info) = t::setup_contract()?; + let execute_msg = + ExecuteMsg::EditOpers(operator_perms::Action::AddOper { + address: "addr0001".to_string(), + }); let unauthorized_info = testing::mock_info("unauthorized", &[]); let result = execute( deps.as_mut(), @@ -278,36 +236,29 @@ mod tests { execute_msg, ); assert!(result.is_err()); + Ok(()) } #[test] - fn test_execute_add_member() { - // Init contract - let mut deps = testing::mock_dependencies(); - let admin = Addr::unchecked("admin"); - - let init_msg = InitMsg { - admin: admin.as_str().to_string(), - }; - let init_info = testing::mock_info("addr0000", &coins(2, "token")); - instantiate(deps.as_mut(), testing::mock_env(), init_info, init_msg) - .unwrap(); - + fn test_exec_edit_opers_add() -> TestResult { + let (mut deps, _env, _info) = t::setup_contract()?; let new_member = "new_member"; - let whitelist = WHITELIST.load(&deps.storage).unwrap(); - let has: bool = whitelist.is_admin(new_member); - assert!(!has); - - // Add a member to whitelist - let execute_msg = ExecuteMsg::AddMember { - address: new_member.to_string(), - }; - let execute_info = testing::mock_info(admin.as_str(), &[]); - - let check_resp = |resp: Response| { + let perms = Permissions::load(&deps.storage)?; + let not_has: bool = !perms.is_owner(new_member); + assert!(not_has); + + // Add an operator to the permission set + let execute_msg = + ExecuteMsg::EditOpers(operator_perms::Action::AddOper { + address: new_member.to_string(), + }); + let sender = t::TEST_OWNER; + let execute_info = testing::mock_info(sender, &[]); + + let check_resp = |resp: Response| { assert_eq!( resp.messages.len(), - 1, + 0, "resp.messages: {:?}", resp.messages ); @@ -324,61 +275,50 @@ mod tests { testing::mock_env(), execute_info, execute_msg, - ) - .unwrap(); + )?; check_resp(result); // Check correctness of the result - let whitelist = WHITELIST.load(&deps.storage).unwrap(); - let has: bool = whitelist.has(new_member); + let perms = Permissions::load(&deps.storage)?; + let has: bool = perms.has(new_member); assert!(has); - let query_req = QueryMsg::IsMember { + let query_req = QueryMsg::HasPerms { address: new_member.to_string(), }; - let binary = - query(deps.as_ref(), testing::mock_env(), query_req).unwrap(); - let response: IsMemberResponse = - cosmwasm_std::from_json(binary).unwrap(); - assert!(response.is_member); + let binary = query(deps.as_ref(), testing::mock_env(), query_req)?; + let response: HasPermsResponse = cosmwasm_std::from_json(binary)?; + assert!(response.has_perms); + Ok(()) } #[test] - fn test_execute_remove_member() { - // Init contract - let _deps = testing::mock_dependencies(); - let mut deps = testing::mock_dependencies(); - let admin = Addr::unchecked("admin"); - - let init_msg = InitMsg { - admin: admin.as_str().to_string(), - }; - let init_info = testing::mock_info("addr0000", &coins(2, "token")); - instantiate(deps.as_mut(), testing::mock_env(), init_info, init_msg) - .unwrap(); - - // Set up initial whitelist - let members_start: Vec = ["vitalik", "musk", "satoshi"] + fn test_exec_edit_opers_remove() -> TestResult { + let (mut deps, _env, _info) = t::setup_contract()?; + // Set up initial perms + let opers_start: Vec = ["vitalik", "musk", "satoshi"] .iter() .map(|&s| s.to_string()) .collect(); - let mut whitelist = WHITELIST.load(&deps.storage).unwrap(); - assert_eq!(whitelist.members.len(), 1); // admin remains - for member in members_start.iter() { - whitelist.members.insert(member.clone()); + let mut perms = Permissions::load(&deps.storage)?; + assert_eq!(perms.operators.len(), 0); // admin remains + for member in opers_start.iter() { + perms.operators.insert(member.clone()); } - let res = WHITELIST.save(deps.as_mut().storage, &whitelist); + let res = OPERATORS.save(deps.as_mut().storage, &perms.operators); assert!(res.is_ok()); // Remove a member from the whitelist - let execute_msg = ExecuteMsg::RemoveMember { - address: "satoshi".to_string(), - }; - let execute_info = testing::mock_info(admin.as_str(), &[]); - let check_resp = |resp: Response| { + let execute_msg = + ExecuteMsg::EditOpers(operator_perms::Action::RemoveOper { + address: "satoshi".to_string(), + }); + let sender = t::TEST_OWNER; + let execute_info = testing::mock_info(sender, &[]); + let check_resp = |resp: Response| { assert_eq!( resp.messages.len(), - 1, + 0, "resp.messages: {:?}", resp.messages ); @@ -394,88 +334,26 @@ mod tests { testing::mock_env(), execute_info, execute_msg, - ) - .unwrap(); + )?; check_resp(result); // Check correctness of the result - let query_req = QueryMsg::Whitelist {}; - let binary = - query(deps.as_ref(), testing::mock_env(), query_req).unwrap(); - let response: WhitelistResponse = - cosmwasm_std::from_json(binary).unwrap(); - let expected_members: HashSet = ["vitalik", "musk", "admin"] - .iter() - .map(|&s| s.to_string()) - .collect(); + let query_req = QueryMsg::Perms {}; + let binary = query(deps.as_ref(), testing::mock_env(), query_req)?; + let response: PermsResponse = cosmwasm_std::from_json(binary)?; + let expected_opers: BTreeSet = + ["vitalik", "musk"].iter().map(|&s| s.to_string()).collect(); assert_eq!( - response.whitelist.members, expected_members, + response.perms.operators, expected_opers, "got: {:#?}, wanted: {:#?}", - response.whitelist.members, expected_members + response.perms.operators, expected_opers ); + Ok(()) } + /// TODO: test change owner #[test] - fn test_execute_change_admin() { - // Init contract - let mut deps = testing::mock_dependencies(); - let admin = Addr::unchecked("admin"); - - let init_msg = InitMsg { - admin: admin.as_str().to_string(), - }; - let init_info = testing::mock_info("addr0000", &coins(2, "token")); - instantiate(deps.as_mut(), testing::mock_env(), init_info, init_msg) - .unwrap(); - - let new_admin = "new_admin"; - let whitelist = WHITELIST.load(&deps.storage).unwrap(); - let has: bool = whitelist.is_admin(new_admin); - assert!(!has); - - // Add a member to whitelist - let execute_msg = ExecuteMsg::ChangeAdmin { - address: new_admin.to_string(), - }; - let execute_info = testing::mock_info(admin.as_str(), &[]); - - let check_resp = |resp: Response| { - assert_eq!( - resp.messages.len(), - 1, - "resp.messages: {:?}", - resp.messages - ); - assert_eq!( - resp.attributes.len(), - 2, - "resp.attributes: {:#?}", - resp.attributes - ); - }; - - let result = execute( - deps.as_mut(), - testing::mock_env(), - execute_info, - execute_msg, - ) - .unwrap(); - check_resp(result); - - // Check correctness of the result - let whitelist = WHITELIST.load(&deps.storage).unwrap(); - let has: bool = whitelist.has(new_admin); - assert!(has); - - // The new admin should not yet be a member - let query_req = QueryMsg::IsMember { - address: new_admin.to_string(), - }; - let binary = - query(deps.as_ref(), testing::mock_env(), query_req).unwrap(); - let response: IsMemberResponse = - cosmwasm_std::from_json(binary).unwrap(); - assert!(response.is_member); + fn test_exec_change_admin() -> TestResult { + Ok(()) } } diff --git a/contracts/core-shifter/src/error.rs b/contracts/core-shifter/src/error.rs new file mode 100644 index 0000000..c86bf58 --- /dev/null +++ b/contracts/core-shifter/src/error.rs @@ -0,0 +1,15 @@ +use cosmwasm_std::StdError; + +use thiserror::Error; + +#[derive(Error, Debug, PartialEq)] +pub enum ContractError { + #[error("{0}")] + Std(#[from] StdError), + + #[error("{0}")] + Ownership(#[from] cw_ownable::OwnershipError), + + #[error("insufficient permissions: sender is not a contract operator ({sender:?})")] + NoOperatorPerms { sender: String }, +} diff --git a/contracts/core-shifter/src/lib.rs b/contracts/core-shifter/src/lib.rs index c18069d..1cd0de8 100644 --- a/contracts/core-shifter/src/lib.rs +++ b/contracts/core-shifter/src/lib.rs @@ -1,3 +1,6 @@ pub mod contract; +pub mod error; pub mod msgs; pub mod state; +#[cfg(test)] +pub mod testing; diff --git a/contracts/core-shifter/src/msgs.rs b/contracts/core-shifter/src/msgs.rs index 2dde25d..d24a72c 100644 --- a/contracts/core-shifter/src/msgs.rs +++ b/contracts/core-shifter/src/msgs.rs @@ -1,39 +1,60 @@ -use cosmwasm_schema::cw_serde; +use cosmwasm_schema::{cw_serde, QueryResponses}; use cosmwasm_std::{Decimal, Uint256}; -use crate::state::Whitelist; +use crate::state::Permissions; /// InitMsg specifies the args for the instantiate entry point of the contract. #[cw_serde] pub struct InitMsg { - pub admin: String, + pub owner: String, } /// ExecuteMsg specifies the args for the execute entry point of the contract. +#[cw_ownable::cw_ownable_execute] #[cw_serde] pub enum ExecuteMsg { - DepthShift { pair: String, depth_mult: Uint256 }, - PegShift { pair: String, peg_mult: Decimal }, - AddMember { address: String }, - RemoveMember { address: String }, - ChangeAdmin { address: String }, - NoOp {}, + ShiftSwapInvariant { + pair: String, + new_swap_invariant: Uint256, + }, + ShiftPegMultiplier { + pair: String, + new_peg_mult: Decimal, + }, + EditOpers(operator_perms::Action), +} + +pub mod operator_perms { + use cosmwasm_schema::cw_serde; + + #[cw_serde] + pub enum Action { + AddOper { address: String }, + RemoveOper { address: String }, + } } /// QueryMsg specifies the args for the query entry point of the contract. +#[derive(QueryResponses)] #[cw_serde] pub enum QueryMsg { - IsMember { address: String }, - Whitelist {}, + /// HasPerms: Query whether the given address has operator permissions. + /// The query response showcases the contract owner and set of operators. + #[returns(HasPermsResponse)] + HasPerms { address: String }, + /// Perms: Query the contract owner and set of operators. + #[returns(PermsResponse)] + Perms {}, } #[cw_serde] -pub struct IsMemberResponse { - pub is_member: bool, - pub whitelist: Whitelist, +pub struct HasPermsResponse { + pub has_perms: bool, + pub addr: String, + pub perms: Permissions, } #[cw_serde] -pub struct WhitelistResponse { - pub whitelist: Whitelist, +pub struct PermsResponse { + pub perms: Permissions, } diff --git a/contracts/core-shifter/src/state.rs b/contracts/core-shifter/src/state.rs index 51d96f7..d6ca58f 100644 --- a/contracts/core-shifter/src/state.rs +++ b/contracts/core-shifter/src/state.rs @@ -1,94 +1,128 @@ -use std::collections::HashSet; +use std::collections::BTreeSet; use cosmwasm_schema::cw_serde; +use cosmwasm_std::{Api, Storage}; use cw_storage_plus::Item; -pub const WHITELIST: Item = Item::new("whitelist"); +use crate::error::ContractError; + +pub const OPERATORS: Item> = Item::new("operators"); #[cw_serde] -pub struct Whitelist { - pub members: HashSet, - pub admin: String, +pub struct Permissions { + pub owner: Option, + pub operators: BTreeSet, } -impl Whitelist { +impl Permissions { pub fn has(&self, addr: impl AsRef) -> bool { let addr = addr.as_ref(); - self.members.contains(addr) || self.admin == addr + self.operators.contains(addr) || self.is_owner(addr) } - pub fn is_admin(&self, addr: impl AsRef) -> bool { + pub fn is_owner(&self, addr: impl AsRef) -> bool { let addr = addr.as_ref(); - self.admin == addr + if let Some(owner) = &self.owner { + owner == addr + } else { + false + } } - pub fn is_member(&self, addr: impl AsRef) -> bool { + pub fn is_operator(&self, addr: impl AsRef) -> bool { let addr = addr.as_ref(); - self.members.contains(addr) + self.operators.contains(addr) + } + + pub fn load(storage: &dyn Storage) -> Result { + let owner = cw_ownable::get_ownership(storage)?.owner; + let opers = OPERATORS.load(storage)?; + Ok(Permissions { + owner: owner.map(|addr| addr.into_string()), + operators: opers, + }) } } +/// Set the given address as the contract owner and initialize the +/// 'OPERATORS' and 'OWNERSHIP' state. This function is only intended to be used only +/// during contract instantiation. +pub fn instantiate_perms( + owner: Option<&str>, + storage: &mut dyn Storage, + api: &dyn Api, +) -> Result<(), ContractError> { + cw_ownable::initialize_owner(storage, api, owner)?; + Ok(OPERATORS.save(storage, &BTreeSet::default())?) +} + #[cfg(test)] pub mod tests { + use crate::testing::TestResult; use cosmwasm_std::testing::MockStorage; use super::*; - pub fn init_mock_whitelist() -> Whitelist { + pub fn init_mock_perms() -> Permissions { let member_names = ["alice", "brock", "david"]; - let members: HashSet = + let members: BTreeSet = member_names.iter().map(|&s| s.to_string()).collect(); let admin: String = "cait".to_string(); - Whitelist { members, admin } + Permissions { + operators: members, + owner: Some(admin), + } } #[test] - fn whitelist_is_admin() { - let whitelist = init_mock_whitelist(); - assert!(!whitelist.is_admin("alice")); - assert!(whitelist.is_admin("cait")); - assert!(!whitelist.is_admin("david")); - assert!(!whitelist.is_admin("brock")); + fn perms_is_owner() { + let perms = init_mock_perms(); + assert!(!perms.is_owner("alice")); + assert!(perms.is_owner("cait")); + assert!(!perms.is_owner("david")); + assert!(!perms.is_owner("brock")); } #[test] - fn whitelist_is_member() { - let whitelist = init_mock_whitelist(); - assert!(whitelist.is_member("alice")); - assert!(!whitelist.is_member("cait")); - assert!(whitelist.is_member("david")); - assert!(whitelist.is_member("brock")); + fn perms_is_member() { + let perms = init_mock_perms(); + assert!(perms.is_operator("alice")); + assert!(!perms.is_operator("cait")); + assert!(perms.is_operator("david")); + assert!(perms.is_operator("brock")); } #[test] - fn whitelist_has() { - let whitelist = init_mock_whitelist(); + fn perms_has() { + let perms = init_mock_perms(); - let whitelisted_names = ["alice", "brock", "cait", "david"]; - for name in whitelisted_names.iter() { - assert!(whitelist.has(name)); + let permsed_names = ["alice", "brock", "cait", "david"]; + for name in permsed_names.iter() { + assert!(perms.has(name)); } - let other_names = ["xxx", "not-whitelisted"]; + let other_names = ["xxx", "not-permsed"]; for name in other_names.iter() { - assert!(!whitelist.has(name)); + assert!(!perms.has(name)); } } #[test] - fn save_and_load() { + fn save_and_load() -> TestResult { let mut store = MockStorage::new(); // Store should start out empty - assert!(WHITELIST.load(&store).is_err()); - assert_eq!(WHITELIST.may_load(&store).unwrap(), None); + assert!(OPERATORS.load(&store).is_err()); + assert_eq!(OPERATORS.may_load(&store)?, None); // save to store - let whitelist = init_mock_whitelist(); - let res = WHITELIST.save(&mut store, &whitelist); + let perms = init_mock_perms(); + let opers = perms.operators; + let res = OPERATORS.save(&mut store, &opers); assert!(res.is_ok()); // load from store - assert_eq!(whitelist, WHITELIST.load(&store).unwrap()); + assert_eq!(opers, OPERATORS.load(&store)?); + Ok(()) } } diff --git a/contracts/core-shifter/src/testing.rs b/contracts/core-shifter/src/testing.rs new file mode 100644 index 0000000..e0ba7bc --- /dev/null +++ b/contracts/core-shifter/src/testing.rs @@ -0,0 +1,37 @@ +//! testing.rs: Test helpers for the contract + +use cosmwasm_std::{ + testing::{ + mock_dependencies, mock_env, mock_info, MockApi, MockQuerier, + MockStorage, + }, + Env, MessageInfo, OwnedDeps, +}; + +use crate::{contract::instantiate, msgs::InitMsg}; + +pub type TestResult = anyhow::Result<()>; + +pub const TEST_OWNER: &str = "owner"; + +pub fn setup_contract(// accepted_denoms: Vec, +) -> anyhow::Result<( + OwnedDeps, + Env, + MessageInfo, +)> { + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info(TEST_OWNER, &[]); + + let msg = InitMsg { + owner: info.sender.to_string(), + }; + let res = instantiate(deps.as_mut(), env.clone(), info.clone(), msg)?; + assert_eq!(0, res.messages.len()); + Ok((deps, env, info)) +} + +pub fn mock_info_for_sender(sender: &str) -> MessageInfo { + mock_info(sender, &[]) +} diff --git a/contracts/core-controller/.cargo/config b/contracts/nibi-stargate-perp/.cargo/config similarity index 100% rename from contracts/core-controller/.cargo/config rename to contracts/nibi-stargate-perp/.cargo/config diff --git a/contracts/nibi-stargate-perp/Cargo.toml b/contracts/nibi-stargate-perp/Cargo.toml new file mode 100644 index 0000000..2a3941c --- /dev/null +++ b/contracts/nibi-stargate-perp/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "nibi-stargate-perp" +version = "0.2.0" +edition = "2021" +homepage = "https://nibiru.fi" +repository = "https://github.com/NibiruChain/cw-nibiru" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lib] +crate-type = ["cdylib", "rlib"] + +[features] +backtraces = ["cosmwasm-std/backtraces"] +# use library feature to disable all instantiate/execute/query exports +library = [] + +[dependencies] +cosmwasm-schema = { workspace = true } +cosmwasm-std = { workspace = true } +cw-storage-plus = { workspace = true } +cw-utils = { workspace = true } +schemars = { workspace = true } +cw2 = { workspace = true } +serde = { workspace = true } +thiserror = { workspace = true } +nibiru-std = { workspace = true } + +[dev-dependencies] +cosmwasm-vm = "1.5.0" +serde_json = "1.0.108" +anyhow = { workspace = true } \ No newline at end of file diff --git a/contracts/nibi-stargate-perp/src/contract.rs b/contracts/nibi-stargate-perp/src/contract.rs new file mode 100644 index 0000000..acf469a --- /dev/null +++ b/contracts/nibi-stargate-perp/src/contract.rs @@ -0,0 +1,565 @@ +use cosmwasm_std::{ + entry_point, AllBalanceResponse, BankMsg, BankQuery, Binary, CosmosMsg, + Deps, DepsMut, Env, MessageInfo, QueryRequest, Response, StdError, + StdResult, +}; + +use cw2::set_contract_version; + +use nibiru_std::proto::nibiru::perp::Direction; +use nibiru_std::proto::{nibiru, NibiruStargateMsg}; + +use crate::{ + msg::{ExecuteMsg, InitMsg, QueryMsg}, + state::{Sudoers, SUDOERS}, +}; + +const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); +const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); + +#[entry_point] +pub fn instantiate( + deps: DepsMut, + _env: Env, + info: MessageInfo, + msg: InitMsg, +) -> StdResult { + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + let admin: String = match msg.admin { + Some(msg_admin) => msg_admin, + None => info.sender.to_string(), + }; + let sudoers = Sudoers { + members: vec![admin.clone()].into_iter().collect(), + admin, + }; + SUDOERS.save(deps.storage, &sudoers)?; + Ok(Response::new() + .add_attribute("action", "instantiate") + .add_attribute("owner", info.sender)) +} + +// TODO: impl query entry point +#[entry_point] +pub fn query(_deps: Deps, _env: Env, _msg: QueryMsg) -> StdResult { + todo!(); + // let querier = NibiruQuerier::new(&deps.querier); + // match msg { + // QueryMsg::AllMarkets {} => { + // to_json_binary(&querier.all_markets().unwrap()) + // } + // QueryMsg::BasePrice { + // pair, + // is_long, + // base_amount, + // } => to_json_binary( + // &querier.base_price(pair, is_long, base_amount).unwrap(), + // ), + // QueryMsg::Position { trader, pair } => { + // to_json_binary(&querier.position(trader, pair).unwrap()) + // } + // QueryMsg::Positions { trader } => { + // to_json_binary(&querier.positions(trader).unwrap()) + // } + // QueryMsg::Metrics { pair } => { + // to_json_binary(&querier.metrics(pair).unwrap()) + // } + // QueryMsg::ModuleAccounts {} => { + // to_json_binary(&querier.module_accounts()?) + // } + // QueryMsg::ModuleParams {} => to_json_binary(&querier.module_params()?), + // QueryMsg::PremiumFraction { pair } => { + // to_json_binary(&querier.premium_fraction(pair)?) + // } + // QueryMsg::Reserves { pair } => to_json_binary(&querier.reserves(pair)?), + // QueryMsg::OraclePrices { pairs } => { + // to_json_binary(&querier.oracle_prices(pairs)?) + // } + + // // TODO test + // QueryMsg::Sudoers {} => { + // let sudoers = SUDOERS.load(deps.storage)?; + // let res = SudoersQueryResponse { sudoers }; + // cosmwasm_std::to_json_binary(&res) + // } + // } +} + +#[entry_point] +pub fn execute( + deps: DepsMut, + env_ctx: Env, + info: MessageInfo, + msg: ExecuteMsg, +) -> StdResult { + let deps_for_check = &deps; + let can_execute: CanExecute = + check_can_execute(deps_for_check.as_ref(), info.sender.as_ref())?; + let contract_addr = env_ctx.contract.address.to_string(); + match msg { + ExecuteMsg::MarketOrder { + pair, + is_long, + quote_amount, + leverage, + base_amount_limit, + } => { + can_execute.check_member()?; + let side: Direction = if is_long { + Direction::Long + } else { + Direction::Short + }; + + // TODO: feat(nibiru-std): Fn to convert cosmwasm_std::Decimal to + // protobuf strings for sdk.Dec [with tests] | https://github.com/NibiruChain/cw-nibiru/issues/99 + let cosmos_msg: CosmosMsg = nibiru::perp::MsgMarketOrder { + sender: contract_addr, + pair, + side: side.into(), + // TODO: sdk.Dec https://github.com/NibiruChain/cw-nibiru/issues/99 + quote_asset_amount: quote_amount.to_string(), + // TODO: sdk.Dec https://github.com/NibiruChain/cw-nibiru/issues/99 + leverage: leverage.to_string(), + // TODO: sdk.Dec https://github.com/NibiruChain/cw-nibiru/issues/99 + base_asset_amount_limit: base_amount_limit.to_string(), + } + .into_stargate_msg(); + Ok(Response::new().add_message(cosmos_msg)) + } + + ExecuteMsg::ClosePosition { pair } => { + can_execute.check_member()?; + let cosmos_msg: CosmosMsg = nibiru::perp::MsgClosePosition { + sender: contract_addr, + pair, + } + .into_stargate_msg(); + Ok(Response::new().add_message(cosmos_msg)) + } + + ExecuteMsg::AddMargin { pair, margin } => { + can_execute.check_member()?; + let cosmos_msg: CosmosMsg = nibiru::perp::MsgAddMargin { + sender: contract_addr, + pair, + margin: Some(margin.into()), + } + .into_stargate_msg(); + Ok(Response::new().add_message(cosmos_msg)) + } + + ExecuteMsg::RemoveMargin { pair, margin } => { + can_execute.check_member()?; + let cosmos_msg: CosmosMsg = nibiru::perp::MsgRemoveMargin { + sender: contract_addr, + pair, + margin: Some(margin.into()), + } + .into_stargate_msg(); + Ok(Response::new().add_message(cosmos_msg)) + } + + // TODO:test ExecuteMsg::MultiLiquidate + ExecuteMsg::MultiLiquidate { liquidations } => { + can_execute.check_member()?; + let cosmos_msg: CosmosMsg = nibiru::perp::MsgMultiLiquidate { + sender: contract_addr, + liquidations: liquidations + .iter() + .map(|la| nibiru::perp::msg_multi_liquidate::Liquidation { + pair: la.pair.clone(), + trader: la.trader.clone(), + }) + .collect(), + } + .into_stargate_msg(); + Ok(Response::new().add_message(cosmos_msg)) + } + + // TODO:test ExecuteMsg::DonateToInsuranceFund + ExecuteMsg::DonateToInsuranceFund { donation } => { + can_execute.check_member()?; + let cosmos_msg: CosmosMsg = nibiru::perp::MsgDonateToEcosystemFund { + sender: contract_addr, + donation: Some(donation.into()), + } + .into_stargate_msg(); + Ok(Response::new().add_message(cosmos_msg)) + } + + ExecuteMsg::Claim { + funds, + claim_all, + to, + } => { + can_execute.check_admin()?; + let event_key = "execute_claim"; + if let Some(claim_all_value) = claim_all { + if !claim_all_value { + return Err(StdError::generic_err( + "setting 'claim_all' to false causes an error: " + .to_string() + + "try removing claim_all as an argument entirely.", + )); + } + let contract_address = env_ctx.contract.address; + let balances = query_contract_balance( + contract_address.to_string(), + deps.as_ref(), + )?; + + // Send all funds to the specified recipient. + let transfer_msg = BankMsg::Send { + to_address: to.clone(), + amount: balances.amount, + }; + Ok(Response::new().add_message(transfer_msg).add_attribute( + event_key, + format!("successfully claimed to {}", to), + )) + } else if let Some(funds_value) = funds { + // Send all funds to the specified recipient. + let transfer_msg = BankMsg::Send { + to_address: to.clone(), + amount: vec![funds_value], + }; + return Ok(Response::new() + .add_message(transfer_msg) + .add_attribute( + event_key, + format!("successfully claimed to {}", to), + )); + } else { + return Err(StdError::generic_err( + "either the 'funds' or 'claim_all' arguments must be specified")); + } + } // TODO test: add member + // TODO test: remove member + // TODO test: change admin + } +} + +struct CanExecute { + is_admin: bool, + is_member: bool, + sender: String, +} + +impl CanExecute { + pub fn check_admin(&self) -> Result<(), cosmwasm_std::StdError> { + match self.is_admin { + true => Ok(()), + false => Err(cosmwasm_std::StdError::generic_err(format!( + "unauthorized : sender {} is not an admin", + self.sender, + ))), + } + } + + pub fn check_member(&self) -> Result<(), cosmwasm_std::StdError> { + match self.is_member { + true => Ok(()), + false => Err(cosmwasm_std::StdError::generic_err(format!( + "unauthorized : sender {} is not a sudoers member", + self.sender, + ))), + } + } +} + +fn check_can_execute(deps: Deps, sender: &str) -> StdResult { + let sudoers = SUDOERS.load(deps.storage).unwrap(); + Ok(CanExecute { + is_admin: sudoers.is_admin(sender), + is_member: sudoers.is_member(sender), + sender: sender.into(), + }) +} + +/// Query all contract balances or return an empty response +fn query_contract_balance( + contract_address: String, + deps: Deps, +) -> StdResult { + let query_result = + deps.querier + .query(&QueryRequest::Bank(BankQuery::AllBalances { + address: contract_address, + }))?; + let balances: AllBalanceResponse = match query_result { + Some(res) => res, + None => AllBalanceResponse::default(), + }; + Ok(balances) +} + +#[cfg(test)] +pub mod tests { + use std::str::FromStr; + + use crate::state; + use cosmwasm_std::{ + coin, coins, + testing::{self, mock_env, MockApi, MockQuerier}, + Coin, CosmosMsg, Decimal, MemoryStorage, OwnedDeps, SubMsg, Uint128, + }; + + use super::*; + + pub type TestResult = anyhow::Result<()>; + + pub const SENDER_NOT_ADMIN: &str = "not-admin"; + pub const SENDER_ADMIN: &str = "admin"; + + #[test] + fn msg_init() -> TestResult { + let mut deps = testing::mock_dependencies(); + let admin = SENDER_ADMIN; + let msg = InitMsg { + admin: Some(admin.to_string()), + }; + let sender = "sender"; + let info: MessageInfo = testing::mock_info(sender, &coins(2, "token")); + + let result = instantiate(deps.as_mut(), testing::mock_env(), info, msg)?; + assert_eq!(result.messages.len(), 0); + + let sudoers = SUDOERS.load(&deps.storage)?; + assert_eq!(sudoers.admin, admin); + Ok(()) + } + + #[test] + fn msg_init_admin_as_sender() -> TestResult { + let mut deps = testing::mock_dependencies(); + let msg = InitMsg { admin: None }; + let sender = "sender"; + let info: MessageInfo = testing::mock_info(sender, &coins(2, "token")); + + let result = instantiate(deps.as_mut(), testing::mock_env(), info, msg)?; + assert_eq!(result.messages.len(), 0); + + let sudoers = SUDOERS.load(&deps.storage)?; + assert_eq!(sudoers.admin, sender); + Ok(()) + } + + fn do_init( + admin: &str, + sender: &str, + mut deps: OwnedDeps, + ) -> ( + state::Sudoers, + OwnedDeps, + cosmwasm_std::MessageInfo, + ) { + let msg_init = InitMsg { + admin: Some(admin.to_string()), + }; + + // let mut deps = testing::mock_dependencies(); + let info: MessageInfo = testing::mock_info(sender, &coins(2, "token")); + + let result = instantiate( + deps.as_mut(), + testing::mock_env(), + info.clone(), + msg_init, + ) + .expect("failed instantiate in the 'do_init' fn"); + assert_eq!(result.messages.len(), 0); + let sudoers = SUDOERS + .load(&deps.storage) + .expect("state should be loadable after InitMsg"); + assert_eq!(sudoers.admin, admin); + (sudoers, deps, info) + } + + #[test] + fn exec_stargate() -> TestResult { + let deps = testing::mock_dependencies(); + + // Instantiate contract + let admin = SENDER_ADMIN; + let sender = admin; + let (_sudoers, mut deps, info) = do_init(admin, sender, deps); + + let pair = "ETH:USD".to_string(); + let dummy_u128 = Uint128::new(420u128); + let dummy_coin = coin(dummy_u128.clone().u128(), "token"); + let exec_msgs: Vec = vec![ + ExecuteMsg::MarketOrder { + pair: pair.clone(), + is_long: true, + quote_amount: dummy_u128, + leverage: Decimal::from_str("5")?, + base_amount_limit: Uint128::zero(), + }, + ExecuteMsg::ClosePosition { pair: pair.clone() }, + ExecuteMsg::AddMargin { + pair: pair.clone(), + margin: dummy_coin.clone(), + }, + ExecuteMsg::RemoveMargin { + pair, + margin: dummy_coin, + }, + ]; + for exec_msg in &exec_msgs { + exec_stargate_test_happy(exec_msg, deps.as_mut(), info.clone())?; + exec_stargate_test_without_permission(exec_msg, deps.as_mut())?; + } + Ok(()) + } + + /// Verifies that an execute message will fail when sent by a non-admin + pub fn exec_stargate_test_without_permission( + exec_msg: &ExecuteMsg, + deps: DepsMut, + ) -> TestResult { + let sender: &str = "not-admin"; + let info: MessageInfo = testing::mock_info(sender, &coins(2, "token")); + let resp = execute(deps, mock_env(), info, exec_msg.clone()); + assert!(resp.is_err(), "resp.err: {:?}", resp.err()); + Ok(()) + } + + /// Verifies that an execute message will succeed and contain a + /// `cosmwasm_std::SubMsg` for the `CosmosMsg::Stargate` to be executed. + pub fn exec_stargate_test_happy( + exec_msg: &ExecuteMsg, + deps: DepsMut, + info: MessageInfo, + ) -> TestResult { + let resp = execute(deps, mock_env(), info, exec_msg.clone())?; + assert_eq!(resp.messages.len(), 1, "resp.messages: {:?}", resp.messages); + Ok(()) + } + + struct TestCaseExecClaim<'a> { + exec_msg: ExecuteMsg, + sender: &'a str, + err: Option<&'a str>, + funds_sent: Option<&'a str>, + } + + /// exec_claim: Test the ExecuteMsg::Claim variant. + #[test] + fn exec_claim() -> TestResult { + // Prepare the test environment + let deps = testing::mock_dependencies(); + let env = mock_env(); + let contract_address = env.contract.address.clone(); + let to_address = String::from("recipient_address"); + + // Instantiate contract + let admin = to_address.as_str(); + let sender = to_address.as_str(); + let (_sudoers, mut deps, _info) = do_init(admin, sender, deps); + + // Set up a mock querier with contract balance + let balances: &[(&str, &[Coin])] = + &[(contract_address.as_str(), &[Coin::new(100, "token")])]; + let querier = testing::MockQuerier::new(balances); + deps.querier = querier; + + let test_cases: Vec = vec![ + // claim with no args + TestCaseExecClaim { + exec_msg: ExecuteMsg::Claim { + funds: None, + claim_all: None, + to: to_address.clone(), + }, + sender: to_address.as_str(), + err: Some("arguments must be specified"), + funds_sent: None, + }, + // claim happy / partial + TestCaseExecClaim { + exec_msg: ExecuteMsg::Claim { + funds: Some(Coin::new(50, "token")), + claim_all: None, + to: to_address.clone(), + }, + sender: to_address.as_str(), + err: None, + funds_sent: Some("50"), + }, + // claim happy / all + TestCaseExecClaim { + exec_msg: ExecuteMsg::Claim { + funds: None, + claim_all: Some(true), + to: to_address.clone(), + }, + sender: to_address.as_str(), + err: None, + funds_sent: Some("100"), + }, + // claim / sad / all set to false + TestCaseExecClaim { + exec_msg: ExecuteMsg::Claim { + funds: None, + claim_all: Some(false), + to: to_address.clone(), + }, + sender: to_address.as_str(), + err: Some("false causes an error"), + funds_sent: None, + }, + ]; + for tc in &test_cases { + // Instantiate contract + let deps = testing::mock_dependencies(); + let sender = tc.sender; + let (_sudoers, mut deps, info) = do_init(admin, sender, deps); + + // Set up a mock querier with contract balance + let balances: &[(&str, &[Coin])] = + &[(contract_address.as_str(), &[Coin::new(100, "token")])]; + let querier = testing::MockQuerier::new(balances); + deps.querier = querier; + + let res = + execute(deps.as_mut(), mock_env(), info, tc.exec_msg.clone()); + if let Some(err) = tc.err { + assert!(res.is_err()); + assert!(res.unwrap_err().to_string().contains(err)); + continue; + } + + // Check for the correct number of SubMsgs + assert!(res.is_ok(), "res: {:?}", res); + let resp = res?; + assert_eq!(resp.messages.len(), 1); + + // Check that the correct amount of funds are sent + if let Some(want_funds_sent) = tc.funds_sent { + let sub_msg: &SubMsg = &resp.messages[0]; + let transfer_msg: &CosmosMsg = &sub_msg.msg; + let msg_json: String = + serde_json::to_string_pretty(&transfer_msg) + .expect("Failed to serialized JSON"); + println!("msg_json: {:?}", msg_json); + + let contract_balance: &Coin = &balances[0].1[0]; + let denom: String = contract_balance.denom.clone(); + let amount: String = want_funds_sent.to_string(); + let expected_json_elements: Vec = vec![ + format!(r#""denom": "{}""#, denom), + format!(r#""amount": "{}""#, amount), + ]; + for elem in &expected_json_elements { + assert!( + msg_json.to_string().clone().contains(elem), + "elem: {}", + elem + ); + } + } + } + Ok(()) + } +} diff --git a/contracts/nibi-stargate-perp/src/integration_test.rs b/contracts/nibi-stargate-perp/src/integration_test.rs new file mode 100644 index 0000000..fc2a0a0 --- /dev/null +++ b/contracts/nibi-stargate-perp/src/integration_test.rs @@ -0,0 +1,53 @@ +#[cfg(test)] +pub mod integration_tests { + use crate::msg::InitMsg; + use cosmwasm_std::{coins, Decimal, Response}; + use cosmwasm_vm::testing::{ + instantiate, mock_env, mock_info, mock_instance, + }; + use std::str::FromStr; + + // TODO test that the file exists + static WASM: &[u8] = include_bytes!("../../../artifacts/bindings_perp.wasm"); + + #[test] + fn msg_init() { + let mut deps = mock_instance(WASM, &[]); + let sender = String::from("sender"); + let info = mock_info(&sender, &coins(1000, "unibi")); + let inst_msg = InitMsg {}; + let result: Response = + instantiate(&mut deps, mock_env(), info, inst_msg).unwrap(); + assert_eq!(result.messages.len(), 0); + } + + #[test] + fn negative_decimal_not_possible() { + let neg = Decimal::from_str("-420"); + assert!(neg.is_err()) + } + + // Example integration test for a custom query + // TODO This requires writing a test querier that registers the custom enum + // + // const DESERIALIZATION_LIMIT: usize = 20_000; + // + // #[test] + // fn query_reserves() { + // let mut deps = mock_instance(WASM, &[]); + // let sender = String::from("sender"); + // let info = mock_info(&sender, &coins(1000, "unibi")); + // let inst_msg = InitMsg {}; + // let result: Response = + // instantiate(&mut deps, mock_env(), info, inst_msg).unwrap(); + // assert_eq!(result.messages.len(), 0); + + // let pair = String::from("ueth:unusd"); + // let query_msg = NibiruQuery::Reserves { pair }; + // let raw_resp = query(&mut deps, mock_env(), query_msg); + // assert!(raw_resp.is_err(), "err: {}", raw_resp.unwrap_err()); + // let resp: ReservesResponse = + // from_slice(&raw_resp.unwrap(), DESERIALIZATION_LIMIT).unwrap(); + // assert_eq!(resp.pair, pair) + // } +} \ No newline at end of file diff --git a/contracts/nibi-stargate-perp/src/lib.rs b/contracts/nibi-stargate-perp/src/lib.rs new file mode 100644 index 0000000..4934c19 --- /dev/null +++ b/contracts/nibi-stargate-perp/src/lib.rs @@ -0,0 +1,3 @@ +pub mod contract; +pub mod msg; +pub mod state; diff --git a/contracts/nibi-stargate-perp/src/msg.rs b/contracts/nibi-stargate-perp/src/msg.rs new file mode 100644 index 0000000..3dc1025 --- /dev/null +++ b/contracts/nibi-stargate-perp/src/msg.rs @@ -0,0 +1,96 @@ +use cosmwasm_schema::cw_serde; +use cosmwasm_std::{Coin, Decimal, Uint128}; + +use crate::state::Sudoers; + +/// InitMsg: message type for smart contract instantiation +#[cw_serde] +pub struct InitMsg { + pub admin: Option, +} + +// --------------------------------------------------------------------------- +// Entry Point - Execute +// --------------------------------------------------------------------------- + +/// ExecuteMsg: message type for invoking or executing the smart contract +#[cw_serde] +pub enum ExecuteMsg { + MarketOrder { + pair: String, + is_long: bool, + quote_amount: Uint128, + leverage: Decimal, + base_amount_limit: Uint128, + }, + + ClosePosition { + pair: String, + }, + + AddMargin { + pair: String, + margin: Coin, + }, + + RemoveMargin { + pair: String, + margin: Coin, + }, + + MultiLiquidate { + liquidations: Vec, + }, + + DonateToInsuranceFund { + donation: Coin, + }, + + Claim { + funds: Option, + claim_all: Option, + to: String, + }, +} + +#[cw_serde] +pub struct LiquidationArgs { + pub pair: String, + pub trader: String, +} + +// --------------------------------------------------------------------------- +// Entry Point - Query +// --------------------------------------------------------------------------- + +#[cw_serde] +pub enum QueryMsg { + Sudoers {}, + + /// Query perp markets + Markets {}, + + /// Query a single Nibi-Perps position + Position { + trader: String, + pair: String, + }, + + /// Query all Nibi-Perps positions for the trader + Positions { + trader: String, + }, + + /// Query the Nibi-Perps module accounts + ModuleAccounts {}, + + /// Query prices from the Nibi-Oracle. + OraclePrices { + pairs: Option>, + }, +} + +#[cw_serde] +pub struct SudoersQueryResponse { + pub sudoers: Sudoers, +} diff --git a/contracts/nibi-stargate-perp/src/state.rs b/contracts/nibi-stargate-perp/src/state.rs new file mode 100644 index 0000000..b7f6497 --- /dev/null +++ b/contracts/nibi-stargate-perp/src/state.rs @@ -0,0 +1,94 @@ +use std::collections::HashSet; + +use cosmwasm_schema::cw_serde; +use cw_storage_plus::Item; + +pub const SUDOERS: Item = Item::new("sudoers"); + +#[cw_serde] +pub struct Sudoers { + pub members: HashSet, + pub admin: String, +} + +impl Sudoers { + pub fn has(&self, addr: impl AsRef) -> bool { + let addr = addr.as_ref(); + self.members.contains(addr) || self.admin == addr + } + + pub fn is_admin(&self, addr: impl AsRef) -> bool { + let addr = addr.as_ref(); + self.admin == addr + } + + pub fn is_member(&self, addr: impl AsRef) -> bool { + let addr = addr.as_ref(); + self.members.contains(addr) + } +} + +#[cfg(test)] +pub mod tests { + use cosmwasm_std::testing::MockStorage; + + use super::*; + + pub fn init_mock_sudoers() -> Sudoers { + let member_names = ["alice", "brock", "david"]; + let members: HashSet = + member_names.iter().map(|&s| s.to_string()).collect(); + let admin: String = "cait".to_string(); + Sudoers { members, admin } + } + + #[test] + fn sudoers_is_admin() { + let sudoers = init_mock_sudoers(); + assert!(!sudoers.is_admin("alice")); + assert!(sudoers.is_admin("cait")); + assert!(!sudoers.is_admin("david")); + assert!(!sudoers.is_admin("brock")); + } + + #[test] + fn sudoers_is_member() { + let sudoers = init_mock_sudoers(); + assert!(sudoers.is_member("alice")); + assert!(!sudoers.is_member("cait")); + assert!(sudoers.is_member("david")); + assert!(sudoers.is_member("brock")); + } + + #[test] + fn sudoers_has() { + let sudoers = init_mock_sudoers(); + + let sudoersed_names = ["alice", "brock", "cait", "david"]; + for name in sudoersed_names.iter() { + assert!(sudoers.has(name)); + } + + let other_names = ["xxx", "not-sudoersed"]; + for name in other_names.iter() { + assert!(!sudoers.has(name)); + } + } + + #[test] + fn save_and_load() { + let mut store = MockStorage::new(); + + // Store should start out empty + assert!(SUDOERS.load(&store).is_err()); + assert_eq!(SUDOERS.may_load(&store).unwrap(), None); + + // save to store + let sudoers = init_mock_sudoers(); + let res = SUDOERS.save(&mut store, &sudoers); + assert!(res.is_ok()); + + // load from store + assert_eq!(sudoers, SUDOERS.load(&store).unwrap()); + } +} diff --git a/contracts/nibi-stargate/Cargo.toml b/contracts/nibi-stargate/Cargo.toml index 8481326..f6c689d 100644 --- a/contracts/nibi-stargate/Cargo.toml +++ b/contracts/nibi-stargate/Cargo.toml @@ -13,15 +13,15 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -cw-utils = { version = "1.0.2" } -cw2 = { version = "1.1.1" } -cw20 = { version = "1.1.1" } -cosmwasm-schema = { version = "1.4.0" } -cosmwasm-std = { version = "1.4.0" } -cw-storage-plus = { version = "1.1.0" } -schemars = "0.8.15" -serde = { version = "1.0.188", default-features = false, features = ["derive"] } -thiserror = { version = "1.0.49" } +cosmwasm-schema = { workspace = true } +cosmwasm-std = { workspace = true } +cw-storage-plus = { workspace = true } +cw-utils = { workspace = true } +schemars = { workspace = true } +cw2 = { workspace = true } +cw20 = { workspace = true } +serde = { workspace = true } +thiserror = { workspace = true } anyhow = { workspace = true } nibiru-std = { workspace = true } diff --git a/contracts/nusd-valuator/.cargo/config b/contracts/nusd-valuator/.cargo/config new file mode 100644 index 0000000..b613a59 --- /dev/null +++ b/contracts/nusd-valuator/.cargo/config @@ -0,0 +1,4 @@ +[alias] +wasm = "build --release --target wasm32-unknown-unknown" +wasm-debug = "build --target wasm32-unknown-unknown" +schema = "run --example schema" diff --git a/contracts/nusd-valuator/src/lib.rs b/contracts/nusd-valuator/src/lib.rs index 95b91f5..06cf316 100644 --- a/contracts/nusd-valuator/src/lib.rs +++ b/contracts/nusd-valuator/src/lib.rs @@ -11,4 +11,4 @@ pub mod events; pub mod state; #[cfg(test)] -pub mod testing; \ No newline at end of file +pub mod testing; diff --git a/contracts/nusd-valuator/src/msgs.rs b/contracts/nusd-valuator/src/msgs.rs index b3f80de..df53807 100644 --- a/contracts/nusd-valuator/src/msgs.rs +++ b/contracts/nusd-valuator/src/msgs.rs @@ -1,7 +1,7 @@ use std::collections::BTreeSet; use cosmwasm_schema::cw_serde; -use cosmwasm_std::{Coin, Uint128}; +use cosmwasm_std as cw; #[cw_ownable::cw_ownable_query] #[cw_serde] @@ -9,14 +9,14 @@ use cosmwasm_std::{Coin, Uint128}; pub enum QueryMsg { /// Mintable: Returns the amount of μNUSD that can be minted in exchange /// for the given set of "from_coins". - #[returns(Uint128)] + #[returns(cw::Uint128)] Mintable { from_coins: BTreeSet }, /// Redeemable: Returns the amount of "to_denom" redeemable /// for the given "redeem_amount" of μNUSD. - #[returns(Uint128)] + #[returns(cw::Uint128)] Redeemable { - redeem_amount: Uint128, + redeem_amount: cw::Uint128, to_denom: String, }, @@ -26,8 +26,8 @@ pub enum QueryMsg { /// Returns the set of possible redeemable coins that could be received /// when redeeming the given "redeem_amount" of μNUSD. - #[returns(BTreeSet)] - RedeemableChoices { redeem_amount: Uint128 }, + #[returns(BTreeSet)] + RedeemableChoices { redeem_amount: cw::Uint128 }, } #[cw_ownable::cw_ownable_execute] @@ -54,4 +54,4 @@ pub struct InstantiateMsg { /// The owner is the only one that can use ExecuteMsg. pub owner: String, pub accepted_denoms: BTreeSet, -} \ No newline at end of file +} diff --git a/contracts/nusd-valuator/src/queries.rs b/contracts/nusd-valuator/src/queries.rs index b68b4c0..cd78957 100644 --- a/contracts/nusd-valuator/src/queries.rs +++ b/contracts/nusd-valuator/src/queries.rs @@ -68,4 +68,4 @@ pub fn query_redeemable_choices( }) .collect(); choices -} \ No newline at end of file +} diff --git a/contracts/nusd-valuator/src/testing.rs b/contracts/nusd-valuator/src/testing.rs index d74f223..c0a95c3 100644 --- a/contracts/nusd-valuator/src/testing.rs +++ b/contracts/nusd-valuator/src/testing.rs @@ -43,4 +43,4 @@ pub fn mock_env_height(height: u64) -> Env { let mut env = mock_env(); env.block.height = height; env -} \ No newline at end of file +} diff --git a/nibiru-std/Cargo.toml b/nibiru-std/Cargo.toml index db7049a..f42c331 100644 --- a/nibiru-std/Cargo.toml +++ b/nibiru-std/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nibiru-std" -version = "0.0.2" +version = "0.0.3" edition = "2021" description = "Nibiru Chain standard library for CosmWasm smart contracts" authors = ["Unique Divine "] @@ -11,12 +11,9 @@ repository = "https://github.com/NibiruChain/cw-nibiru" license-file = "LICENSE" # license = "MIT" # only one of license, license-file is needed. -[lib] -crate-type = ["cdylib", "rlib"] - [features] backtraces = ["cosmwasm-std/backtraces"] -library = [] +default = [] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] @@ -27,7 +24,6 @@ prost-types = "0.12.1" serde = "1.0.188" anyhow = { workspace = true } thiserror = { workspace = true } -nibiru-macro = { workspace = true } serde_json = { workspace = true } # cargo run --bin script-name diff --git a/nibiru-std/src/bindings/mod.rs b/nibiru-std/src/bindings/mod.rs index d0c2522..e623240 100644 --- a/nibiru-std/src/bindings/mod.rs +++ b/nibiru-std/src/bindings/mod.rs @@ -7,6 +7,3 @@ //! which are written in Rust and compiled to WebAssembly (Wasm). pub mod msg; -pub mod querier; -pub mod query; -pub mod state; \ No newline at end of file diff --git a/nibiru-std/src/bindings/msg.rs b/nibiru-std/src/bindings/msg.rs index bcaccfe..34a6b6f 100644 --- a/nibiru-std/src/bindings/msg.rs +++ b/nibiru-std/src/bindings/msg.rs @@ -1,32 +1,5 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{Coin, CosmosMsg, CustomMsg, Decimal, Uint128}; -use nibiru_macro::cw_custom; - -/// NibiruMsg is an override of CosmosMsg::Custom. Using this msg -/// wrapper for the NibiruMsg handlers show that their return values are valid -/// instances of CosmosMsg::Custom in a type-safe manner. It also shows how -/// NibiruMsg can be extended in the contract. -#[cw_serde] -#[cw_custom] -pub struct NibiruMsgWrapper { - pub route: NibiruRoute, - pub msg: NibiruMsg, -} - -/// Routes here refer to groups of operations that will be interpreted in -/// the x/wasmbinding package. The idea here is to add -/// information on which module or group of modules a particular execute message -/// belongs to. -#[cw_serde] -pub enum NibiruRoute { - /// "perp" is the route corresponding to bindings for the x/perp module. - Perp, - Oracle, - - /// "no_op" is a valid route that doesn't do anything. It's necessary for - /// formatting in the custom Wasm execute handler. - NoOp, -} +use cosmwasm_std::{Coin, Decimal, Uint128}; #[cw_serde] pub enum NibiruMsg { @@ -69,84 +42,3 @@ pub struct LiquidationArgs { pub pair: String, pub trader: String, } - -impl NibiruMsgWrapper { - pub fn market_order( - pair: String, - is_long: bool, - quote_amount: Uint128, - leverage: Decimal, - base_amount_limit: Uint128, - ) -> CosmosMsg { - NibiruMsgWrapper { - route: NibiruRoute::Perp, - msg: NibiruMsg::MarketOrder { - pair, - is_long, - quote_amount, - leverage, - base_amount_limit, - }, - } - .into() - } - - pub fn close_position(pair: String) -> CosmosMsg { - NibiruMsgWrapper { - route: NibiruRoute::Perp, - msg: NibiruMsg::ClosePosition { pair }, - } - .into() - } - - pub fn add_margin( - pair: String, - margin: Coin, - ) -> CosmosMsg { - NibiruMsgWrapper { - route: NibiruRoute::Perp, - msg: NibiruMsg::AddMargin { pair, margin }, - } - .into() - } - - pub fn remove_margin( - pair: String, - margin: Coin, - ) -> CosmosMsg { - NibiruMsgWrapper { - route: NibiruRoute::Perp, - msg: NibiruMsg::RemoveMargin { pair, margin }, - } - .into() - } - - pub fn multi_liquidate( - pair: String, - liquidations: Vec, - ) -> CosmosMsg { - NibiruMsgWrapper { - route: NibiruRoute::Perp, - msg: NibiruMsg::MultiLiquidate { pair, liquidations }, - } - .into() - } - - pub fn donate_to_insurance_fund( - donation: Coin, - ) -> CosmosMsg { - NibiruMsgWrapper { - route: NibiruRoute::Perp, - msg: NibiruMsg::DonateToInsuranceFund { donation }, - } - .into() - } - - pub fn no_op() -> CosmosMsg { - NibiruMsgWrapper { - route: NibiruRoute::NoOp, - msg: NibiruMsg::NoOp {}, - } - .into() - } -} diff --git a/nibiru-std/src/bindings/querier.rs b/nibiru-std/src/bindings/querier.rs deleted file mode 100644 index f34bafe..0000000 --- a/nibiru-std/src/bindings/querier.rs +++ /dev/null @@ -1,104 +0,0 @@ -use cosmwasm_std::{QuerierWrapper, StdResult, Uint256}; - -use crate::bindings::query::{ - AllMarketsResponse, BasePriceResponse, MetricsResponse, - ModuleAccountsResponse, ModuleParamsResponse, OraclePricesResponse, - PositionResponse, PositionsResponse, PremiumFractionResponse, QueryPerpMsg, - ReservesResponse, -}; -use std::collections::HashMap; - -/// NibiruQuerier makes it easy to export the functions that correspond to each -/// request without needing to know as much about the underlying types. -pub struct NibiruQuerier<'a> { - querier: &'a QuerierWrapper<'a, QueryPerpMsg>, -} - -impl<'a> NibiruQuerier<'a> { - pub fn new(querier: &'a QuerierWrapper) -> Self { - NibiruQuerier { querier } - } - - pub fn all_markets(&self) -> StdResult { - let request = QueryPerpMsg::AllMarkets {}; - self.querier.query(&request.into()) - } - - pub fn base_price( - &self, - pair: String, - is_long: bool, - base_amount: Uint256, - ) -> StdResult { - let request = QueryPerpMsg::BasePrice { - pair, - is_long, - base_amount, - }; - self.querier.query(&request.into()) - } - - pub fn position( - &self, - trader: String, - pair: String, - ) -> StdResult { - let request = QueryPerpMsg::Position { trader, pair }; - self.querier.query(&request.into()) - } - - pub fn positions(&self, trader: String) -> StdResult { - let request = QueryPerpMsg::Positions { trader }; - self.querier.query(&request.into()) - } - - pub fn reserves(&self, pair: String) -> StdResult { - let request = QueryPerpMsg::Reserves { pair }; - self.querier.query(&request.into()) - } - - pub fn oracle_prices( - &self, - pairs: Option>, - ) -> StdResult { - let request = QueryPerpMsg::OraclePrices {}; - let price_map: OraclePricesResponse = - self.querier.query(&request.into())?; - - match pairs { - Some(pair_vec) if !pair_vec.is_empty() => { - let mut out_price_map: OraclePricesResponse = HashMap::new(); - for p in pair_vec.iter() { - if let Some(rate) = price_map.get(p) { - out_price_map.insert(p.clone(), *rate); - } - } - Ok(out_price_map) - } - _ => Ok(price_map), - } - } - - pub fn premium_fraction( - &self, - pair: String, - ) -> StdResult { - let request = QueryPerpMsg::PremiumFraction { pair }; - self.querier.query(&request.into()) - } - - pub fn metrics(&self, pair: String) -> StdResult { - let request = QueryPerpMsg::Metrics { pair }; - self.querier.query(&request.into()) - } - - pub fn module_params(&self) -> StdResult { - let request = QueryPerpMsg::ModuleParams {}; - self.querier.query(&request.into()) - } - - pub fn module_accounts(&self) -> StdResult { - let request = QueryPerpMsg::ModuleAccounts {}; - self.querier.query(&request.into()) - } -} diff --git a/nibiru-std/src/bindings/query.rs b/nibiru-std/src/bindings/query.rs deleted file mode 100644 index f74cef9..0000000 --- a/nibiru-std/src/bindings/query.rs +++ /dev/null @@ -1,117 +0,0 @@ -use std::collections::HashMap; - -use cosmwasm_schema::cw_serde; -use cosmwasm_std::{CustomQuery, Decimal, Uint256, Uint64}; - -use crate::bindings::state::{ - Market, Metrics, ModuleAccountWithBalance, ModuleParams, Position, -}; - -#[cw_serde] -pub enum QueryPerpMsg { - // ----------------------------------------------------------------- - // From x/perp/amm - // ----------------------------------------------------------------- - AllMarkets {}, - - Reserves { - pair: String, - }, - - BasePrice { - pair: String, - is_long: bool, - base_amount: Uint256, - }, - - // ----------------------------------------------------------------- - // From x/perp - // ----------------------------------------------------------------- - Position { - trader: String, - pair: String, - }, - - Positions { - trader: String, - }, - - ModuleParams {}, - - PremiumFraction { - pair: String, - }, - - Metrics { - pair: String, - }, - - ModuleAccounts {}, - - // ----------------------------------------------------------------- - // From x/oracle - // ----------------------------------------------------------------- - OraclePrices {}, -} - -impl CustomQuery for QueryPerpMsg {} - -#[cw_serde] -pub struct AllMarketsResponse { - pub market_map: HashMap, -} - -#[cw_serde] -pub struct ReservesResponse { - pub pair: String, - pub base_reserve: Decimal, - pub quote_reserve: Decimal, -} - -// #[cw_serde] -pub type OraclePricesResponse = HashMap; - -#[cw_serde] -pub struct BasePriceResponse { - pub pair: String, - pub base_amount: Decimal, - pub quote_amount: Decimal, - pub is_long: bool, -} - -#[cw_serde] -pub struct PositionResponse { - pub position: Position, - pub notional: String, // signed dec - pub upnl: String, // signed dec - pub margin_ratio_mark: Decimal, - pub margin_ratio_index: Decimal, - pub block_number: Uint64, -} - -#[cw_serde] -pub struct PositionsResponse { - pub positions: HashMap, -} - -#[cw_serde] -pub struct ModuleParamsResponse { - pub module_params: ModuleParams, -} - -#[cw_serde] -pub struct PremiumFractionResponse { - pub pair: String, - pub cpf: Decimal, - pub estimated_next_cpf: Decimal, -} - -#[cw_serde] -pub struct MetricsResponse { - pub metrics: Metrics, -} - -#[cw_serde] -pub struct ModuleAccountsResponse { - pub module_accounts: HashMap, -} diff --git a/nibiru-std/src/bindings/route.rs b/nibiru-std/src/bindings/route.rs deleted file mode 100644 index c6735b8..0000000 --- a/nibiru-std/src/bindings/route.rs +++ /dev/null @@ -1,16 +0,0 @@ -use cosmwasm_schema::cw_serde; - -/// Routes here refer to groups of operations that will be interpreted in -/// the x/wasm/binding packa . The idea here is to add -/// information on which module or group of modules a particular execute message -/// belongs to. -#[cw_serde] -pub enum NibiruRoute { - /// "perp" is the route corresponding to bindings for the x/perp module. - Perp, - Oracle, - - /// "no_op" is a valid route that doesn't do anything. It's necessary for - /// formatting in the custom Wasm execute handler. - NoOp, -} diff --git a/nibiru-std/src/bindings/state.rs b/nibiru-std/src/bindings/state.rs deleted file mode 100644 index 61d1eab..0000000 --- a/nibiru-std/src/bindings/state.rs +++ /dev/null @@ -1,68 +0,0 @@ -use std::collections::HashSet; - -use cosmwasm_schema::cw_serde; -use cosmwasm_std::{Addr, Coin, Decimal, Uint256, Uint64}; - -#[cw_serde] -pub struct Position { - pub trader_addr: Addr, - pub pair: String, - pub size: String, // signed dec - pub margin: Decimal, - pub open_notional: Decimal, - pub latest_cpf: Decimal, - pub block_number: Uint64, -} - -#[cw_serde] -pub struct Market { - pub pair: String, - pub version: Uint64, - pub base_reserve: Decimal, - pub quote_reserve: Decimal, - pub sqrt_depth: Decimal, - pub depth: Uint256, - pub total_long: Decimal, - pub total_short: Decimal, - pub peg_mult: Decimal, - pub config: MarketConfig, - pub mark_price: Decimal, - pub index_price: String, - pub twap_mark: String, - pub block_number: Uint64, -} - -#[cw_serde] -pub struct MarketConfig { - pub maintenance_margin_ratio: Decimal, - pub max_leverage: Decimal, -} - -#[cw_serde] -pub struct ModuleParams { - pub stopped: bool, - pub fee_pool_fee_ratio: Decimal, - pub ecosystem_fund_fee_ratio: Decimal, - pub liquidation_fee_ratio: Decimal, - pub partial_liquidation_ratio: Decimal, - pub funding_rate_interval: String, - pub twap_lookback_window: Uint64, - pub whitelisted_liquidators: HashSet, -} - -#[cw_serde] -pub struct Metrics { - pub pair: String, - pub net_size: Decimal, - pub volume_quote: Decimal, - pub volume_base: Decimal, - pub block_number: Uint64, -} - -#[cw_serde] -#[derive(Eq)] -pub struct ModuleAccountWithBalance { - pub name: String, - pub addr: Addr, - pub balance: Vec, -} diff --git a/nibiru-std/src/lib.rs b/nibiru-std/src/lib.rs index 46c3d45..19049d9 100644 --- a/nibiru-std/src/lib.rs +++ b/nibiru-std/src/lib.rs @@ -1,18 +1,12 @@ -/// bindings/mod.rs: Custom Nibiru module bindings for smart contracts. -/// -/// Bindings refer to a layer of code that allows two different programming -/// languages or systems to communicate with each other. -/// In the context of CosmWasm smart contracts and the Cosmos SDK, bindings -/// allow the Go-based Cosmos SDK to interact with and execute smart contracts, -/// which are written in Rust and compiled to WebAssembly (Wasm). pub mod bindings; -/// proto/mod.rs: Protobuf types defined in NibiruChain/nibiru/proto. pub mod proto; pub mod wasm; pub mod errors; +pub mod tutil; + pub const VERSION_COSMOS_SDK: &str = "v0.47.5"; -pub const VERSION_NIBIRU: &str = "240c7fba3ef38ac066c9a543a9028d6484d6374f"; +pub const VERSION_NIBIRU: &str = "9e9701e5b0f9d6a550d06454e6ad2a4cba1859aa"; diff --git a/nibiru-std/src/proto/buf/cosmos.bank.v1beta1.rs b/nibiru-std/src/proto/buf/cosmos.bank.v1beta1.rs index 8aa4c1e..381e94a 100644 --- a/nibiru-std/src/proto/buf/cosmos.bank.v1beta1.rs +++ b/nibiru-std/src/proto/buf/cosmos.bank.v1beta1.rs @@ -6,13 +6,13 @@ #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SendAuthorization { - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub spend_limit: ::prost::alloc::vec::Vec, /// allow_list specifies an optional list of addresses to whom the grantee can send tokens on behalf of the /// granter. If omitted, any recipient is allowed. /// /// Since: cosmos-sdk 0.47 - #[prost(string, repeated, tag = "2")] + #[prost(string, repeated, tag="2")] pub allow_list: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// Params defines the parameters for the bank module. @@ -25,9 +25,9 @@ pub struct Params { /// /// As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files. #[deprecated] - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub send_enabled: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "2")] + #[prost(bool, tag="2")] pub default_send_enabled: bool, } /// SendEnabled maps coin denom to a send_enabled status (whether a denom is @@ -35,27 +35,27 @@ pub struct Params { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SendEnabled { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub denom: ::prost::alloc::string::String, - #[prost(bool, tag = "2")] + #[prost(bool, tag="2")] pub enabled: bool, } /// Input models transaction input. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Input { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub address: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "2")] + #[prost(message, repeated, tag="2")] pub coins: ::prost::alloc::vec::Vec, } /// Output models transaction outputs. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Output { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub address: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "2")] + #[prost(message, repeated, tag="2")] pub coins: ::prost::alloc::vec::Vec, } /// Supply represents a struct that passively keeps track of the total supply @@ -64,7 +64,7 @@ pub struct Output { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Supply { - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub total: ::prost::alloc::vec::Vec, } /// DenomUnit represents a struct that describes a given @@ -73,17 +73,17 @@ pub struct Supply { #[derive(Clone, PartialEq, ::prost::Message)] pub struct DenomUnit { /// denom represents the string name of the given denom unit (e.g uatom). - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub denom: ::prost::alloc::string::String, /// exponent represents power of 10 exponent that one must /// raise the base_denom to in order to equal the given DenomUnit's denom /// 1 denom = 10^exponent base_denom /// (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with /// exponent = 6, thus: 1 atom = 10^6 uatom). - #[prost(uint32, tag = "2")] + #[prost(uint32, tag="2")] pub exponent: u32, /// aliases is a list of string aliases for the given denom - #[prost(string, repeated, tag = "3")] + #[prost(string, repeated, tag="3")] pub aliases: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// Metadata represents a struct that describes @@ -91,39 +91,39 @@ pub struct DenomUnit { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Metadata { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub description: ::prost::alloc::string::String, /// denom_units represents the list of DenomUnit's for a given coin - #[prost(message, repeated, tag = "2")] + #[prost(message, repeated, tag="2")] pub denom_units: ::prost::alloc::vec::Vec, /// base represents the base denom (should be the DenomUnit with exponent = 0). - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub base: ::prost::alloc::string::String, /// display indicates the suggested denom that should be /// displayed in clients. - #[prost(string, tag = "4")] + #[prost(string, tag="4")] pub display: ::prost::alloc::string::String, /// name defines the name of the token (eg: Cosmos Atom) /// /// Since: cosmos-sdk 0.43 - #[prost(string, tag = "5")] + #[prost(string, tag="5")] pub name: ::prost::alloc::string::String, /// symbol is the token symbol usually shown on exchanges (eg: ATOM). This can /// be the same as the display. /// /// Since: cosmos-sdk 0.43 - #[prost(string, tag = "6")] + #[prost(string, tag="6")] pub symbol: ::prost::alloc::string::String, /// URI to a document (on or off-chain) that contains additional information. Optional. /// /// Since: cosmos-sdk 0.46 - #[prost(string, tag = "7")] + #[prost(string, tag="7")] pub uri: ::prost::alloc::string::String, /// URIHash is a sha256 hash of a document pointed by URI. It's used to verify that /// the document didn't change. Optional. /// /// Since: cosmos-sdk 0.46 - #[prost(string, tag = "8")] + #[prost(string, tag="8")] pub uri_hash: ::prost::alloc::string::String, } /// GenesisState defines the bank module's genesis state. @@ -131,22 +131,22 @@ pub struct Metadata { #[derive(Clone, PartialEq, ::prost::Message)] pub struct GenesisState { /// params defines all the parameters of the module. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub params: ::core::option::Option, /// balances is an array containing the balances of all the accounts. - #[prost(message, repeated, tag = "2")] + #[prost(message, repeated, tag="2")] pub balances: ::prost::alloc::vec::Vec, /// supply represents the total supply. If it is left empty, then supply will be calculated based on the provided /// balances. Otherwise, it will be used to validate that the sum of the balances equals this amount. - #[prost(message, repeated, tag = "3")] + #[prost(message, repeated, tag="3")] pub supply: ::prost::alloc::vec::Vec, /// denom_metadata defines the metadata of the different coins. - #[prost(message, repeated, tag = "4")] + #[prost(message, repeated, tag="4")] pub denom_metadata: ::prost::alloc::vec::Vec, /// send_enabled defines the denoms where send is enabled or disabled. /// /// Since: cosmos-sdk 0.47 - #[prost(message, repeated, tag = "5")] + #[prost(message, repeated, tag="5")] pub send_enabled: ::prost::alloc::vec::Vec, } /// Balance defines an account address and balance pair used in the bank module's @@ -155,10 +155,10 @@ pub struct GenesisState { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Balance { /// address is the address of the balance holder. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub address: ::prost::alloc::string::String, /// coins defines the different coins this balance holds. - #[prost(message, repeated, tag = "2")] + #[prost(message, repeated, tag="2")] pub coins: ::prost::alloc::vec::Vec, } /// QueryBalanceRequest is the request type for the Query/Balance RPC method. @@ -166,10 +166,10 @@ pub struct Balance { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryBalanceRequest { /// address is the address to query balances for. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub address: ::prost::alloc::string::String, /// denom is the coin denom to query balances for. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub denom: ::prost::alloc::string::String, } /// QueryBalanceResponse is the response type for the Query/Balance RPC method. @@ -177,7 +177,7 @@ pub struct QueryBalanceRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryBalanceResponse { /// balance is the balance of the coin. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub balance: ::core::option::Option, } /// QueryBalanceRequest is the request type for the Query/AllBalances RPC method. @@ -185,12 +185,11 @@ pub struct QueryBalanceResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryAllBalancesRequest { /// address is the address to query balances for. - #[prost(string, tag = "1")] + #[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, + #[prost(message, optional, tag="2")] + pub pagination: ::core::option::Option, } /// QueryAllBalancesResponse is the response type for the Query/AllBalances RPC /// method. @@ -198,12 +197,11 @@ pub struct QueryAllBalancesRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryAllBalancesResponse { /// balances is the balances of all the coins. - #[prost(message, repeated, tag = "1")] + #[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, + #[prost(message, optional, tag="2")] + pub pagination: ::core::option::Option, } /// QuerySpendableBalancesRequest defines the gRPC request structure for querying /// an account's spendable balances. @@ -213,12 +211,11 @@ pub struct QueryAllBalancesResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QuerySpendableBalancesRequest { /// address is the address to query spendable balances for. - #[prost(string, tag = "1")] + #[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, + #[prost(message, optional, tag="2")] + pub pagination: ::core::option::Option, } /// QuerySpendableBalancesResponse defines the gRPC response structure for querying /// an account's spendable balances. @@ -228,12 +225,11 @@ pub struct QuerySpendableBalancesRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QuerySpendableBalancesResponse { /// balances is the spendable balances of all the coins. - #[prost(message, repeated, tag = "1")] + #[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, + #[prost(message, optional, tag="2")] + pub pagination: ::core::option::Option, } /// QuerySpendableBalanceByDenomRequest defines the gRPC request structure for /// querying an account's spendable balance for a specific denom. @@ -243,10 +239,10 @@ pub struct QuerySpendableBalancesResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QuerySpendableBalanceByDenomRequest { /// address is the address to query balances for. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub address: ::prost::alloc::string::String, /// denom is the coin denom to query balances for. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub denom: ::prost::alloc::string::String, } /// QuerySpendableBalanceByDenomResponse defines the gRPC response structure for @@ -257,7 +253,7 @@ pub struct QuerySpendableBalanceByDenomRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QuerySpendableBalanceByDenomResponse { /// balance is the balance of the coin. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub balance: ::core::option::Option, } /// QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC @@ -268,9 +264,8 @@ pub struct QueryTotalSupplyRequest { /// pagination defines an optional pagination for the request. /// /// Since: cosmos-sdk 0.43 - #[prost(message, optional, tag = "1")] - pub pagination: - ::core::option::Option, + #[prost(message, optional, tag="1")] + pub pagination: ::core::option::Option, } /// QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC /// method @@ -278,21 +273,20 @@ pub struct QueryTotalSupplyRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryTotalSupplyResponse { /// supply is the supply of the coins - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub supply: ::prost::alloc::vec::Vec, /// pagination defines the pagination in the response. /// /// Since: cosmos-sdk 0.43 - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, + #[prost(message, optional, tag="2")] + pub pagination: ::core::option::Option, } /// QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QuerySupplyOfRequest { /// denom is the coin denom to query balances for. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub denom: ::prost::alloc::string::String, } /// QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. @@ -300,18 +294,19 @@ pub struct QuerySupplyOfRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QuerySupplyOfResponse { /// amount is the supply of the coin. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub amount: ::core::option::Option, } /// QueryParamsRequest defines the request type for querying x/bank parameters. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryParamsRequest {} +pub struct QueryParamsRequest { +} /// QueryParamsResponse defines the response type for querying x/bank parameters. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryParamsResponse { - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub params: ::core::option::Option, } /// QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. @@ -319,9 +314,8 @@ pub struct QueryParamsResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDenomsMetadataRequest { /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "1")] - pub pagination: - ::core::option::Option, + #[prost(message, optional, tag="1")] + pub pagination: ::core::option::Option, } /// QueryDenomsMetadataResponse is the response type for the Query/DenomsMetadata RPC /// method. @@ -329,19 +323,18 @@ pub struct QueryDenomsMetadataRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDenomsMetadataResponse { /// metadata provides the client information for all the registered tokens. - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub metadatas: ::prost::alloc::vec::Vec, /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, + #[prost(message, optional, tag="2")] + pub pagination: ::core::option::Option, } /// QueryDenomMetadataRequest is the request type for the Query/DenomMetadata RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDenomMetadataRequest { /// denom is the coin denom to query the metadata for. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub denom: ::prost::alloc::string::String, } /// QueryDenomMetadataResponse is the response type for the Query/DenomMetadata RPC @@ -350,7 +343,7 @@ pub struct QueryDenomMetadataRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDenomMetadataResponse { /// metadata describes and provides all the client information for the requested token. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub metadata: ::core::option::Option, } /// QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query, @@ -360,12 +353,11 @@ pub struct QueryDenomMetadataResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDenomOwnersRequest { /// denom defines the coin denomination to query all account holders for. - #[prost(string, tag = "1")] + #[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, + #[prost(message, optional, tag="2")] + pub pagination: ::core::option::Option, } /// DenomOwner defines structure representing an account that owns or holds a /// particular denominated token. It contains the account address and account @@ -376,10 +368,10 @@ pub struct QueryDenomOwnersRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct DenomOwner { /// address defines the address that owns a particular denomination. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub address: ::prost::alloc::string::String, /// balance is the balance of the denominated coin for an account. - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub balance: ::core::option::Option, } /// QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. @@ -388,12 +380,11 @@ pub struct DenomOwner { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDenomOwnersResponse { - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub denom_owners: ::prost::alloc::vec::Vec, /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, + #[prost(message, optional, tag="2")] + pub pagination: ::core::option::Option, } /// QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. /// @@ -402,13 +393,12 @@ pub struct QueryDenomOwnersResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QuerySendEnabledRequest { /// denoms is the specific denoms you want look up. Leave empty to get all entries. - #[prost(string, repeated, tag = "1")] + #[prost(string, repeated, tag="1")] pub denoms: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, /// pagination defines an optional pagination for the request. This field is /// only read if the denoms field is empty. - #[prost(message, optional, tag = "99")] - pub pagination: - ::core::option::Option, + #[prost(message, optional, tag="99")] + pub pagination: ::core::option::Option, } /// QuerySendEnabledResponse defines the RPC response of a SendEnable query. /// @@ -416,45 +406,45 @@ pub struct QuerySendEnabledRequest { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QuerySendEnabledResponse { - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub send_enabled: ::prost::alloc::vec::Vec, /// pagination defines the pagination in the response. This field is only /// populated if the denoms field in the request is empty. - #[prost(message, optional, tag = "99")] - pub pagination: - ::core::option::Option, + #[prost(message, optional, tag="99")] + pub pagination: ::core::option::Option, } - /// MsgSend represents a message to send coins from one account to another. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgSend { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub from_address: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub to_address: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "3")] + #[prost(message, repeated, tag="3")] pub amount: ::prost::alloc::vec::Vec, } /// MsgSendResponse defines the Msg/Send response type. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgSendResponse {} +pub struct MsgSendResponse { +} /// MsgMultiSend represents an arbitrary multi-in, multi-out send message. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgMultiSend { /// Inputs, despite being `repeated`, only allows one sender input. This is /// checked in MsgMultiSend's ValidateBasic. - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub inputs: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "2")] + #[prost(message, repeated, tag="2")] pub outputs: ::prost::alloc::vec::Vec, } /// MsgMultiSendResponse defines the Msg/MultiSend response type. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgMultiSendResponse {} +pub struct MsgMultiSendResponse { +} /// MsgUpdateParams is the Msg/UpdateParams request type. /// /// Since: cosmos-sdk 0.47 @@ -462,12 +452,12 @@ pub struct MsgMultiSendResponse {} #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgUpdateParams { /// authority is the address that controls the module (defaults to x/gov unless overwritten). - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub authority: ::prost::alloc::string::String, /// params defines the x/bank parameters to update. /// /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub params: ::core::option::Option, } /// MsgUpdateParamsResponse defines the response structure for executing a @@ -476,7 +466,8 @@ pub struct MsgUpdateParams { /// Since: cosmos-sdk 0.47 #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgUpdateParamsResponse {} +pub struct MsgUpdateParamsResponse { +} /// MsgSetSendEnabled is the Msg/SetSendEnabled request type. /// /// Only entries to add/update/delete need to be included. @@ -487,23 +478,23 @@ pub struct MsgUpdateParamsResponse {} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgSetSendEnabled { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub authority: ::prost::alloc::string::String, /// send_enabled is the list of entries to add or update. - #[prost(message, repeated, tag = "2")] + #[prost(message, repeated, tag="2")] pub send_enabled: ::prost::alloc::vec::Vec, /// use_default_for is a list of denoms that should use the params.default_send_enabled value. /// Denoms listed here will have their SendEnabled entries deleted. /// If a denom is included that doesn't have a SendEnabled entry, /// it will be ignored. - #[prost(string, repeated, tag = "3")] - pub use_default_for: - ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, repeated, tag="3")] + pub use_default_for: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. /// /// Since: cosmos-sdk 0.47 #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgSetSendEnabledResponse {} -// @@protoc_insertion_point(module) \ No newline at end of file +pub struct MsgSetSendEnabledResponse { +} +// @@protoc_insertion_point(module) diff --git a/nibiru-std/src/proto/buf/cosmos.crypto.keyring.v1.rs b/nibiru-std/src/proto/buf/cosmos.crypto.keyring.v1.rs index d9a3dd1..c6bdb66 100644 --- a/nibiru-std/src/proto/buf/cosmos.crypto.keyring.v1.rs +++ b/nibiru-std/src/proto/buf/cosmos.crypto.keyring.v1.rs @@ -28,7 +28,7 @@ pub mod record { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Ledger { #[prost(message, optional, tag="1")] - pub path: ::core::option::Option, + pub path: ::core::option::Option, } /// Multi item #[allow(clippy::derive_partial_eq_without_eq)] diff --git a/nibiru-std/src/proto/buf/cosmos.staking.v1beta1.rs b/nibiru-std/src/proto/buf/cosmos.staking.v1beta1.rs index d4607ce..93a9d7f 100644 --- a/nibiru-std/src/proto/buf/cosmos.staking.v1beta1.rs +++ b/nibiru-std/src/proto/buf/cosmos.staking.v1beta1.rs @@ -1,47 +1,19 @@ // @generated -/// StakeAuthorization defines authorization for delegate/undelegate/redelegate. -/// -/// Since: cosmos-sdk 0.43 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct StakeAuthorization { - /// max_tokens specifies the maximum amount of tokens can be delegate to a validator. If it is - /// empty, there is no spend limit and any amount of coins can be delegated. - #[prost(message, optional, tag="1")] - pub max_tokens: ::core::option::Option, - /// authorization_type defines one of AuthorizationType. - #[prost(enumeration="AuthorizationType", tag="4")] - pub authorization_type: i32, - /// validators is the oneof that represents either allow_list or deny_list - #[prost(oneof="stake_authorization::Validators", tags="2, 3")] - pub validators: ::core::option::Option, -} -/// Nested message and enum types in `StakeAuthorization`. -pub mod stake_authorization { - /// Validators defines list of validator addresses. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Validators { - #[prost(string, repeated, tag="1")] - pub address: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - } - /// validators is the oneof that represents either allow_list or deny_list - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Validators { - /// allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's - /// account. - #[prost(message, tag="2")] - AllowList(Validators), - /// deny_list specifies list of validator addresses to whom grantee can not delegate tokens. - #[prost(message, tag="3")] - DenyList(Validators), - } -} + /// AuthorizationType defines the type of staking module authorization type /// /// Since: cosmos-sdk 0.43 -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] #[repr(i32)] pub enum AuthorizationType { /// AUTHORIZATION_TYPE_UNSPECIFIED specifies an unknown authorization type @@ -84,9 +56,9 @@ impl AuthorizationType { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct HistoricalInfo { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub header: ::core::option::Option, - #[prost(message, repeated, tag="2")] + #[prost(message, repeated, tag = "2")] pub valset: ::prost::alloc::vec::Vec, } /// CommissionRates defines the initial commission rates to be used for creating @@ -95,13 +67,13 @@ pub struct HistoricalInfo { #[derive(Clone, PartialEq, ::prost::Message)] pub struct CommissionRates { /// rate is the commission rate charged to delegators, as a fraction. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub rate: ::prost::alloc::string::String, /// max_rate defines the maximum commission rate which validator can ever charge, as a fraction. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub max_rate: ::prost::alloc::string::String, /// max_change_rate defines the maximum daily increase of the validator commission, as a fraction. - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub max_change_rate: ::prost::alloc::string::String, } /// Commission defines commission parameters for a given validator. @@ -109,10 +81,10 @@ pub struct CommissionRates { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Commission { /// commission_rates defines the initial commission rates to be used for creating a validator. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub commission_rates: ::core::option::Option, /// update_time is the last time the commission rate was changed. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub update_time: ::core::option::Option<::prost_types::Timestamp>, } /// Description defines a validator description. @@ -120,19 +92,19 @@ pub struct Commission { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Description { /// moniker defines a human-readable name for the validator. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub moniker: ::prost::alloc::string::String, /// identity defines an optional identity signature (ex. UPort or Keybase). - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub identity: ::prost::alloc::string::String, /// website defines an optional website link. - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub website: ::prost::alloc::string::String, /// security_contact defines an optional email for security contact. - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub security_contact: ::prost::alloc::string::String, /// details define other optional details. - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub details: ::prost::alloc::string::String, } /// Validator defines a validator, together with the total amount of the @@ -147,52 +119,52 @@ pub struct Description { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Validator { /// operator_address defines the address of the validator's operator; bech encoded in JSON. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub operator_address: ::prost::alloc::string::String, /// consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub consensus_pubkey: ::core::option::Option<::prost_types::Any>, /// jailed defined whether the validator has been jailed from bonded status or not. - #[prost(bool, tag="3")] + #[prost(bool, tag = "3")] pub jailed: bool, /// status is the validator status (bonded/unbonding/unbonded). - #[prost(enumeration="BondStatus", tag="4")] + #[prost(enumeration = "BondStatus", tag = "4")] pub status: i32, /// tokens define the delegated tokens (incl. self-delegation). - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub tokens: ::prost::alloc::string::String, /// delegator_shares defines total shares issued to a validator's delegators. - #[prost(string, tag="6")] + #[prost(string, tag = "6")] pub delegator_shares: ::prost::alloc::string::String, /// description defines the description terms for the validator. - #[prost(message, optional, tag="7")] + #[prost(message, optional, tag = "7")] pub description: ::core::option::Option, /// unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. - #[prost(int64, tag="8")] + #[prost(int64, tag = "8")] pub unbonding_height: i64, /// unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. - #[prost(message, optional, tag="9")] + #[prost(message, optional, tag = "9")] pub unbonding_time: ::core::option::Option<::prost_types::Timestamp>, /// commission defines the commission parameters. - #[prost(message, optional, tag="10")] + #[prost(message, optional, tag = "10")] pub commission: ::core::option::Option, /// min_self_delegation is the validator's self declared minimum self delegation. /// /// Since: cosmos-sdk 0.46 - #[prost(string, tag="11")] + #[prost(string, tag = "11")] pub min_self_delegation: ::prost::alloc::string::String, /// strictly positive if this validator's unbonding has been stopped by external modules - #[prost(int64, tag="12")] + #[prost(int64, tag = "12")] pub unbonding_on_hold_ref_count: i64, /// list of unbonding ids, each uniquely identifing an unbonding of this validator - #[prost(uint64, repeated, tag="13")] + #[prost(uint64, repeated, tag = "13")] pub unbonding_ids: ::prost::alloc::vec::Vec, } /// ValAddresses defines a repeated set of validator addresses. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ValAddresses { - #[prost(string, repeated, tag="1")] + #[prost(string, repeated, tag = "1")] pub addresses: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// DVPair is struct that just has a delegator-validator pair with no other data. @@ -201,16 +173,16 @@ pub struct ValAddresses { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DvPair { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub delegator_address: ::prost::alloc::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub validator_address: ::prost::alloc::string::String, } /// DVPairs defines an array of DVPair objects. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DvPairs { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub pairs: ::prost::alloc::vec::Vec, } /// DVVTriplet is struct that just has a delegator-validator-validator triplet @@ -220,18 +192,18 @@ pub struct DvPairs { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DvvTriplet { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub delegator_address: ::prost::alloc::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub validator_src_address: ::prost::alloc::string::String, - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub validator_dst_address: ::prost::alloc::string::String, } /// DVVTriplets defines an array of DVVTriplet objects. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DvvTriplets { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub triplets: ::prost::alloc::vec::Vec, } /// Delegation represents the bond with tokens held by an account. It is @@ -241,13 +213,13 @@ pub struct DvvTriplets { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Delegation { /// delegator_address is the bech32-encoded address of the delegator. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub delegator_address: ::prost::alloc::string::String, /// validator_address is the bech32-encoded address of the validator. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub validator_address: ::prost::alloc::string::String, /// shares define the delegation shares received. - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub shares: ::prost::alloc::string::String, } /// UnbondingDelegation stores all of a single delegator's unbonding bonds @@ -256,15 +228,15 @@ pub struct Delegation { #[derive(Clone, PartialEq, ::prost::Message)] pub struct UnbondingDelegation { /// delegator_address is the bech32-encoded address of the delegator. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub delegator_address: ::prost::alloc::string::String, /// validator_address is the bech32-encoded address of the validator. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub validator_address: ::prost::alloc::string::String, /// entries are the unbonding delegation entries. /// /// unbonding delegation entries - #[prost(message, repeated, tag="3")] + #[prost(message, repeated, tag = "3")] pub entries: ::prost::alloc::vec::Vec, } /// UnbondingDelegationEntry defines an unbonding object with relevant metadata. @@ -272,22 +244,22 @@ pub struct UnbondingDelegation { #[derive(Clone, PartialEq, ::prost::Message)] pub struct UnbondingDelegationEntry { /// creation_height is the height which the unbonding took place. - #[prost(int64, tag="1")] + #[prost(int64, tag = "1")] pub creation_height: i64, /// completion_time is the unix time for unbonding completion. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub completion_time: ::core::option::Option<::prost_types::Timestamp>, /// initial_balance defines the tokens initially scheduled to receive at completion. - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub initial_balance: ::prost::alloc::string::String, /// balance defines the tokens to receive at completion. - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub balance: ::prost::alloc::string::String, /// Incrementing id that uniquely identifies this entry - #[prost(uint64, tag="5")] + #[prost(uint64, tag = "5")] pub unbonding_id: u64, /// Strictly positive if this entry's unbonding has been stopped by external modules - #[prost(int64, tag="6")] + #[prost(int64, tag = "6")] pub unbonding_on_hold_ref_count: i64, } /// RedelegationEntry defines a redelegation object with relevant metadata. @@ -295,22 +267,22 @@ pub struct UnbondingDelegationEntry { #[derive(Clone, PartialEq, ::prost::Message)] pub struct RedelegationEntry { /// creation_height defines the height which the redelegation took place. - #[prost(int64, tag="1")] + #[prost(int64, tag = "1")] pub creation_height: i64, /// completion_time defines the unix time for redelegation completion. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub completion_time: ::core::option::Option<::prost_types::Timestamp>, /// initial_balance defines the initial balance when redelegation started. - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub initial_balance: ::prost::alloc::string::String, /// shares_dst is the amount of destination-validator shares created by redelegation. - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub shares_dst: ::prost::alloc::string::String, /// Incrementing id that uniquely identifies this entry - #[prost(uint64, tag="5")] + #[prost(uint64, tag = "5")] pub unbonding_id: u64, /// Strictly positive if this entry's unbonding has been stopped by external modules - #[prost(int64, tag="6")] + #[prost(int64, tag = "6")] pub unbonding_on_hold_ref_count: i64, } /// Redelegation contains the list of a particular delegator's redelegating bonds @@ -319,18 +291,18 @@ pub struct RedelegationEntry { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Redelegation { /// delegator_address is the bech32-encoded address of the delegator. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub delegator_address: ::prost::alloc::string::String, /// validator_src_address is the validator redelegation source operator address. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub validator_src_address: ::prost::alloc::string::String, /// validator_dst_address is the validator redelegation destination operator address. - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub validator_dst_address: ::prost::alloc::string::String, /// entries are the redelegation entries. /// /// redelegation entries - #[prost(message, repeated, tag="4")] + #[prost(message, repeated, tag = "4")] pub entries: ::prost::alloc::vec::Vec, } /// Params defines the parameters for the x/staking module. @@ -338,22 +310,22 @@ pub struct Redelegation { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Params { /// unbonding_time is the time duration of unbonding. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub unbonding_time: ::core::option::Option<::prost_types::Duration>, /// max_validators is the maximum number of validators. - #[prost(uint32, tag="2")] + #[prost(uint32, tag = "2")] pub max_validators: u32, /// max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). - #[prost(uint32, tag="3")] + #[prost(uint32, tag = "3")] pub max_entries: u32, /// historical_entries is the number of historical entries to persist. - #[prost(uint32, tag="4")] + #[prost(uint32, tag = "4")] pub historical_entries: u32, /// bond_denom defines the bondable coin denomination. - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub bond_denom: ::prost::alloc::string::String, /// min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators - #[prost(string, tag="6")] + #[prost(string, tag = "6")] pub min_commission_rate: ::prost::alloc::string::String, } /// DelegationResponse is equivalent to Delegation except that it contains a @@ -361,10 +333,11 @@ pub struct Params { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DelegationResponse { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub delegation: ::core::option::Option, - #[prost(message, optional, tag="2")] - pub balance: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub balance: + ::core::option::Option, } /// RedelegationEntryResponse is equivalent to a RedelegationEntry except that it /// contains a balance in addition to shares which is more suitable for client @@ -372,9 +345,9 @@ pub struct DelegationResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct RedelegationEntryResponse { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub redelegation_entry: ::core::option::Option, - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub balance: ::prost::alloc::string::String, } /// RedelegationResponse is equivalent to a Redelegation except that its entries @@ -383,9 +356,9 @@ pub struct RedelegationEntryResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct RedelegationResponse { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub redelegation: ::core::option::Option, - #[prost(message, repeated, tag="2")] + #[prost(message, repeated, tag = "2")] pub entries: ::prost::alloc::vec::Vec, } /// Pool is used for tracking bonded and not-bonded token supply of the bond @@ -393,9 +366,9 @@ pub struct RedelegationResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Pool { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub not_bonded_tokens: ::prost::alloc::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub bonded_tokens: ::prost::alloc::string::String, } /// ValidatorUpdates defines an array of abci.ValidatorUpdate objects. @@ -403,11 +376,23 @@ pub struct Pool { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ValidatorUpdates { - #[prost(message, repeated, tag="1")] - pub updates: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "1")] + pub updates: ::prost::alloc::vec::Vec< + crate::proto::tendermint::abci::ValidatorUpdate, + >, } /// BondStatus is the status of a validator. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] #[repr(i32)] pub enum BondStatus { /// UNSPECIFIED defines an invalid validator status. @@ -444,7 +429,17 @@ impl BondStatus { } } /// Infraction indicates the infraction a validator commited. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] #[repr(i32)] pub enum Infraction { /// UNSPECIFIED defines an empty infraction. @@ -481,29 +476,29 @@ impl Infraction { #[derive(Clone, PartialEq, ::prost::Message)] pub struct GenesisState { /// params defines all the parameters of related to deposit. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub params: ::core::option::Option, /// last_total_power tracks the total amounts of bonded tokens recorded during /// the previous end block. - #[prost(bytes="bytes", tag="2")] + #[prost(bytes = "bytes", tag = "2")] pub last_total_power: ::prost::bytes::Bytes, /// last_validator_powers is a special index that provides a historical list /// of the last-block's bonded validators. - #[prost(message, repeated, tag="3")] + #[prost(message, repeated, tag = "3")] pub last_validator_powers: ::prost::alloc::vec::Vec, /// delegations defines the validator set at genesis. - #[prost(message, repeated, tag="4")] + #[prost(message, repeated, tag = "4")] pub validators: ::prost::alloc::vec::Vec, /// delegations defines the delegations active at genesis. - #[prost(message, repeated, tag="5")] + #[prost(message, repeated, tag = "5")] pub delegations: ::prost::alloc::vec::Vec, /// unbonding_delegations defines the unbonding delegations active at genesis. - #[prost(message, repeated, tag="6")] + #[prost(message, repeated, tag = "6")] pub unbonding_delegations: ::prost::alloc::vec::Vec, /// redelegations defines the redelegations active at genesis. - #[prost(message, repeated, tag="7")] + #[prost(message, repeated, tag = "7")] pub redelegations: ::prost::alloc::vec::Vec, - #[prost(bool, tag="8")] + #[prost(bool, tag = "8")] pub exported: bool, } /// LastValidatorPower required for validator set update logic. @@ -511,10 +506,10 @@ pub struct GenesisState { #[derive(Clone, PartialEq, ::prost::Message)] pub struct LastValidatorPower { /// address is the address of the validator. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub address: ::prost::alloc::string::String, /// power defines the power of the validator. - #[prost(int64, tag="2")] + #[prost(int64, tag = "2")] pub power: i64, } /// QueryValidatorsRequest is request type for Query/Validators RPC method. @@ -522,29 +517,33 @@ pub struct LastValidatorPower { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryValidatorsRequest { /// status enables to query for validators matching a given status. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub status: ::prost::alloc::string::String, /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag="2")] - pub pagination: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + crate::proto::cosmos::base::query::v1beta1::PageRequest, + >, } /// QueryValidatorsResponse is response type for the Query/Validators RPC method #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryValidatorsResponse { /// validators contains all the queried validators. - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub validators: ::prost::alloc::vec::Vec, /// pagination defines the pagination in the response. - #[prost(message, optional, tag="2")] - pub pagination: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + crate::proto::cosmos::base::query::v1beta1::PageResponse, + >, } /// QueryValidatorRequest is response type for the Query/Validator RPC method #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryValidatorRequest { /// validator_addr defines the validator address to query for. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub validator_addr: ::prost::alloc::string::String, } /// QueryValidatorResponse is response type for the Query/Validator RPC method @@ -552,7 +551,7 @@ pub struct QueryValidatorRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryValidatorResponse { /// validator defines the validator info. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub validator: ::core::option::Option, } /// QueryValidatorDelegationsRequest is request type for the @@ -561,22 +560,26 @@ pub struct QueryValidatorResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryValidatorDelegationsRequest { /// validator_addr defines the validator address to query for. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub validator_addr: ::prost::alloc::string::String, /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag="2")] - pub pagination: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + crate::proto::cosmos::base::query::v1beta1::PageRequest, + >, } /// QueryValidatorDelegationsResponse is response type for the /// Query/ValidatorDelegations RPC method #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryValidatorDelegationsResponse { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub delegation_responses: ::prost::alloc::vec::Vec, /// pagination defines the pagination in the response. - #[prost(message, optional, tag="2")] - pub pagination: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + crate::proto::cosmos::base::query::v1beta1::PageResponse, + >, } /// QueryValidatorUnbondingDelegationsRequest is required type for the /// Query/ValidatorUnbondingDelegations RPC method @@ -584,32 +587,36 @@ pub struct QueryValidatorDelegationsResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryValidatorUnbondingDelegationsRequest { /// validator_addr defines the validator address to query for. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub validator_addr: ::prost::alloc::string::String, /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag="2")] - pub pagination: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + crate::proto::cosmos::base::query::v1beta1::PageRequest, + >, } /// QueryValidatorUnbondingDelegationsResponse is response type for the /// Query/ValidatorUnbondingDelegations RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryValidatorUnbondingDelegationsResponse { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub unbonding_responses: ::prost::alloc::vec::Vec, /// pagination defines the pagination in the response. - #[prost(message, optional, tag="2")] - pub pagination: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + crate::proto::cosmos::base::query::v1beta1::PageResponse, + >, } /// QueryDelegationRequest is request type for the Query/Delegation RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDelegationRequest { /// delegator_addr defines the delegator address to query for. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub delegator_addr: ::prost::alloc::string::String, /// validator_addr defines the validator address to query for. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub validator_addr: ::prost::alloc::string::String, } /// QueryDelegationResponse is response type for the Query/Delegation RPC method. @@ -617,7 +624,7 @@ pub struct QueryDelegationRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDelegationResponse { /// delegation_responses defines the delegation info of a delegation. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub delegation_response: ::core::option::Option, } /// QueryUnbondingDelegationRequest is request type for the @@ -626,10 +633,10 @@ pub struct QueryDelegationResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryUnbondingDelegationRequest { /// delegator_addr defines the delegator address to query for. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub delegator_addr: ::prost::alloc::string::String, /// validator_addr defines the validator address to query for. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub validator_addr: ::prost::alloc::string::String, } /// QueryDelegationResponse is response type for the Query/UnbondingDelegation @@ -638,7 +645,7 @@ pub struct QueryUnbondingDelegationRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryUnbondingDelegationResponse { /// unbond defines the unbonding information of a delegation. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub unbond: ::core::option::Option, } /// QueryDelegatorDelegationsRequest is request type for the @@ -647,11 +654,13 @@ pub struct QueryUnbondingDelegationResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDelegatorDelegationsRequest { /// delegator_addr defines the delegator address to query for. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub delegator_addr: ::prost::alloc::string::String, /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag="2")] - pub pagination: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + crate::proto::cosmos::base::query::v1beta1::PageRequest, + >, } /// QueryDelegatorDelegationsResponse is response type for the /// Query/DelegatorDelegations RPC method. @@ -659,11 +668,13 @@ pub struct QueryDelegatorDelegationsRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDelegatorDelegationsResponse { /// delegation_responses defines all the delegations' info of a delegator. - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub delegation_responses: ::prost::alloc::vec::Vec, /// pagination defines the pagination in the response. - #[prost(message, optional, tag="2")] - pub pagination: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + crate::proto::cosmos::base::query::v1beta1::PageResponse, + >, } /// QueryDelegatorUnbondingDelegationsRequest is request type for the /// Query/DelegatorUnbondingDelegations RPC method. @@ -671,22 +682,26 @@ pub struct QueryDelegatorDelegationsResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDelegatorUnbondingDelegationsRequest { /// delegator_addr defines the delegator address to query for. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub delegator_addr: ::prost::alloc::string::String, /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag="2")] - pub pagination: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + crate::proto::cosmos::base::query::v1beta1::PageRequest, + >, } /// QueryUnbondingDelegatorDelegationsResponse is response type for the /// Query/UnbondingDelegatorDelegations RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDelegatorUnbondingDelegationsResponse { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub unbonding_responses: ::prost::alloc::vec::Vec, /// pagination defines the pagination in the response. - #[prost(message, optional, tag="2")] - pub pagination: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + crate::proto::cosmos::base::query::v1beta1::PageResponse, + >, } /// QueryRedelegationsRequest is request type for the Query/Redelegations RPC /// method. @@ -694,28 +709,32 @@ pub struct QueryDelegatorUnbondingDelegationsResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryRedelegationsRequest { /// delegator_addr defines the delegator address to query for. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub delegator_addr: ::prost::alloc::string::String, /// src_validator_addr defines the validator address to redelegate from. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub src_validator_addr: ::prost::alloc::string::String, /// dst_validator_addr defines the validator address to redelegate to. - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub dst_validator_addr: ::prost::alloc::string::String, /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag="4")] - pub pagination: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub pagination: ::core::option::Option< + crate::proto::cosmos::base::query::v1beta1::PageRequest, + >, } /// QueryRedelegationsResponse is response type for the Query/Redelegations RPC /// method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryRedelegationsResponse { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub redelegation_responses: ::prost::alloc::vec::Vec, /// pagination defines the pagination in the response. - #[prost(message, optional, tag="2")] - pub pagination: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + crate::proto::cosmos::base::query::v1beta1::PageResponse, + >, } /// QueryDelegatorValidatorsRequest is request type for the /// Query/DelegatorValidators RPC method. @@ -723,11 +742,13 @@ pub struct QueryRedelegationsResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDelegatorValidatorsRequest { /// delegator_addr defines the delegator address to query for. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub delegator_addr: ::prost::alloc::string::String, /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag="2")] - pub pagination: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + crate::proto::cosmos::base::query::v1beta1::PageRequest, + >, } /// QueryDelegatorValidatorsResponse is response type for the /// Query/DelegatorValidators RPC method. @@ -735,11 +756,13 @@ pub struct QueryDelegatorValidatorsRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDelegatorValidatorsResponse { /// validators defines the validators' info of a delegator. - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub validators: ::prost::alloc::vec::Vec, /// pagination defines the pagination in the response. - #[prost(message, optional, tag="2")] - pub pagination: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + crate::proto::cosmos::base::query::v1beta1::PageResponse, + >, } /// QueryDelegatorValidatorRequest is request type for the /// Query/DelegatorValidator RPC method. @@ -747,10 +770,10 @@ pub struct QueryDelegatorValidatorsResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDelegatorValidatorRequest { /// delegator_addr defines the delegator address to query for. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub delegator_addr: ::prost::alloc::string::String, /// validator_addr defines the validator address to query for. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub validator_addr: ::prost::alloc::string::String, } /// QueryDelegatorValidatorResponse response type for the @@ -759,7 +782,7 @@ pub struct QueryDelegatorValidatorRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDelegatorValidatorResponse { /// validator defines the validator info. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub validator: ::core::option::Option, } /// QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC @@ -768,7 +791,7 @@ pub struct QueryDelegatorValidatorResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryHistoricalInfoRequest { /// height defines at which height to query the historical info. - #[prost(int64, tag="1")] + #[prost(int64, tag = "1")] pub height: i64, } /// QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC @@ -777,117 +800,114 @@ pub struct QueryHistoricalInfoRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryHistoricalInfoResponse { /// hist defines the historical info at the given height. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub hist: ::core::option::Option, } /// QueryPoolRequest is request type for the Query/Pool RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryPoolRequest { -} +pub struct QueryPoolRequest {} /// QueryPoolResponse is response type for the Query/Pool RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPoolResponse { /// pool defines the pool info. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub pool: ::core::option::Option, } /// QueryParamsRequest is request type for the Query/Params RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryParamsRequest { -} +pub struct QueryParamsRequest {} /// QueryParamsResponse is response type for the Query/Params RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryParamsResponse { /// params holds all the parameters of this module. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub params: ::core::option::Option, } /// MsgCreateValidator defines a SDK message for creating a new validator. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgCreateValidator { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub description: ::core::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub commission: ::core::option::Option, - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub min_self_delegation: ::prost::alloc::string::String, - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub delegator_address: ::prost::alloc::string::String, - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub validator_address: ::prost::alloc::string::String, - #[prost(message, optional, tag="6")] + #[prost(message, optional, tag = "6")] pub pubkey: ::core::option::Option<::prost_types::Any>, - #[prost(message, optional, tag="7")] + #[prost(message, optional, tag = "7")] pub value: ::core::option::Option, } /// MsgCreateValidatorResponse defines the Msg/CreateValidator response type. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgCreateValidatorResponse { -} +pub struct MsgCreateValidatorResponse {} /// MsgEditValidator defines a SDK message for editing an existing validator. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgEditValidator { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub description: ::core::option::Option, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub validator_address: ::prost::alloc::string::String, /// We pass a reference to the new commission rate and min self delegation as /// it's not mandatory to update. If not updated, the deserialized rate will be /// zero with no way to distinguish if an update was intended. /// REF: #2373 - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub commission_rate: ::prost::alloc::string::String, - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub min_self_delegation: ::prost::alloc::string::String, } /// MsgEditValidatorResponse defines the Msg/EditValidator response type. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgEditValidatorResponse { -} +pub struct MsgEditValidatorResponse {} /// MsgDelegate defines a SDK message for performing a delegation of coins /// from a delegator to a validator. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgDelegate { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub delegator_address: ::prost::alloc::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub validator_address: ::prost::alloc::string::String, - #[prost(message, optional, tag="3")] - pub amount: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub amount: + ::core::option::Option, } /// MsgDelegateResponse defines the Msg/Delegate response type. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgDelegateResponse { -} +pub struct MsgDelegateResponse {} /// MsgBeginRedelegate defines a SDK message for performing a redelegation /// of coins from a delegator and source validator to a destination validator. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgBeginRedelegate { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub delegator_address: ::prost::alloc::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub validator_src_address: ::prost::alloc::string::String, - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub validator_dst_address: ::prost::alloc::string::String, - #[prost(message, optional, tag="4")] - pub amount: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub amount: + ::core::option::Option, } /// MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgBeginRedelegateResponse { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub completion_time: ::core::option::Option<::prost_types::Timestamp>, } /// MsgUndelegate defines a SDK message for performing an undelegation from a @@ -895,18 +915,19 @@ pub struct MsgBeginRedelegateResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgUndelegate { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub delegator_address: ::prost::alloc::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub validator_address: ::prost::alloc::string::String, - #[prost(message, optional, tag="3")] - pub amount: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub amount: + ::core::option::Option, } /// MsgUndelegateResponse defines the Msg/Undelegate response type. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgUndelegateResponse { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub completion_time: ::core::option::Option<::prost_types::Timestamp>, } /// MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator @@ -915,15 +936,16 @@ pub struct MsgUndelegateResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgCancelUnbondingDelegation { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub delegator_address: ::prost::alloc::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub validator_address: ::prost::alloc::string::String, /// amount is always less than or equal to unbonding delegation entry balance - #[prost(message, optional, tag="3")] - pub amount: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub amount: + ::core::option::Option, /// creation_height is the height which the unbonding took place. - #[prost(int64, tag="4")] + #[prost(int64, tag = "4")] pub creation_height: i64, } /// MsgCancelUnbondingDelegationResponse @@ -931,8 +953,7 @@ pub struct MsgCancelUnbondingDelegation { /// Since: cosmos-sdk 0.46 #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgCancelUnbondingDelegationResponse { -} +pub struct MsgCancelUnbondingDelegationResponse {} /// MsgUpdateParams is the Msg/UpdateParams request type. /// /// Since: cosmos-sdk 0.47 @@ -940,12 +961,12 @@ pub struct MsgCancelUnbondingDelegationResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgUpdateParams { /// authority is the address that controls the module (defaults to x/gov unless overwritten). - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub authority: ::prost::alloc::string::String, /// params defines the x/staking parameters to update. /// /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub params: ::core::option::Option, } /// MsgUpdateParamsResponse defines the response structure for executing a @@ -954,6 +975,5 @@ pub struct MsgUpdateParams { /// Since: cosmos-sdk 0.47 #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgUpdateParamsResponse { -} +pub struct MsgUpdateParamsResponse {} // @@protoc_insertion_point(module) diff --git a/nibiru-std/src/proto/buf/nibiru.epochs.v1.rs b/nibiru-std/src/proto/buf/nibiru.epochs.v1.rs index 397600c..c1745a2 100644 --- a/nibiru-std/src/proto/buf/nibiru.epochs.v1.rs +++ b/nibiru-std/src/proto/buf/nibiru.epochs.v1.rs @@ -51,11 +51,11 @@ pub struct GenesisState { } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryEpochsInfoRequest { +pub struct QueryEpochInfosRequest { } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryEpochsInfoResponse { +pub struct QueryEpochInfosResponse { #[prost(message, repeated, tag="1")] pub epochs: ::prost::alloc::vec::Vec, } diff --git a/nibiru-std/src/proto/buf/nibiru.inflation.v1.rs b/nibiru-std/src/proto/buf/nibiru.inflation.v1.rs index f9fcacf..9235495 100644 --- a/nibiru-std/src/proto/buf/nibiru.inflation.v1.rs +++ b/nibiru-std/src/proto/buf/nibiru.inflation.v1.rs @@ -7,47 +7,30 @@ pub struct InflationDistribution { /// staking_rewards defines the proportion of the minted_denom that is /// to be allocated as staking rewards - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub staking_rewards: ::prost::alloc::string::String, /// community_pool defines the proportion of the minted_denom that is to /// be allocated to the community pool - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub community_pool: ::prost::alloc::string::String, /// strategic_reserves defines the proportion of the minted_denom that /// is to be allocated to the strategic reserves module address - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub strategic_reserves: ::prost::alloc::string::String, } -/// ExponentialCalculation holds factors to calculate exponential inflation on -/// each period. Calculation reference: -/// periodProvision = exponentialDecay -/// f(x) = a * (1 - r) ^ x + c -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ExponentialCalculation { - /// a defines the initial value - #[prost(string, tag = "1")] - pub a: ::prost::alloc::string::String, - /// r defines the reduction factor - #[prost(string, tag = "2")] - pub r: ::prost::alloc::string::String, - /// c defines the parameter for long term inflation - #[prost(string, tag = "3")] - pub c: ::prost::alloc::string::String, -} /// GenesisState defines the inflation module's genesis state. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GenesisState { /// params defines all the parameters of the module. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub params: ::core::option::Option, /// period is the amount of past periods, based on the epochs per period param - #[prost(uint64, tag = "2")] + #[prost(uint64, tag="2")] pub period: u64, /// skipped_epochs is the number of epochs that have passed while inflation is /// disabled - #[prost(uint64, tag = "3")] + #[prost(uint64, tag="3")] pub skipped_epochs: u64, } /// Params holds parameters for the inflation module. @@ -56,52 +39,61 @@ pub struct GenesisState { pub struct Params { /// inflation_enabled is the parameter that enables inflation and halts /// increasing the skipped_epochs - #[prost(bool, tag = "1")] + #[prost(bool, tag="1")] pub inflation_enabled: bool, - /// exponential_calculation takes in the variables to calculate exponential + /// polynomial_factors takes in the variables to calculate polynomial /// inflation - #[prost(message, optional, tag = "2")] - pub exponential_calculation: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub polynomial_factors: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, /// inflation_distribution of the minted denom - #[prost(message, optional, tag = "3")] + #[prost(message, optional, tag="3")] pub inflation_distribution: ::core::option::Option, /// epochs_per_period is the number of epochs that must pass before a new /// period is created - #[prost(uint64, tag = "4")] + #[prost(uint64, tag="4")] pub epochs_per_period: u64, + /// periods_per_year is the number of periods that occur in a year + #[prost(uint64, tag="5")] + pub periods_per_year: u64, + /// max_period is the maximum number of periods that have inflation being + /// paid off. After this period, inflation will be disabled. + #[prost(uint64, tag="6")] + pub max_period: u64, } /// QueryPeriodRequest is the request type for the Query/Period RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryPeriodRequest {} +pub struct QueryPeriodRequest { +} /// QueryPeriodResponse is the response type for the Query/Period RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPeriodResponse { /// period is the current minting per epoch provision value. - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub period: u64, } /// QueryEpochMintProvisionRequest is the request type for the /// Query/EpochMintProvision RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryEpochMintProvisionRequest {} +pub struct QueryEpochMintProvisionRequest { +} /// QueryEpochMintProvisionResponse is the response type for the /// Query/EpochMintProvision RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryEpochMintProvisionResponse { /// epoch_mint_provision is the current minting per epoch provision value. - #[prost(message, optional, tag = "1")] - pub epoch_mint_provision: - ::core::option::Option, + #[prost(message, optional, tag="1")] + pub epoch_mint_provision: ::core::option::Option, } /// QuerySkippedEpochsRequest is the request type for the Query/SkippedEpochs RPC /// method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QuerySkippedEpochsRequest {} +pub struct QuerySkippedEpochsRequest { +} /// QuerySkippedEpochsResponse is the response type for the Query/SkippedEpochs /// RPC method. #[allow(clippy::derive_partial_eq_without_eq)] @@ -109,48 +101,50 @@ pub struct QuerySkippedEpochsRequest {} pub struct QuerySkippedEpochsResponse { /// skipped_epochs is the number of epochs that the inflation module has been /// disabled. - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub skipped_epochs: u64, } /// QueryCirculatingSupplyRequest is the request type for the /// Query/CirculatingSupply RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryCirculatingSupplyRequest {} +pub struct QueryCirculatingSupplyRequest { +} /// QueryCirculatingSupplyResponse is the response type for the /// Query/CirculatingSupply RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryCirculatingSupplyResponse { /// circulating_supply is the total amount of coins in circulation - #[prost(message, optional, tag = "1")] - pub circulating_supply: - ::core::option::Option, + #[prost(message, optional, tag="1")] + pub circulating_supply: ::core::option::Option, } /// QueryInflationRateRequest is the request type for the Query/InflationRate RPC /// method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryInflationRateRequest {} +pub struct QueryInflationRateRequest { +} /// QueryInflationRateResponse is the response type for the Query/InflationRate /// RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryInflationRateResponse { /// inflation_rate by which the total supply increases within one period - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub inflation_rate: ::prost::alloc::string::String, } /// QueryParamsRequest is the request type for the Query/Params RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryParamsRequest {} +pub struct QueryParamsRequest { +} /// QueryParamsResponse is the response type for the Query/Params RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryParamsResponse { /// params defines the parameters of the module. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub params: ::core::option::Option, } -// @@protoc_insertion_point(module) \ No newline at end of file +// @@protoc_insertion_point(module) diff --git a/nibiru-std/src/proto/buf/nibiru.oracle.v1.rs b/nibiru-std/src/proto/buf/nibiru.oracle.v1.rs index c119492..a0ed36e 100644 --- a/nibiru-std/src/proto/buf/nibiru.oracle.v1.rs +++ b/nibiru-std/src/proto/buf/nibiru.oracle.v1.rs @@ -4,50 +4,50 @@ #[derive(Clone, PartialEq, ::prost::Message)] pub struct Params { /// VotePeriod defines the number of blocks during which voting takes place. - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub vote_period: u64, /// VoteThreshold specifies the minimum proportion of votes that must be /// received for a ballot to pass. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub vote_threshold: ::prost::alloc::string::String, /// RewardBand defines a maxium divergence that a price vote can have from the /// weighted median in the ballot. If a vote lies within the valid range /// defined by: - /// μ := weightedMedian, - /// validRange := μ ± (μ * rewardBand / 2), + /// μ := weightedMedian, + /// validRange := μ ± (μ * rewardBand / 2), /// then rewards are added to the validator performance. /// Note that if the reward band is smaller than 1 standard /// deviation, the band is taken to be 1 standard deviation.a price - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub reward_band: ::prost::alloc::string::String, /// The set of whitelisted markets, or asset pairs, for the module. /// Ex. '\["unibi:uusd","ubtc:uusd"\]' - #[prost(string, repeated, tag = "4")] + #[prost(string, repeated, tag="4")] pub whitelist: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, /// SlashFraction returns the proportion of an oracle's stake that gets /// slashed in the event of slashing. `SlashFraction` specifies the exact /// penalty for failing a voting period. - #[prost(string, tag = "5")] + #[prost(string, tag="5")] pub slash_fraction: ::prost::alloc::string::String, /// SlashWindow returns the number of voting periods that specify a /// "slash window". After each slash window, all oracles that have missed more /// than the penalty threshold are slashed. Missing the penalty threshold is /// synonymous with submitting fewer valid votes than `MinValidPerWindow`. - #[prost(uint64, tag = "6")] + #[prost(uint64, tag="6")] pub slash_window: u64, - #[prost(string, tag = "7")] + #[prost(string, tag="7")] pub min_valid_per_window: ::prost::alloc::string::String, /// Amount of time to look back for TWAP calculations - #[prost(message, optional, tag = "8")] + #[prost(message, optional, tag="8")] pub twap_lookback_window: ::core::option::Option<::prost_types::Duration>, /// The minimum number of voters (i.e. oracle validators) per pair for it to be /// considered a passing ballot. Recommended at least 4. - #[prost(uint64, tag = "9")] + #[prost(uint64, tag="9")] pub min_voters: u64, /// The validator fee ratio that is given to validators every epoch. - #[prost(string, tag = "10")] + #[prost(string, tag="10")] pub validator_fee_ratio: ::prost::alloc::string::String, - #[prost(uint64, tag = "11")] + #[prost(uint64, tag="11")] pub expiration_blocks: u64, } /// Struct for aggregate prevoting on the ExchangeRateVote. @@ -57,11 +57,11 @@ pub struct Params { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AggregateExchangeRatePrevote { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub hash: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub voter: ::prost::alloc::string::String, - #[prost(uint64, tag = "3")] + #[prost(uint64, tag="3")] pub submit_block: u64, } /// MsgAggregateExchangeRateVote - struct for voting on @@ -69,26 +69,26 @@ pub struct AggregateExchangeRatePrevote { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AggregateExchangeRateVote { - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub exchange_rate_tuples: ::prost::alloc::vec::Vec, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub voter: ::prost::alloc::string::String, } /// ExchangeRateTuple - struct to store interpreted exchange rates data to store #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ExchangeRateTuple { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub pair: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub exchange_rate: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DatedPrice { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub exchange_rate: ::prost::alloc::string::String, - #[prost(uint64, tag = "2")] + #[prost(uint64, tag="2")] pub created_block: u64, } /// Rewards defines a credit object towards validators @@ -97,26 +97,25 @@ pub struct DatedPrice { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Rewards { /// id uniquely identifies the rewards instance of the pair - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub id: u64, /// vote_periods defines the vote periods left in which rewards will be /// distributed. - #[prost(uint64, tag = "2")] + #[prost(uint64, tag="2")] pub vote_periods: u64, /// Coins defines the amount of coins to distribute in a single vote period. - #[prost(message, repeated, tag = "3")] - pub coins: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="3")] + pub coins: ::prost::alloc::vec::Vec, } /// Emitted when a price is posted #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventPriceUpdate { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub pair: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub price: ::prost::alloc::string::String, - #[prost(int64, tag = "3")] + #[prost(int64, tag="3")] pub timestamp_ms: i64, } /// Emitted when a valoper delegates oracle voting rights to a feeder address. @@ -124,11 +123,11 @@ pub struct EventPriceUpdate { #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventDelegateFeederConsent { /// Validator is the Bech32 address that is delegating voting rights. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub validator: ::prost::alloc::string::String, /// Feeder is the delegate or representative that will be able to send /// vote and prevote transaction messages. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub feeder: ::prost::alloc::string::String, } /// Emitted by MsgAggregateExchangeVote when an aggregate vote is added to state @@ -136,13 +135,13 @@ pub struct EventDelegateFeederConsent { #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventAggregateVote { /// Validator is the Bech32 address to which the vote will be credited. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub validator: ::prost::alloc::string::String, /// Feeder is the delegate or representative that will send vote and prevote /// transaction messages on behalf of the voting validator. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub feeder: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "3")] + #[prost(message, repeated, tag="3")] pub prices: ::prost::alloc::vec::Vec, } /// Emitted by MsgAggregateExchangePrevote when an aggregate prevote is added @@ -151,34 +150,32 @@ pub struct EventAggregateVote { #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventAggregatePrevote { /// Validator is the Bech32 address to which the vote will be credited. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub validator: ::prost::alloc::string::String, /// Feeder is the delegate or representative that will send vote and prevote /// transaction messages on behalf of the voting validator. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub feeder: ::prost::alloc::string::String, } /// GenesisState defines the oracle module's genesis state. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GenesisState { - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub params: ::core::option::Option, - #[prost(message, repeated, tag = "2")] + #[prost(message, repeated, tag="2")] pub feeder_delegations: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "3")] + #[prost(message, repeated, tag="3")] pub exchange_rates: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "4")] + #[prost(message, repeated, tag="4")] pub miss_counters: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "5")] - pub aggregate_exchange_rate_prevotes: - ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "6")] - pub aggregate_exchange_rate_votes: - ::prost::alloc::vec::Vec, - #[prost(string, repeated, tag = "7")] + #[prost(message, repeated, tag="5")] + pub aggregate_exchange_rate_prevotes: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="6")] + pub aggregate_exchange_rate_votes: ::prost::alloc::vec::Vec, + #[prost(string, repeated, tag="7")] pub pairs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - #[prost(message, repeated, tag = "8")] + #[prost(message, repeated, tag="8")] pub rewards: ::prost::alloc::vec::Vec, } /// FeederDelegation is the address for where oracle feeder authority are @@ -187,9 +184,9 @@ pub struct GenesisState { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct FeederDelegation { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub feeder_address: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub validator_address: ::prost::alloc::string::String, } /// MissCounter defines an miss counter and validator address pair used in @@ -197,9 +194,9 @@ pub struct FeederDelegation { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MissCounter { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub validator_address: ::prost::alloc::string::String, - #[prost(uint64, tag = "2")] + #[prost(uint64, tag="2")] pub miss_counter: u64, } /// QueryExchangeRateRequest is the request type for the Query/ExchangeRate RPC @@ -208,7 +205,7 @@ pub struct MissCounter { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryExchangeRateRequest { /// pair defines the pair to query for. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub pair: ::prost::alloc::string::String, } /// QueryExchangeRateResponse is response type for the @@ -217,14 +214,15 @@ pub struct QueryExchangeRateRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryExchangeRateResponse { /// exchange_rate defines the exchange rate of assets voted by validators - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub exchange_rate: ::prost::alloc::string::String, } /// QueryExchangeRatesRequest is the request type for the Query/ExchangeRates RPC /// method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryExchangeRatesRequest {} +pub struct QueryExchangeRatesRequest { +} /// QueryExchangeRatesResponse is response type for the /// Query/ExchangeRates RPC method. #[allow(clippy::derive_partial_eq_without_eq)] @@ -232,27 +230,29 @@ pub struct QueryExchangeRatesRequest {} pub struct QueryExchangeRatesResponse { /// exchange_rates defines a list of the exchange rate for all whitelisted /// pairs. - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub exchange_rates: ::prost::alloc::vec::Vec, } /// QueryActivesRequest is the request type for the Query/Actives RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryActivesRequest {} +pub struct QueryActivesRequest { +} /// QueryActivesResponse is response type for the /// Query/Actives RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryActivesResponse { /// actives defines a list of the pair which oracle prices agreed upon. - #[prost(string, repeated, tag = "1")] + #[prost(string, repeated, tag="1")] pub actives: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// QueryVoteTargetsRequest is the request type for the Query/VoteTargets RPC /// method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryVoteTargetsRequest {} +pub struct QueryVoteTargetsRequest { +} /// QueryVoteTargetsResponse is response type for the /// Query/VoteTargets RPC method. #[allow(clippy::derive_partial_eq_without_eq)] @@ -260,7 +260,7 @@ pub struct QueryVoteTargetsRequest {} pub struct QueryVoteTargetsResponse { /// vote_targets defines a list of the pairs in which everyone /// should vote in the current vote period. - #[prost(string, repeated, tag = "1")] + #[prost(string, repeated, tag="1")] pub vote_targets: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// QueryFeederDelegationRequest is the request type for the @@ -269,7 +269,7 @@ pub struct QueryVoteTargetsResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryFeederDelegationRequest { /// validator defines the validator address to query for. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub validator_addr: ::prost::alloc::string::String, } /// QueryFeederDelegationResponse is response type for the @@ -278,7 +278,7 @@ pub struct QueryFeederDelegationRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryFeederDelegationResponse { /// feeder_addr defines the feeder delegation of a validator - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub feeder_addr: ::prost::alloc::string::String, } /// QueryMissCounterRequest is the request type for the Query/MissCounter RPC @@ -287,7 +287,7 @@ pub struct QueryFeederDelegationResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryMissCounterRequest { /// validator defines the validator address to query for. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub validator_addr: ::prost::alloc::string::String, } /// QueryMissCounterResponse is response type for the @@ -296,7 +296,7 @@ pub struct QueryMissCounterRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryMissCounterResponse { /// miss_counter defines the oracle miss counter of a validator - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub miss_counter: u64, } /// QueryAggregatePrevoteRequest is the request type for the @@ -305,7 +305,7 @@ pub struct QueryMissCounterResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryAggregatePrevoteRequest { /// validator defines the validator address to query for. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub validator_addr: ::prost::alloc::string::String, } /// QueryAggregatePrevoteResponse is response type for the @@ -315,14 +315,15 @@ pub struct QueryAggregatePrevoteRequest { pub struct QueryAggregatePrevoteResponse { /// aggregate_prevote defines oracle aggregate prevote submitted by a validator /// in the current vote period - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub aggregate_prevote: ::core::option::Option, } /// QueryAggregatePrevotesRequest is the request type for the /// Query/AggregatePrevotes RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryAggregatePrevotesRequest {} +pub struct QueryAggregatePrevotesRequest { +} /// QueryAggregatePrevotesResponse is response type for the /// Query/AggregatePrevotes RPC method. #[allow(clippy::derive_partial_eq_without_eq)] @@ -330,9 +331,8 @@ pub struct QueryAggregatePrevotesRequest {} pub struct QueryAggregatePrevotesResponse { /// aggregate_prevotes defines all oracle aggregate prevotes submitted in the /// current vote period - #[prost(message, repeated, tag = "1")] - pub aggregate_prevotes: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="1")] + pub aggregate_prevotes: ::prost::alloc::vec::Vec, } /// QueryAggregateVoteRequest is the request type for the Query/AggregateVote RPC /// method. @@ -340,7 +340,7 @@ pub struct QueryAggregatePrevotesResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryAggregateVoteRequest { /// validator defines the validator address to query for. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub validator_addr: ::prost::alloc::string::String, } /// QueryAggregateVoteResponse is response type for the @@ -350,14 +350,15 @@ pub struct QueryAggregateVoteRequest { pub struct QueryAggregateVoteResponse { /// aggregate_vote defines oracle aggregate vote submitted by a validator in /// the current vote period - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub aggregate_vote: ::core::option::Option, } /// QueryAggregateVotesRequest is the request type for the Query/AggregateVotes /// RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryAggregateVotesRequest {} +pub struct QueryAggregateVotesRequest { +} /// QueryAggregateVotesResponse is response type for the /// Query/AggregateVotes RPC method. #[allow(clippy::derive_partial_eq_without_eq)] @@ -365,31 +366,32 @@ pub struct QueryAggregateVotesRequest {} pub struct QueryAggregateVotesResponse { /// aggregate_votes defines all oracle aggregate votes submitted in the current /// vote period - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub aggregate_votes: ::prost::alloc::vec::Vec, } /// QueryParamsRequest is the request type for the Query/Params RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryParamsRequest {} +pub struct QueryParamsRequest { +} /// QueryParamsResponse is the response type for the Query/Params RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryParamsResponse { /// params defines the parameters of the module. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub params: ::core::option::Option, } /// a snapshot of the prices at a given point in time #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PriceSnapshot { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub pair: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub price: ::prost::alloc::string::String, /// milliseconds since unix epoch - #[prost(int64, tag = "3")] + #[prost(int64, tag="3")] pub timestamp_ms: i64, } /// MsgAggregateExchangeRatePrevote represents a message to submit @@ -397,58 +399,61 @@ pub struct PriceSnapshot { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgAggregateExchangeRatePrevote { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub hash: ::prost::alloc::string::String, /// Feeder is the Bech32 address of the price feeder. A validator may /// specify multiple price feeders by delegating them consent. The validator /// address is also a valid feeder by default. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub feeder: ::prost::alloc::string::String, /// Validator is the Bech32 address to which the prevote will be credited. - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub validator: ::prost::alloc::string::String, } /// MsgAggregateExchangeRatePrevoteResponse defines the /// Msg/AggregateExchangeRatePrevote response type. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgAggregateExchangeRatePrevoteResponse {} +pub struct MsgAggregateExchangeRatePrevoteResponse { +} /// MsgAggregateExchangeRateVote represents a message to submit /// aggregate exchange rate vote. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgAggregateExchangeRateVote { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub salt: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub exchange_rates: ::prost::alloc::string::String, /// Feeder is the Bech32 address of the price feeder. A validator may /// specify multiple price feeders by delegating them consent. The validator /// address is also a valid feeder by default. - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub feeder: ::prost::alloc::string::String, /// Validator is the Bech32 address to which the vote will be credited. - #[prost(string, tag = "4")] + #[prost(string, tag="4")] pub validator: ::prost::alloc::string::String, } /// MsgAggregateExchangeRateVoteResponse defines the /// Msg/AggregateExchangeRateVote response type. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgAggregateExchangeRateVoteResponse {} +pub struct MsgAggregateExchangeRateVoteResponse { +} /// MsgDelegateFeedConsent represents a message to delegate oracle voting rights /// to another address. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgDelegateFeedConsent { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub operator: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub delegate: ::prost::alloc::string::String, } /// MsgDelegateFeedConsentResponse defines the Msg/DelegateFeedConsent response /// type. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgDelegateFeedConsentResponse {} +pub struct MsgDelegateFeedConsentResponse { +} // @@protoc_insertion_point(module) diff --git a/nibiru-std/src/proto/buf/nibiru.perp.v2.rs b/nibiru-std/src/proto/buf/nibiru.perp.v2.rs index e611868..67a15ee 100644 --- a/nibiru-std/src/proto/buf/nibiru.perp.v2.rs +++ b/nibiru-std/src/proto/buf/nibiru.perp.v2.rs @@ -4,57 +4,56 @@ pub struct Market { /// the trading pair represented by this market /// always BASE:QUOTE, e.g. BTC:NUSD or ETH:NUSD - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub pair: ::prost::alloc::string::String, /// whether or not the market is enabled - #[prost(bool, tag = "2")] + #[prost(bool, tag="2")] pub enabled: bool, /// the version of the Market, only one market can exist per pair, when one is closed it cannot be reactivated, /// so a new market must be created, this is the version of the market - #[prost(uint64, tag = "14")] + #[prost(uint64, tag="14")] pub version: u64, /// the minimum margin ratio which a user must maintain on this market - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub maintenance_margin_ratio: ::prost::alloc::string::String, /// the maximum leverage a user is able to be taken on this market - #[prost(string, tag = "4")] + #[prost(string, tag="4")] pub max_leverage: ::prost::alloc::string::String, /// Latest cumulative premium fraction for a given pair. /// Calculated once per funding rate interval. /// A premium fraction is the difference between mark and index, divided by the /// number of payments per day. (mark - index) / # payments in a day - #[prost(string, tag = "5")] + #[prost(string, tag="5")] pub latest_cumulative_premium_fraction: ::prost::alloc::string::String, /// the percentage of the notional given to the exchange when trading - #[prost(string, tag = "6")] + #[prost(string, tag="6")] pub exchange_fee_ratio: ::prost::alloc::string::String, /// the percentage of the notional transferred to the ecosystem fund when /// trading - #[prost(string, tag = "7")] + #[prost(string, tag="7")] pub ecosystem_fund_fee_ratio: ::prost::alloc::string::String, /// the percentage of liquidated position that will be /// given to out as a reward. Half of the liquidation fee is given to the /// liquidator, and the other half is given to the ecosystem fund. - #[prost(string, tag = "8")] + #[prost(string, tag="8")] pub liquidation_fee_ratio: ::prost::alloc::string::String, /// the portion of the position size we try to liquidate if the available /// margin is higher than liquidation fee - #[prost(string, tag = "9")] + #[prost(string, tag="9")] pub partial_liquidation_ratio: ::prost::alloc::string::String, /// specifies the interval on which the funding rate is updated - #[prost(string, tag = "10")] + #[prost(string, tag="10")] pub funding_rate_epoch_id: ::prost::alloc::string::String, /// amount of time to look back for TWAP calculations - #[prost(message, optional, tag = "11")] + #[prost(message, optional, tag="11")] pub twap_lookback_window: ::core::option::Option<::prost_types::Duration>, /// the amount of collateral already credited from the ecosystem fund - #[prost(message, optional, tag = "12")] - pub prepaid_bad_debt: - ::core::option::Option, + #[prost(message, optional, tag="12")] + pub prepaid_bad_debt: ::core::option::Option, /// the maximum funding rate payment per epoch, this represents the maximum /// amount of funding that can be paid out per epoch as a percentage of the /// position size - #[prost(string, tag = "13")] + #[prost(string, tag="13")] pub max_funding_rate: ::prost::alloc::string::String, } /// MarketLastVersion is used to store the last version of the market @@ -62,88 +61,92 @@ pub struct Market { #[derive(Clone, PartialEq, ::prost::Message)] pub struct MarketLastVersion { /// version of the market - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub version: u64, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Amm { /// identifies the market this AMM belongs to - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub pair: ::prost::alloc::string::String, /// the version of the AMM, only one AMM can exist per pair, when one is closed it cannot be reactivated, /// so a new AMM must be created, this is the version of the AMM - #[prost(uint64, tag = "8")] + #[prost(uint64, tag="8")] pub version: u64, /// the amount of base reserves this AMM has - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub base_reserve: ::prost::alloc::string::String, /// the amount of quote reserves this AMM has - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub quote_reserve: ::prost::alloc::string::String, /// sqrt(k) - #[prost(string, tag = "4")] + #[prost(string, tag="4")] pub sqrt_depth: ::prost::alloc::string::String, /// the price multiplier of the dynamic AMM - #[prost(string, tag = "5")] + #[prost(string, tag="5")] pub price_multiplier: ::prost::alloc::string::String, /// Total long refers to the sum of long open notional in base. - #[prost(string, tag = "6")] + #[prost(string, tag="6")] pub total_long: ::prost::alloc::string::String, /// Total short refers to the sum of short open notional in base. - #[prost(string, tag = "7")] + #[prost(string, tag="7")] pub total_short: ::prost::alloc::string::String, + /// The settlement price if the AMM is settled. + #[prost(string, tag="9")] + pub settlement_price: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Position { /// address identifies the address owner of this position - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub trader_address: ::prost::alloc::string::String, /// pair identifies the pair associated with this position - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub pair: ::prost::alloc::string::String, /// the position size - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub size: ::prost::alloc::string::String, /// amount of margin remaining in the position - #[prost(string, tag = "4")] + #[prost(string, tag="4")] pub margin: ::prost::alloc::string::String, /// value of position in quote assets when opened - #[prost(string, tag = "5")] + #[prost(string, tag="5")] pub open_notional: ::prost::alloc::string::String, /// The most recent cumulative premium fraction this position has. /// Used to calculate the next funding payment. - #[prost(string, tag = "6")] + #[prost(string, tag="6")] pub latest_cumulative_premium_fraction: ::prost::alloc::string::String, /// last block number this position was updated - #[prost(int64, tag = "7")] + #[prost(int64, tag="7")] pub last_updated_block_number: i64, } /// a snapshot of the perp.amm's reserves at a given point in time #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReserveSnapshot { - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub amm: ::core::option::Option, /// milliseconds since unix epoch - #[prost(int64, tag = "2")] + #[prost(int64, tag="2")] pub timestamp_ms: i64, } +/// DNRAllocation represents a rebates allocation for a given epoch. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DnrAllocation { + /// epoch defines the reference epoch for the allocation. + #[prost(uint64, tag="1")] + pub epoch: u64, + /// amount of DNR allocated for the epoch. + #[prost(message, repeated, tag="2")] + pub amount: ::prost::alloc::vec::Vec, +} /// The direction that the user is trading in /// LONG means the user is going long the base asset (e.g. buy BTC) /// SHORT means the user is shorting the base asset (e.g. sell BTC) -#[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration, -)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum Direction { Unspecified = 0, @@ -173,17 +176,7 @@ impl Direction { } } /// Enumerates different options of calculating twap. -#[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration, -)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum TwapCalcOption { Unspecified = 0, @@ -222,38 +215,36 @@ impl TwapCalcOption { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PositionChangedEvent { - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub final_position: ::core::option::Option, /// Position notional (in quote units) after the change. In general, /// 'notional = baseAmount * priceQuotePerBase', where size is the baseAmount. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub position_notional: ::prost::alloc::string::String, /// Transaction fee paid. A "taker" fee. - #[prost(message, optional, tag = "3")] - pub transaction_fee: - ::core::option::Option, + #[prost(message, optional, tag="3")] + pub transaction_fee: ::core::option::Option, /// realize profits and losses after the change - #[prost(string, tag = "4")] + #[prost(string, tag="4")] pub realized_pnl: ::prost::alloc::string::String, /// Amount of bad debt cleared by the PerpEF during the change. /// Bad debt is negative net margin past the liquidation point of a position. - #[prost(message, optional, tag = "5")] - pub bad_debt: - ::core::option::Option, + #[prost(message, optional, tag="5")] + pub bad_debt: ::core::option::Option, /// A funding payment made or received by the trader on the current position. /// 'fundingPayment' is positive if 'owner' is the sender and negative if 'owner' /// is the receiver of the payment. Its magnitude is abs(size * fundingRate). /// Funding payments act to converge the mark price and index price /// (average price on major exchanges). - #[prost(string, tag = "6")] + #[prost(string, tag="6")] pub funding_payment: ::prost::alloc::string::String, /// The block number at which this position was changed. - #[prost(int64, tag = "7")] + #[prost(int64, tag="7")] pub block_height: i64, /// margin_to_user is the amount of collateral received by the trader during /// the position change. A positve value indicates that the trader received /// funds, while a negative value indicates that the trader spent funds. - #[prost(string, tag = "8")] + #[prost(string, tag="8")] pub margin_to_user: ::prost::alloc::string::String, /// change_reason describes the reason for why the position resulted in a /// change. Change type can take the following values: @@ -263,19 +254,19 @@ pub struct PositionChangedEvent { /// - CHANGE_REASON_REMOVE_MARGIN: Margin was removed from the position. /// - CHANGE_REASON_OPEN_POSITION: A new position was opened. /// - CHANGE_REASON_CLOSE_POSITION: An existing position was closed. - #[prost(string, tag = "9")] + #[prost(string, tag="9")] pub change_reason: ::prost::alloc::string::String, /// exchanged_size represent the change in size for an existing position /// after the change. A positive value indicates that the position size /// increased, while a negative value indicates that the position size /// decreased. - #[prost(string, tag = "10")] + #[prost(string, tag="10")] pub exchanged_size: ::prost::alloc::string::String, /// exchanged_notional represent the change in notional for an existing /// position after the change. A positive value indicates that the position /// notional increased, while a negative value indicates that the position /// notional decreased. - #[prost(string, tag = "11")] + #[prost(string, tag="11")] pub exchanged_notional: ::prost::alloc::string::String, } /// Emitted when a position is liquidated. Wraps a PositionChanged event since a @@ -283,56 +274,53 @@ pub struct PositionChangedEvent { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PositionLiquidatedEvent { - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub position_changed_event: ::core::option::Option, /// Address of the account that executed the tx. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub liquidator_address: ::prost::alloc::string::String, /// Commission (in margin units) received by 'liquidator'. - #[prost(message, optional, tag = "3")] - pub fee_to_liquidator: - ::core::option::Option, + #[prost(message, optional, tag="3")] + pub fee_to_liquidator: ::core::option::Option, /// Commission (in margin units) given to the ecosystem fund. - #[prost(message, optional, tag = "4")] - pub fee_to_ecosystem_fund: - ::core::option::Option, + #[prost(message, optional, tag="4")] + pub fee_to_ecosystem_fund: ::core::option::Option, } /// Emitted when a position is settled. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PositionSettledEvent { /// Identifier for the virtual pool of the position. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub pair: ::prost::alloc::string::String, /// Owner of the position. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub trader_address: ::prost::alloc::string::String, /// Settled coin as dictated by the settlement price of the perp.amm. - #[prost(message, repeated, tag = "3")] - pub settled_coins: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="3")] + pub settled_coins: ::prost::alloc::vec::Vec, } /// Emitted when the funding rate changes for a market. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct FundingRateChangedEvent { /// The pair for which the funding rate was calculated. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub pair: ::prost::alloc::string::String, /// The mark price of the pair. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub mark_price_twap: ::prost::alloc::string::String, /// The oracle index price of the pair. - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub index_price_twap: ::prost::alloc::string::String, /// The latest premium fraction just calculated. - #[prost(string, tag = "5")] + #[prost(string, tag="5")] pub premium_fraction: ::prost::alloc::string::String, /// The market's latest cumulative premium fraction. /// The funding payment a position will pay is the difference between this /// value and the latest cumulative premium fraction on the position, /// multiplied by the position size. - #[prost(string, tag = "6")] + #[prost(string, tag="6")] pub cumulative_premium_fraction: ::prost::alloc::string::String, } /// Emitted when liquidation fails. @@ -340,34 +328,21 @@ pub struct FundingRateChangedEvent { #[derive(Clone, PartialEq, ::prost::Message)] pub struct LiquidationFailedEvent { /// The pair for which we are trying to liquidate. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub pair: ::prost::alloc::string::String, /// owner of the position. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub trader: ::prost::alloc::string::String, /// Address of the account that executed the tx. - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub liquidator: ::prost::alloc::string::String, /// Reason for the liquidation failure. - #[prost( - enumeration = "liquidation_failed_event::LiquidationFailedReason", - tag = "4" - )] + #[prost(enumeration="liquidation_failed_event::LiquidationFailedReason", tag="4")] pub reason: i32, } /// Nested message and enum types in `LiquidationFailedEvent`. pub mod liquidation_failed_event { - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration, - )] + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum LiquidationFailedReason { Unspecified = 0, @@ -388,9 +363,7 @@ pub mod liquidation_failed_event { LiquidationFailedReason::Unspecified => "UNSPECIFIED", LiquidationFailedReason::PositionHealthy => "POSITION_HEALTHY", LiquidationFailedReason::NonexistentPair => "NONEXISTENT_PAIR", - LiquidationFailedReason::NonexistentPosition => { - "NONEXISTENT_POSITION" - } + LiquidationFailedReason::NonexistentPosition => "NONEXISTENT_POSITION", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -415,13 +388,13 @@ pub mod liquidation_failed_event { #[derive(Clone, PartialEq, ::prost::Message)] pub struct AmmUpdatedEvent { /// the final state of the AMM - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub final_amm: ::core::option::Option, /// The mark price of the pair. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub mark_price_twap: ::prost::alloc::string::String, /// The oracle index price of the pair. - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub index_price_twap: ::prost::alloc::string::String, } /// This event is emitted at the end of every block for persisting market changes @@ -436,228 +409,312 @@ pub struct AmmUpdatedEvent { #[derive(Clone, PartialEq, ::prost::Message)] pub struct MarketUpdatedEvent { /// the final state of the market - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub final_market: ::core::option::Option, } +/// EventShiftPegMultiplier: ABCI event emitted from MsgShiftPegMultiplier +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventShiftPegMultiplier { + #[prost(string, tag="1")] + pub old_peg_multiplier: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub new_peg_multiplier: ::prost::alloc::string::String, + #[prost(message, optional, tag="3")] + pub cost_paid: ::core::option::Option, +} +/// EventShiftSwapInvariant: ABCI event emitted from MsgShiftSwapInvariant +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventShiftSwapInvariant { + #[prost(string, tag="1")] + pub old_swap_invariant: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub new_swap_invariant: ::prost::alloc::string::String, + #[prost(message, optional, tag="3")] + pub cost_paid: ::core::option::Option, +} /// GenesisState defines the perp module's genesis state. /// Thge genesis state is used not only to start the network but also useful for /// exporting and importing state during network upgrades. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GenesisState { - #[prost(message, repeated, tag = "2")] + #[prost(message, repeated, tag="2")] pub markets: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "3")] + #[prost(message, repeated, tag="3")] pub amms: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "4")] - pub positions: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "5")] + #[prost(message, repeated, tag="4")] + pub positions: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="5")] pub reserve_snapshots: ::prost::alloc::vec::Vec, - #[prost(uint64, tag = "6")] + #[prost(uint64, tag="6")] pub dnr_epoch: u64, - #[prost(message, repeated, tag = "7")] + /// For testing purposes, we allow the collateral to be set at genesis + #[prost(string, tag="11")] + pub collateral_denom: ::prost::alloc::string::String, + #[prost(message, repeated, tag="7")] pub trader_volumes: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "8")] + #[prost(message, repeated, tag="8")] pub global_discount: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "9")] - pub custom_discounts: - ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "10")] + #[prost(message, repeated, tag="9")] + pub custom_discounts: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="10")] pub market_last_versions: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="13")] + pub global_volumes: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="12")] + pub rebates_allocations: ::prost::alloc::vec::Vec, + #[prost(string, tag="14")] + pub dnr_epoch_name: ::prost::alloc::string::String, } /// Nested message and enum types in `GenesisState`. pub mod genesis_state { #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct TraderVolume { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub trader: ::prost::alloc::string::String, - #[prost(uint64, tag = "2")] + #[prost(uint64, tag="2")] pub epoch: u64, - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub volume: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct Discount { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub fee: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub volume: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct CustomDiscount { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub trader: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub discount: ::core::option::Option, } + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct GlobalVolume { + #[prost(uint64, tag="1")] + pub epoch: u64, + #[prost(string, tag="2")] + pub volume: ::prost::alloc::string::String, + } } /// GenesisMarketLastVersion is the last version including pair only used for /// genesis #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GenesisMarketLastVersion { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] + pub pair: ::prost::alloc::string::String, + #[prost(uint64, tag="2")] + pub version: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisPosition { + #[prost(string, tag="1")] pub pair: ::prost::alloc::string::String, - #[prost(uint64, tag = "2")] + #[prost(uint64, tag="2")] pub version: u64, + #[prost(message, optional, tag="3")] + pub position: ::core::option::Option, } // ---------------------------------------- Positions +/// QueryPositionsRequest: Request type for the +/// "nibiru.perp.v2.Query/Positions" gRPC service method #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPositionsRequest { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub trader: ::prost::alloc::string::String, } +/// QueryPositionsResponse: Response type for the +/// "nibiru.perp.v2.Query/Positions" gRPC service method #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPositionsResponse { - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub positions: ::prost::alloc::vec::Vec, } +/// QueryPositionStoreRequest: Request type for the +/// "nibiru.perp.v2.Query/PositionStore" gRPC service method #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPositionStoreRequest { /// pagination defines a paginated request - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option< - crate::proto::cosmos::base::query::v1beta1::PageRequest, - >, + #[prost(message, optional, tag="1")] + pub pagination: ::core::option::Option, } +/// QueryPositionStoreResponse: Response type for the +/// "nibiru.perp.v2.Query/PositionStore" gRPC service method #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPositionStoreResponse { /// Position responses: collection of all stored positions (with pagination) - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub positions: ::prost::alloc::vec::Vec, /// pagination defines a paginated response - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - crate::proto::cosmos::base::query::v1beta1::PageResponse, - >, + #[prost(message, optional, tag="2")] + pub pagination: ::core::option::Option, } // ---------------------------------------- Position -/// QueryPositionRequest is the request type for the position of the x/perp -/// module account. +/// QueryPositionRequest: Request type for the +/// "nibiru.perp.v2.Query/Position" gRPC service method #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPositionRequest { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub pair: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub trader: ::prost::alloc::string::String, } +/// QueryPositionResponse: Response type for the +/// "nibiru.perp.v2.Query/Position" gRPC service method #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPositionResponse { /// The position as it exists in the blockchain state - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub position: ::core::option::Option, /// The position's current notional value, if it were to be entirely closed (in /// margin units). - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub position_notional: ::prost::alloc::string::String, /// The position's unrealized PnL. - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub unrealized_pnl: ::prost::alloc::string::String, /// margin ratio of the position based on the spot price - #[prost(string, tag = "4")] + #[prost(string, tag="4")] pub margin_ratio: ::prost::alloc::string::String, } // ---------------------------------------- QueryModuleAccounts +/// QueryModuleAccountsRequest: Request type for the +/// "nibiru.perp.v2.Query/ModuleAccounts" gRPC service method #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryModuleAccountsRequest {} +pub struct QueryModuleAccountsRequest { +} +/// QueryModuleAccountsResponse: Response type for the +/// "nibiru.perp.v2.Query/ModuleAccounts" gRPC service method #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryModuleAccountsResponse { - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub accounts: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AccountWithBalance { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub name: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub address: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "3")] - pub balance: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="3")] + pub balance: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AmmMarket { - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub market: ::core::option::Option, - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub amm: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryMarketsRequest { - #[prost(bool, tag = "1")] + #[prost(bool, tag="1")] pub versioned: bool, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryMarketsResponse { - #[prost(message, repeated, tag = "1")] + #[prost(message, repeated, tag="1")] pub amm_markets: ::prost::alloc::vec::Vec, } +// ---------------------------------------- QueryCollateral + +/// QueryCollateralRequest: Request type for the +/// "nibiru.perp.v2.Query/Collateral" gRPC service method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryCollateralRequest { +} +/// QueryCollateralRequest: Response type for the +/// "nibiru.perp.v2.Query/Collateral" gRPC service method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryCollateralResponse { + #[prost(string, tag="1")] + pub collateral_denom: ::prost::alloc::string::String, +} +// -------------------------- Settle Position -------------------------- + +/// MsgSettlePosition: Msg to remove margin. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSettlePosition { + #[prost(string, tag="1")] + pub sender: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub pair: ::prost::alloc::string::String, + #[prost(uint64, tag="3")] + pub version: u64, +} // -------------------------- RemoveMargin -------------------------- -/// MsgRemoveMargin: Msg to remove margin. +/// MsgRemoveMargin: Msg to remove margin. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgRemoveMargin { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub sender: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub pair: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub margin: - ::core::option::Option, + #[prost(message, optional, tag="3")] + pub margin: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgRemoveMarginResponse { /// tokens transferred back to the trader - #[prost(message, optional, tag = "1")] - pub margin_out: - ::core::option::Option, + #[prost(message, optional, tag="1")] + pub margin_out: ::core::option::Option, /// the funding payment applied on this position interaction - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub funding_payment: ::prost::alloc::string::String, /// The resulting position - #[prost(message, optional, tag = "3")] + #[prost(message, optional, tag="3")] pub position: ::core::option::Option, } // -------------------------- AddMargin -------------------------- -/// MsgAddMargin: Msg to remove margin. +/// MsgAddMargin: Msg to remove margin. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgAddMargin { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub sender: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub pair: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub margin: - ::core::option::Option, + #[prost(message, optional, tag="3")] + pub margin: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgAddMarginResponse { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub funding_payment: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub position: ::core::option::Option, } // -------------------------- Liquidation -------------------------- @@ -665,51 +722,48 @@ pub struct MsgAddMarginResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgMultiLiquidate { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub sender: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "2")] + #[prost(message, repeated, tag="2")] pub liquidations: ::prost::alloc::vec::Vec, } /// Nested message and enum types in `MsgMultiLiquidate`. pub mod msg_multi_liquidate { #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct Liquidation { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub pair: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub trader: ::prost::alloc::string::String, } } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgMultiLiquidateResponse { - #[prost(message, repeated, tag = "1")] - pub liquidations: ::prost::alloc::vec::Vec< - msg_multi_liquidate_response::LiquidationResponse, - >, + #[prost(message, repeated, tag="1")] + pub liquidations: ::prost::alloc::vec::Vec, } /// Nested message and enum types in `MsgMultiLiquidateResponse`. pub mod msg_multi_liquidate_response { #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct LiquidationResponse { - #[prost(bool, tag = "1")] + #[prost(bool, tag="1")] pub success: bool, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub error: ::prost::alloc::string::String, /// nullable since no fee is taken on failed liquidation - #[prost(message, optional, tag = "3")] - pub liquidator_fee: - ::core::option::Option, + #[prost(message, optional, tag="3")] + pub liquidator_fee: ::core::option::Option, /// perp ecosystem fund - #[prost(message, optional, tag = "4")] - pub perp_ef_fee: - ::core::option::Option, + #[prost(message, optional, tag="4")] + pub perp_ef_fee: ::core::option::Option, // nullable since no fee is taken on failed liquidation - #[prost(string, tag = "5")] + + #[prost(string, tag="5")] pub trader: ::prost::alloc::string::String, - #[prost(string, tag = "6")] + #[prost(string, tag="6")] pub pair: ::prost::alloc::string::String, } } @@ -718,49 +772,49 @@ pub mod msg_multi_liquidate_response { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgMarketOrder { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub sender: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub pair: ::prost::alloc::string::String, - #[prost(enumeration = "Direction", tag = "3")] + #[prost(enumeration="Direction", tag="3")] pub side: i32, - #[prost(string, tag = "4")] + #[prost(string, tag="4")] pub quote_asset_amount: ::prost::alloc::string::String, - #[prost(string, tag = "5")] + #[prost(string, tag="5")] pub leverage: ::prost::alloc::string::String, - #[prost(string, tag = "6")] + #[prost(string, tag="6")] pub base_asset_amount_limit: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgMarketOrderResponse { - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub position: ::core::option::Option, /// The amount of quote assets exchanged. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub exchanged_notional_value: ::prost::alloc::string::String, /// The amount of base assets exchanged. - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub exchanged_position_size: ::prost::alloc::string::String, /// The funding payment applied on this position change, measured in quote /// units. - #[prost(string, tag = "4")] + #[prost(string, tag="4")] pub funding_payment: ::prost::alloc::string::String, /// The amount of PnL realized on this position changed, measured in quote /// units. - #[prost(string, tag = "5")] + #[prost(string, tag="5")] pub realized_pnl: ::prost::alloc::string::String, /// The unrealized PnL in the position after the position change, measured in /// quote units. - #[prost(string, tag = "6")] + #[prost(string, tag="6")] pub unrealized_pnl_after: ::prost::alloc::string::String, /// The amount of margin the trader has to give to the vault. /// A negative value means the vault pays the trader. - #[prost(string, tag = "7")] + #[prost(string, tag="7")] pub margin_to_vault: ::prost::alloc::string::String, /// The position's notional value after the position change, measured in quote /// units. - #[prost(string, tag = "8")] + #[prost(string, tag="8")] pub position_notional: ::prost::alloc::string::String, } // -------------------------- ClosePosition -------------------------- @@ -768,63 +822,63 @@ pub struct MsgMarketOrderResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgClosePosition { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub sender: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub pair: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgClosePositionResponse { /// The amount of quote assets exchanged. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub exchanged_notional_value: ::prost::alloc::string::String, /// The amount of base assets exchanged. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub exchanged_position_size: ::prost::alloc::string::String, /// The funding payment applied on this position change, measured in quote /// units. - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub funding_payment: ::prost::alloc::string::String, /// The amount of PnL realized on this position changed, measured in quote /// units. - #[prost(string, tag = "4")] + #[prost(string, tag="4")] pub realized_pnl: ::prost::alloc::string::String, /// The amount of margin the trader receives after closing the position, from /// the vault. Should never be negative. - #[prost(string, tag = "5")] + #[prost(string, tag="5")] pub margin_to_trader: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgPartialClose { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub sender: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub pair: ::prost::alloc::string::String, - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub size: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgPartialCloseResponse { /// The amount of quote assets exchanged. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub exchanged_notional_value: ::prost::alloc::string::String, /// The amount of base assets exchanged. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub exchanged_position_size: ::prost::alloc::string::String, /// The funding payment applied on this position change, measured in quote /// units. - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub funding_payment: ::prost::alloc::string::String, /// The amount of PnL realized on this position changed, measured in quote /// units. - #[prost(string, tag = "4")] + #[prost(string, tag="4")] pub realized_pnl: ::prost::alloc::string::String, /// The amount of margin the trader receives after closing the position, from /// the vault. Should never be negative. - #[prost(string, tag = "5")] + #[prost(string, tag="5")] pub margin_to_trader: ::prost::alloc::string::String, } // -------------------------- DonateToEcosystemFund -------------------------- @@ -832,14 +886,97 @@ pub struct MsgPartialCloseResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgDonateToEcosystemFund { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub sender: ::prost::alloc::string::String, /// donation to the EF - #[prost(message, optional, tag = "2")] - pub donation: - ::core::option::Option, + #[prost(message, optional, tag="2")] + pub donation: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgDonateToEcosystemFundResponse {} +pub struct MsgDonateToEcosystemFundResponse { +} +// ----------------------- MsgChangeCollateralDenom ----------------------- + +/// MsgChangeCollateralDenom: Changes the collateral denom for the module. +/// \[Admin\] Only callable by sudoers. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgChangeCollateralDenom { + #[prost(string, tag="1")] + pub sender: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub new_denom: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgChangeCollateralDenomResponse { +} +/// -------------------------- AllocateEpochRebates -------------------------- +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgAllocateEpochRebates { + #[prost(string, tag="1")] + pub sender: ::prost::alloc::string::String, + /// rebates to allocate + #[prost(message, repeated, tag="2")] + pub rebates: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgAllocateEpochRebatesResponse { + #[prost(message, repeated, tag="1")] + pub total_epoch_rebates: ::prost::alloc::vec::Vec, +} +/// -------------------------- WithdrawEpochRebates -------------------------- +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgWithdrawEpochRebates { + #[prost(string, tag="1")] + pub sender: ::prost::alloc::string::String, + #[prost(uint64, repeated, tag="2")] + pub epochs: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgWithdrawEpochRebatesResponse { + #[prost(message, repeated, tag="1")] + pub withdrawn_rebates: ::prost::alloc::vec::Vec, +} +// -------------------------- ShiftPegMultiplier -------------------------- + +/// ShiftPegMultiplier: gRPC tx msg for changing the peg multiplier. +/// Admin-only. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgShiftPegMultiplier { + #[prost(string, tag="1")] + pub sender: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub pair: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub new_peg_mult: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgShiftPegMultiplierResponse { +} +// -------------------------- ShiftSwapInvariant -------------------------- + +/// ShiftSwapInvariant: gRPC tx msg for changing the swap invariant. +/// Admin-only. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgShiftSwapInvariant { + #[prost(string, tag="1")] + pub sender: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub pair: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub new_swap_invariant: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgShiftSwapInvariantResponse { +} // @@protoc_insertion_point(module) diff --git a/nibiru-std/src/proto/buf/nibiru.spot.v1.rs b/nibiru-std/src/proto/buf/nibiru.spot.v1.rs index 72f841f..dadedca 100644 --- a/nibiru-std/src/proto/buf/nibiru.spot.v1.rs +++ b/nibiru-std/src/proto/buf/nibiru.spot.v1.rs @@ -3,18 +3,18 @@ #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PoolParams { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub swap_fee: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub exit_fee: ::prost::alloc::string::String, /// Amplification Parameter (A): Larger value of A make the curve better /// resemble a straight line in the center (when pool is near balance). Highly /// volatile assets should use a lower value, while assets that are closer /// together may be best with a higher value. This is only used if the /// pool_type is set to 1 (stableswap) - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub a: ::prost::alloc::string::String, - #[prost(enumeration = "PoolType", tag = "4")] + #[prost(enumeration="PoolType", tag="4")] pub pool_type: i32, } /// Which assets the pool contains. @@ -23,51 +23,40 @@ pub struct PoolParams { pub struct PoolAsset { /// Coins we are talking about, /// the denomination must be unique amongst all PoolAssets for this pool. - #[prost(message, optional, tag = "1")] + #[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")] + #[prost(string, tag="2")] pub weight: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Pool { /// The pool id. - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub id: u64, /// The pool account address. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub address: ::prost::alloc::string::String, /// Fees and other pool-specific parameters. - #[prost(message, optional, tag = "3")] + #[prost(message, optional, tag="3")] pub pool_params: ::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 = "4")] + #[prost(message, repeated, tag="4")] pub pool_assets: ::prost::alloc::vec::Vec, /// sum of all non-normalized pool weights - #[prost(string, tag = "5")] + #[prost(string, tag="5")] pub total_weight: ::prost::alloc::string::String, /// sum of all LP tokens sent out - #[prost(message, optional, tag = "6")] - pub total_shares: - ::core::option::Option, + #[prost(message, optional, tag="6")] + pub total_shares: ::core::option::Option, } /// - `balancer`: Balancer are pools defined by the equation xy=k, extended by /// the weighs introduced by Balancer. /// - `stableswap`: Stableswap pools are defined by a combination of /// constant-product and constant-sum pool -#[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration, -)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum PoolType { Balancer = 0, @@ -97,91 +86,79 @@ impl PoolType { #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventPoolCreated { /// the address of the user who created the pool - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub creator: ::prost::alloc::string::String, /// the create pool fee - #[prost(message, repeated, tag = "2")] - pub fees: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="2")] + pub fees: ::prost::alloc::vec::Vec, /// the final state of the pool - #[prost(message, optional, tag = "4")] + #[prost(message, optional, tag="4")] pub final_pool: ::core::option::Option, /// the amount of pool shares that the user received - #[prost(message, optional, tag = "5")] - pub final_user_pool_shares: - ::core::option::Option, + #[prost(message, optional, tag="5")] + pub final_user_pool_shares: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventPoolJoined { /// the address of the user who joined the pool - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub address: ::prost::alloc::string::String, /// the amount of tokens that the user deposited - #[prost(message, repeated, tag = "2")] - pub tokens_in: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="2")] + pub tokens_in: ::prost::alloc::vec::Vec, /// the amount of pool shares that the user received - #[prost(message, optional, tag = "3")] - pub pool_shares_out: - ::core::option::Option, + #[prost(message, optional, tag="3")] + pub pool_shares_out: ::core::option::Option, /// the amount of tokens remaining for the user - #[prost(message, repeated, tag = "4")] - pub rem_coins: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="4")] + pub rem_coins: ::prost::alloc::vec::Vec, /// the final state of the pool - #[prost(message, optional, tag = "5")] + #[prost(message, optional, tag="5")] pub final_pool: ::core::option::Option, /// the final amount of user pool shares - #[prost(message, optional, tag = "6")] - pub final_user_pool_shares: - ::core::option::Option, + #[prost(message, optional, tag="6")] + pub final_user_pool_shares: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventPoolExited { /// the address of the user who exited the pool - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub address: ::prost::alloc::string::String, /// the amount of pool shares that the user exited with - #[prost(message, optional, tag = "2")] - pub pool_shares_in: - ::core::option::Option, + #[prost(message, optional, tag="2")] + pub pool_shares_in: ::core::option::Option, /// the amount of tokens returned to the user - #[prost(message, repeated, tag = "3")] - pub tokens_out: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="3")] + pub tokens_out: ::prost::alloc::vec::Vec, /// the amount of fees collected by the pool - #[prost(message, repeated, tag = "4")] - pub fees: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="4")] + pub fees: ::prost::alloc::vec::Vec, /// the final state of the pool - #[prost(message, optional, tag = "5")] + #[prost(message, optional, tag="5")] pub final_pool: ::core::option::Option, /// the final amount of user pool shares - #[prost(message, optional, tag = "6")] - pub final_user_pool_shares: - ::core::option::Option, + #[prost(message, optional, tag="6")] + pub final_user_pool_shares: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventAssetsSwapped { /// the address of the user who swapped tokens - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub address: ::prost::alloc::string::String, /// the amount of tokens that the user deposited - #[prost(message, optional, tag = "2")] - pub token_in: - ::core::option::Option, + #[prost(message, optional, tag="2")] + pub token_in: ::core::option::Option, /// the amount of tokens that the user received - #[prost(message, optional, tag = "3")] - pub token_out: - ::core::option::Option, + #[prost(message, optional, tag="3")] + pub token_out: ::core::option::Option, /// the amount of fees collected by the pool - #[prost(message, optional, tag = "4")] + #[prost(message, optional, tag="4")] pub fee: ::core::option::Option, /// the final state of the pool - #[prost(message, optional, tag = "5")] + #[prost(message, optional, tag="5")] pub final_pool: ::core::option::Option, } /// Params defines the parameters for the module. @@ -189,142 +166,137 @@ pub struct EventAssetsSwapped { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Params { /// The start pool number, i.e. the first pool number that isn't taken yet. - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub starting_pool_number: u64, /// The cost of creating a pool, taken from the pool creator's account. - #[prost(message, repeated, tag = "2")] - pub pool_creation_fee: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="2")] + pub pool_creation_fee: ::prost::alloc::vec::Vec, /// The assets that can be used to create liquidity pools - #[prost(string, repeated, tag = "3")] - pub whitelisted_asset: - ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, repeated, tag="3")] + pub whitelisted_asset: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// GenesisState defines the spot module's genesis state. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GenesisState { /// params defines all the parameters of the module. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub params: ::core::option::Option, /// pools defines all the pools of the module. - #[prost(message, repeated, tag = "2")] + #[prost(message, repeated, tag="2")] pub pools: ::prost::alloc::vec::Vec, } /// QueryParamsRequest is request type for the Query/Params RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryParamsRequest {} +pub struct QueryParamsRequest { +} /// QueryParamsResponse is response type for the Query/Params RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryParamsResponse { /// params holds all the parameters of this module. - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub params: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryPoolNumberRequest {} +pub struct QueryPoolNumberRequest { +} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPoolNumberResponse { - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub pool_id: u64, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPoolRequest { - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub pool_id: u64, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPoolResponse { - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub pool: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPoolsRequest { /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option< - crate::proto::cosmos::base::query::v1beta1::PageRequest, - >, + #[prost(message, optional, tag="1")] + pub pagination: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPoolsResponse { - #[prost(message, repeated, tag = "1")] + #[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< - crate::proto::cosmos::base::query::v1beta1::PageResponse, - >, + #[prost(message, optional, tag="2")] + pub pagination: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPoolParamsRequest { - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub pool_id: u64, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPoolParamsResponse { - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub pool_params: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryNumPoolsRequest {} +pub struct QueryNumPoolsRequest { +} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryNumPoolsResponse { - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub num_pools: u64, } /// -------------------------------------------- /// Query total liquidity the protocol #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryTotalLiquidityRequest {} +pub struct QueryTotalLiquidityRequest { +} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryTotalLiquidityResponse { - #[prost(message, repeated, tag = "1")] - pub liquidity: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="1")] + pub liquidity: ::prost::alloc::vec::Vec, } /// -------------------------------------------- /// Query total liquidity for a pool #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryTotalPoolLiquidityRequest { - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub pool_id: u64, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryTotalPoolLiquidityResponse { - #[prost(message, repeated, tag = "1")] - pub liquidity: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="1")] + pub liquidity: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryTotalSharesRequest { - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub pool_id: u64, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryTotalSharesResponse { /// sum of all LP tokens sent out - #[prost(message, optional, tag = "1")] - pub total_shares: - ::core::option::Option, + #[prost(message, optional, tag="1")] + pub total_shares: ::core::option::Option, } /// Returns the amount of tokenInDenom to produce 1 tokenOutDenom /// For example, if the price of NIBI = 9.123 NUSD, then setting @@ -332,19 +304,19 @@ pub struct QueryTotalSharesResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QuerySpotPriceRequest { - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub pool_id: u64, /// the denomination of the token you are giving into the pool - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub token_in_denom: ::prost::alloc::string::String, /// the denomination of the token you are taking out of the pool - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub token_out_denom: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QuerySpotPriceResponse { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub spot_price: ::prost::alloc::string::String, } /// Given an exact amount of tokens in and a target tokenOutDenom, calculates @@ -352,21 +324,19 @@ pub struct QuerySpotPriceResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QuerySwapExactAmountInRequest { - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub pool_id: u64, - #[prost(message, optional, tag = "2")] - pub token_in: - ::core::option::Option, - #[prost(string, tag = "3")] + #[prost(message, optional, tag="2")] + pub token_in: ::core::option::Option, + #[prost(string, tag="3")] pub token_out_denom: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QuerySwapExactAmountInResponse { - #[prost(message, optional, tag = "2")] - pub token_out: - ::core::option::Option, - #[prost(message, optional, tag = "3")] + #[prost(message, optional, tag="2")] + pub token_out: ::core::option::Option, + #[prost(message, optional, tag="3")] pub fee: ::core::option::Option, } /// Given an exact amount of tokens out and a target tokenInDenom, calculates @@ -374,93 +344,89 @@ pub struct QuerySwapExactAmountInResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QuerySwapExactAmountOutRequest { - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub pool_id: u64, - #[prost(message, optional, tag = "2")] - pub token_out: - ::core::option::Option, - #[prost(string, tag = "3")] + #[prost(message, optional, tag="2")] + pub token_out: ::core::option::Option, + #[prost(string, tag="3")] pub token_in_denom: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QuerySwapExactAmountOutResponse { - #[prost(message, optional, tag = "2")] - pub token_in: - ::core::option::Option, + #[prost(message, optional, tag="2")] + pub token_in: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryJoinExactAmountInRequest { - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub pool_id: u64, - #[prost(message, repeated, tag = "2")] - pub tokens_in: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="2")] + pub tokens_in: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryJoinExactAmountInResponse { /// amount of pool shares returned to user after join - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub pool_shares_out: ::prost::alloc::string::String, /// coins remaining after pool join - #[prost(message, repeated, tag = "2")] - pub rem_coins: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="2")] + pub rem_coins: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryJoinExactAmountOutRequest { - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub pool_id: u64, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryJoinExactAmountOutResponse {} +pub struct QueryJoinExactAmountOutResponse { +} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryExitExactAmountInRequest { - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub pool_id: u64, /// amount of pool shares to return to pool - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub pool_shares_in: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryExitExactAmountInResponse { /// coins obtained after exiting - #[prost(message, repeated, tag = "1")] - pub tokens_out: - ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "2")] - pub fees: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="1")] + pub tokens_out: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="2")] + pub fees: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryExitExactAmountOutRequest { - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub pool_id: u64, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryExitExactAmountOutResponse {} +pub struct QueryExitExactAmountOutResponse { +} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgCreatePool { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub creator: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub pool_params: ::core::option::Option, - #[prost(message, repeated, tag = "3")] + #[prost(message, repeated, tag="3")] pub pool_assets: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgCreatePoolResponse { - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub pool_id: u64, } /// @@ -468,14 +434,13 @@ pub struct MsgCreatePoolResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgJoinPool { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub sender: ::prost::alloc::string::String, - #[prost(uint64, tag = "2")] + #[prost(uint64, tag="2")] pub pool_id: u64, - #[prost(message, repeated, tag = "3")] - pub tokens_in: - ::prost::alloc::vec::Vec, - #[prost(bool, tag = "4")] + #[prost(message, repeated, tag="3")] + pub tokens_in: ::prost::alloc::vec::Vec, + #[prost(bool, tag="4")] pub use_all_coins: bool, } /// @@ -484,53 +449,47 @@ pub struct MsgJoinPool { #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgJoinPoolResponse { /// the final state of the pool after a join - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub pool: ::core::option::Option, /// sum of LP tokens minted from the join - #[prost(message, optional, tag = "2")] - pub num_pool_shares_out: - ::core::option::Option, + #[prost(message, optional, tag="2")] + pub num_pool_shares_out: ::core::option::Option, /// remaining tokens from attempting to join the pool - #[prost(message, repeated, tag = "3")] - pub remaining_coins: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="3")] + pub remaining_coins: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgExitPool { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub sender: ::prost::alloc::string::String, - #[prost(uint64, tag = "2")] + #[prost(uint64, tag="2")] pub pool_id: u64, - #[prost(message, optional, tag = "3")] - pub pool_shares: - ::core::option::Option, + #[prost(message, optional, tag="3")] + pub pool_shares: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgExitPoolResponse { - #[prost(message, repeated, tag = "3")] - pub tokens_out: - ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="3")] + pub tokens_out: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgSwapAssets { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub sender: ::prost::alloc::string::String, - #[prost(uint64, tag = "2")] + #[prost(uint64, tag="2")] pub pool_id: u64, - #[prost(message, optional, tag = "3")] - pub token_in: - ::core::option::Option, - #[prost(string, tag = "4")] + #[prost(message, optional, tag="3")] + pub token_in: ::core::option::Option, + #[prost(string, tag="4")] pub token_out_denom: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgSwapAssetsResponse { - #[prost(message, optional, tag = "3")] - pub token_out: - ::core::option::Option, + #[prost(message, optional, tag="3")] + pub token_out: ::core::option::Option, } -// @@protoc_insertion_point(module) \ No newline at end of file +// @@protoc_insertion_point(module) diff --git a/nibiru-std/src/proto/buf/nibiru.stablecoin.v1.rs b/nibiru-std/src/proto/buf/nibiru.stablecoin.v1.rs deleted file mode 100644 index 756d4cd..0000000 --- a/nibiru-std/src/proto/buf/nibiru.stablecoin.v1.rs +++ /dev/null @@ -1,287 +0,0 @@ -// @generated -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EventTransfer { - #[prost(message, optional, tag = "1")] - pub coin: ::core::option::Option, - #[prost(string, tag = "2")] - pub from: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub to: ::prost::alloc::string::String, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EventMintStable { - #[prost(string, tag = "1")] - pub amount: ::prost::alloc::string::String, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EventBurnStable { - #[prost(string, tag = "1")] - pub amount: ::prost::alloc::string::String, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EventMintNibi { - #[prost(string, tag = "1")] - pub amount: ::prost::alloc::string::String, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EventBurnNibi { - #[prost(string, tag = "1")] - pub amount: ::prost::alloc::string::String, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EventRecollateralize { - #[prost(string, tag = "1")] - pub caller: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub in_coin: - ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub out_coin: - ::core::option::Option, - #[prost(string, tag = "4")] - pub coll_ratio: ::prost::alloc::string::String, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EventBuyback { - #[prost(string, tag = "1")] - pub caller: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub in_coin: - ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub out_coin: - ::core::option::Option, - #[prost(string, tag = "4")] - pub coll_ratio: ::prost::alloc::string::String, -} -/// Params defines the parameters for the module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Params { - /// collRatio is the ratio needed as collateral to exchange for stables - #[prost(int64, tag = "1")] - pub coll_ratio: i64, - /// feeRatio is the ratio taken as fees when minting or burning stables - #[prost(int64, tag = "2")] - pub fee_ratio: i64, - /// efFeeRatio is the ratio taken from the fees that goes to Ecosystem Fund - #[prost(int64, tag = "3")] - pub ef_fee_ratio: i64, - /// BonusRateRecoll is the percentage of extra stablecoin value given to the - /// caller of 'Recollateralize' in units of governance tokens. - #[prost(int64, tag = "4")] - pub bonus_rate_recoll: i64, - /// distr_epoch_identifier defines the frequnecy of update for the collateral - /// ratio - #[prost(string, tag = "5")] - pub distr_epoch_identifier: ::prost::alloc::string::String, - /// adjustmentStep is the size of the step taken when updating the collateral - /// ratio - #[prost(int64, tag = "6")] - pub adjustment_step: i64, - /// priceLowerBound is the lower bound for the stable coin to trigger a - /// collateral ratio update - #[prost(int64, tag = "7")] - pub price_lower_bound: i64, - /// priceUpperBound is the upper bound for the stable coin to trigger a - /// collateral ratio update - #[prost(int64, tag = "8")] - pub price_upper_bound: i64, - /// isCollateralRatioValid checks if the collateral ratio is correctly updated - #[prost(bool, tag = "9")] - pub is_collateral_ratio_valid: bool, -} -/// GenesisState defines the stablecoin module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GenesisState { - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub module_account_balance: - ::core::option::Option, -} -// ---------------------------------------- Params - -/// QueryParamsRequest is request type for the Query/Params RPC method. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is response type for the Query/Params RPC method. -#[allow(clippy::derive_partial_eq_without_eq)] -#[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, -} -// ---------------------------------------- ModuleAccountBalances - -/// QueryModuleAccountBalances is the request type for the balance of the -/// x/stablecoin module account. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryModuleAccountBalances {} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryModuleAccountBalancesResponse { - /// ModuleAccountBalances is the balance of all coins in the x/stablecoin - /// module. - #[prost(message, repeated, tag = "1")] - pub module_account_balances: - ::prost::alloc::vec::Vec, -} -// ---------------------------------------- CirculatingSupplies - -/// QueryCirculatingSupplies is the request type for the circulating supply of -/// both NIBI and NUSD. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryCirculatingSupplies {} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryCirculatingSuppliesResponse { - #[prost(message, optional, tag = "1")] - pub nibi: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub nusd: ::core::option::Option, -} -// ---------------------------------------- GovToMintStable - -/// QueryGovToMintStable is the request type for the Query/GovToMintStable RPC -/// method -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryGovToMintStable { - #[prost(message, optional, tag = "1")] - pub collateral: - ::core::option::Option, -} -/// QueryGovToMintStableResponse is the response type for 'QueryGovToMintStable' -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryGovToMintStableResponse { - #[prost(message, optional, tag = "1")] - pub gov: ::core::option::Option, -} -// ---------------------------------------- Liquidity Ratio Info - -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct LiquidityRatioInfo { - #[prost(string, tag = "1")] - pub liquidity_ratio: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub upper_band: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub lower_band: ::prost::alloc::string::String, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryLiquidityRatioInfoRequest {} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryLiquidityRatioInfoResponse { - #[prost(message, optional, tag = "1")] - pub info: ::core::option::Option, -} -/// -/// MsgMintStable: Msg to mint NUSD. A user deposits NIBI and collateral and gets -/// NUSD in return. The amount of NUSD received depends on the current price set -/// by the oracle library and the current collateral ratio for the protocol. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgMintStable { - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub stable: - ::core::option::Option, -} -/// MsgMintStableResponse specifies the amount of NUSD token the user will -/// receive after their mint transaction -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgMintStableResponse { - #[prost(message, optional, tag = "1")] - pub stable: - ::core::option::Option, - #[prost(message, repeated, tag = "2")] - pub used_coins: - ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "3")] - pub fees_payed: - ::prost::alloc::vec::Vec, -} -/// -/// MsgBurnStable allows users to burn NUSD in exchange for NIBI and collateral. -/// The amount of NIBI and Collateral received depends on the current price set by -/// the x/oracle library and the current collateral ratio. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgBurnStable { - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub stable: - ::core::option::Option, -} -/// MsgBurnStableResponse specifies the amount of collateral and governance -/// token the user will receive after their burn transaction. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgBurnStableResponse { - #[prost(message, optional, tag = "1")] - pub collateral: - ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub gov: ::core::option::Option, - #[prost(message, repeated, tag = "3")] - pub fees_payed: - ::prost::alloc::vec::Vec, -} -/// MsgRecollateralize -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgRecollateralize { - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub coll: ::core::option::Option, -} -/// MsgRecollateralizeResponse is the output of a successful 'Recollateralize' -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgRecollateralizeResponse { - /// Gov (sdk.Coin): Tokens rewarded to the caller in exchange for her - /// collateral. - #[prost(message, optional, tag = "1")] - pub gov: ::core::option::Option, -} -/// MsgBuyback -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgBuyback { - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, - /// Gov (sdk.Coin): Tokens the caller wants to sell to the protocol in exchange - /// for collateral. - #[prost(message, optional, tag = "2")] - pub gov: ::core::option::Option, -} -/// MsgBuybackResponse is the output of a successful 'Buyback' -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgBuybackResponse { - /// Coll (sdk.Coin): Tokens sold to the caller in exchange for her collateral. - #[prost(message, optional, tag = "1")] - pub coll: ::core::option::Option, -} -// @@protoc_insertion_point(module) \ No newline at end of file diff --git a/nibiru-std/src/proto/buf/nibiru.tokenfactory.v1.rs b/nibiru-std/src/proto/buf/nibiru.tokenfactory.v1.rs index c2024c0..639d81b 100644 --- a/nibiru-std/src/proto/buf/nibiru.tokenfactory.v1.rs +++ b/nibiru-std/src/proto/buf/nibiru.tokenfactory.v1.rs @@ -2,52 +2,51 @@ #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventCreateDenom { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub denom: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub creator: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventChangeAdmin { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub denom: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub new_admin: ::prost::alloc::string::String, - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub old_admin: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventMint { - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub coin: ::core::option::Option, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub to_addr: ::prost::alloc::string::String, - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub caller: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventBurn { - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub coin: ::core::option::Option, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub from_addr: ::prost::alloc::string::String, - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub caller: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventSetDenomMetadata { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub denom: ::prost::alloc::string::String, /// Metadata: Official x/bank metadata for the denom. All token factory denoms /// are standard, native assets. The "metadata.base" is the denom. - #[prost(message, optional, tag = "2")] - pub metadata: - ::core::option::Option, - #[prost(string, tag = "3")] + #[prost(message, optional, tag="2")] + pub metadata: ::core::option::Option, + #[prost(string, tag="3")] pub caller: ::prost::alloc::string::String, } /// DenomAuthorityMetadata specifies metadata foraddresses that have specific @@ -58,7 +57,7 @@ pub struct EventSetDenomMetadata { pub struct DenomAuthorityMetadata { /// Admin: Bech32 address of the admin for the tokefactory denom. Can be empty /// for no admin. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub admin: ::prost::alloc::string::String, } /// ModuleParams defines the parameters for the tokenfactory module. @@ -92,7 +91,7 @@ pub struct DenomAuthorityMetadata { pub struct ModuleParams { /// Adds gas consumption to the execution of `MsgCreateDenom` as a method of /// spam prevention. Defaults to 10 NIBI. - #[prost(uint64, tag = "1")] + #[prost(uint64, tag="1")] pub denom_creation_gas_consume: u64, } /// TFDenom is a token factory (TF) denom. The canonical representation is @@ -101,11 +100,11 @@ pub struct ModuleParams { #[derive(Clone, PartialEq, ::prost::Message)] pub struct TfDenom { /// Creator: Bech32 address of the creator of the denom. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub creator: ::prost::alloc::string::String, /// Subdenom: Unique suffix of a token factory denom. A subdenom is specific /// to a given creator. It is the name given during a token factory "Mint". - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub subdenom: ::prost::alloc::string::String, } // ---------------------------------------------- @@ -116,51 +115,52 @@ pub struct TfDenom { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GenesisState { - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub params: ::core::option::Option, - #[prost(message, repeated, tag = "2")] + #[prost(message, repeated, tag="2")] pub factory_denoms: ::prost::alloc::vec::Vec, } /// GenesisDenom defines a tokenfactory denoms in the genesis state. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GenesisDenom { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub denom: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub authority_metadata: ::core::option::Option, } /// QueryParamsRequest is the request type for the Query/Params RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryParamsRequest {} +pub struct QueryParamsRequest { +} /// QueryParamsResponse is the response type for the Query/Params RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryParamsResponse { /// Module parameters stored in state - #[prost(message, optional, tag = "1")] + #[prost(message, optional, tag="1")] pub params: ::core::option::Option, } /// QueryDenomsRequest: gRPC query for all denoms registered for a creator #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDenomsRequest { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub creator: ::prost::alloc::string::String, } /// QueryDenomsResponse: All registered denoms for a creator #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDenomsResponse { - #[prost(string, repeated, tag = "1")] + #[prost(string, repeated, tag="1")] pub denoms: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// QueryDenomInfoRequest: gRPC query for the denom admin and x/bank metadata #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDenomInfoRequest { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub denom: ::prost::alloc::string::String, } /// QueryDenomInfoResponse: All registered denoms for a creator @@ -168,13 +168,12 @@ pub struct QueryDenomInfoRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDenomInfoResponse { /// Admin of the token factory denom - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub admin: ::prost::alloc::string::String, /// Metadata: Official x/bank metadata for the denom. All token factory denoms /// are standard, native assets. - #[prost(message, optional, tag = "2")] - pub metadata: - ::core::option::Option, + #[prost(message, optional, tag="2")] + pub metadata: ::core::option::Option, } /// MsgCreateDenom: sdk.Msg that registers an a token factory denom. /// A denom has the form "tf/\[creatorAddr]/[subdenom\]". @@ -185,10 +184,10 @@ pub struct QueryDenomInfoResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgCreateDenom { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub sender: ::prost::alloc::string::String, /// subdenom can be up to 44 "alphanumeric" characters long. - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub subdenom: ::prost::alloc::string::String, } /// MsgCreateDenomResponse is the return value of MsgCreateDenom @@ -196,7 +195,7 @@ pub struct MsgCreateDenom { #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgCreateDenomResponse { /// NewTokenDenom: identifier for the newly created token factory denom. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub new_token_denom: ::prost::alloc::string::String, } /// MsgChangeAdmin is the sdk.Msg type for allowing an admin account to change @@ -204,50 +203,52 @@ pub struct MsgCreateDenomResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgChangeAdmin { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub sender: ::prost::alloc::string::String, - #[prost(string, tag = "2")] + #[prost(string, tag="2")] pub denom: ::prost::alloc::string::String, - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub new_admin: ::prost::alloc::string::String, } /// MsgChangeAdminResponse is the gRPC response for the MsgChangeAdmin TxMsg. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgChangeAdminResponse {} +pub struct MsgChangeAdminResponse { +} /// MsgUpdateModuleParams: sdk.Msg for updating the x/tokenfactory module params #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgUpdateModuleParams { /// Authority: Address of the governance module account. - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub authority: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub params: ::core::option::Option, } /// MsgUpdateModuleParamsResponse is the gRPC response for the /// MsgUpdateModuleParams TxMsg. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgUpdateModuleParamsResponse {} +pub struct MsgUpdateModuleParamsResponse { +} /// MsgMint: sdk.Msg (TxMsg) where an denom admin mints more of the token. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgMint { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub sender: ::prost::alloc::string::String, /// coin: The denom identifier and amount to mint. - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub coin: ::core::option::Option, /// mint_to_addr: An address to which tokens will be minted. If blank, /// tokens are minted to the "sender". - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub mint_to: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgMintResponse { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub mint_to: ::prost::alloc::string::String, } /// MsgBurn: sdk.Msg (TxMsg) where a denom admin burns some of the token. @@ -258,32 +259,33 @@ pub struct MsgMintResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgBurn { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub sender: ::prost::alloc::string::String, /// coin: The denom identifier and amount to burn. - #[prost(message, optional, tag = "2")] + #[prost(message, optional, tag="2")] pub coin: ::core::option::Option, /// burn_from: The address from which tokens will be burned. - #[prost(string, tag = "3")] + #[prost(string, tag="3")] pub burn_from: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgBurnResponse {} +pub struct MsgBurnResponse { +} /// MsgSetDenomMetadata: sdk.Msg (TxMsg) enabling the denom admin to change its /// bank metadata. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgSetDenomMetadata { - #[prost(string, tag = "1")] + #[prost(string, tag="1")] pub sender: ::prost::alloc::string::String, /// Metadata: Official x/bank metadata for the denom. All token factory denoms /// are standard, native assets. The "metadata.base" is the denom. - #[prost(message, optional, tag = "2")] - pub metadata: - ::core::option::Option, + #[prost(message, optional, tag="2")] + pub metadata: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgSetDenomMetadataResponse {} -// @@protoc_insertion_point(module) \ No newline at end of file +pub struct MsgSetDenomMetadataResponse { +} +// @@protoc_insertion_point(module) diff --git a/nibiru-std/src/proto/mod.rs b/nibiru-std/src/proto/mod.rs index 214e81a..4311de8 100644 --- a/nibiru-std/src/proto/mod.rs +++ b/nibiru-std/src/proto/mod.rs @@ -28,8 +28,6 @@ pub mod cosmos { } } - // TODO cosmos autocli - /// Base functionality. pub mod base { /// Application BlockChain Interface (ABCI). @@ -81,36 +79,145 @@ pub mod cosmos { } } + /// Defines base data structures like Coin, DecCoin, IntProto, and + /// DecProto. These types implement custo method signatures required by + /// gogoproto. pub mod v1beta1 { include!("buf/cosmos.base.v1beta1.rs"); } + /// For consensus types related to blocks, block headers, and merkle + /// proofs. pub mod tendermint { pub mod v1beta1 { include!("buf/cosmos.base.tendermint.v1beta1.rs"); } } } - // TODO cosmso base - // TODO cosmos capability - // TODO cosmos consensus - // TODO cosmos crisis - // TODO cosmos crypto - // TODO cosmos distribution - // TODO cosmos evidence - // TODO cosmos feegrant - // TODO cosmos genutil - // TODO cosmos group - // TODO cosmos mint - // TODO cosmos nft - // TODO cosmos orm - // TODO cosmos params - // TODO cosmos reflection - // TODO cosmos slashing - // TODO cosmos staking - // TODO cosmos tx - // TODO cosmos upgrade - // TODO cosmos vesting + + pub mod crisis { + pub mod v1beta1 { + include!("buf/cosmos.crisis.v1beta1.rs"); + } + } + + pub mod crypto { + pub mod v1beta1 { + include!("buf/cosmos.crisis.v1beta1.rs"); + } + + pub mod ed25519 { + include!("buf/cosmos.crypto.ed25519.rs"); + } + + pub mod hd { + pub mod v1 { + include!("buf/cosmos.crypto.hd.v1.rs"); + } + } + + pub mod keyring { + pub mod v1 { + include!("buf/cosmos.crypto.keyring.v1.rs"); + } + } + + pub mod multisig { + pub mod v1beta1 { + include!("buf/cosmos.crypto.multisig.v1beta1.rs"); + } + } + pub mod secp256r1 { + include!("buf/cosmos.crypto.secp256r1.rs"); + } + } + + pub mod genutil { + pub mod v1beta1 { + include!("buf/cosmos.genutil.v1beta1.rs"); + } + } + + /// Types related to decentralized governance of the network. + pub mod gov { + pub mod v1 { + include!("buf/cosmos.gov.v1.rs"); + } + } + + pub mod group { + pub mod v1 { + include!("buf/cosmos.group.v1.rs"); + } + } + + pub mod mint { + pub mod v1beta1 { + include!("buf/cosmos.mint.v1beta1.rs"); + } + } + + pub mod nft { + pub mod v1beta1 { + include!("buf/cosmos.nft.v1beta1.rs"); + } + } + + pub mod params { + pub mod v1beta1 { + include!("buf/cosmos.params.v1beta1.rs"); + } + } + pub mod reflection { + pub mod v1 { + include!("buf/cosmos.reflection.v1.rs"); + } + } + pub mod slashing { + pub mod v1beta1 { + include!("buf/cosmos.slashing.v1beta1.rs"); + } + } + pub mod staking { + pub mod v1beta1 { + include!("buf/cosmos.staking.v1beta1.rs"); + } + } + pub mod tx { + pub mod config { + pub mod v1 { + include!("buf/cosmos.tx.config.v1.rs"); + } + } + pub mod signing { + pub mod v1beta1 { + include!("buf/cosmos.tx.signing.v1beta1.rs"); + } + } + pub mod v1beta1 { + include!("buf/cosmos.tx.v1beta1.rs"); + } + } + + pub mod upgrade { + pub mod v1beta1 { + include!("buf/cosmos.upgrade.v1beta1.rs"); + } + } + + pub mod vesting { + pub mod v1beta1 { + include!("buf/cosmos.vesting.v1beta1.rs"); + } + } + + // TODO: protobuf mod for cosmos capability + // TODO: protobuf mod for cosmos consensus + // TODO: protobuf mod for cosmos crisis + // TODO: protobuf mod for cosmos crypto + // TODO: protobuf mod for cosmos distribution + // TODO: protobuf mod for cosmos evidence + // TODO: protobuf mod for cosmos feegrant } pub mod nibiru { @@ -192,4 +299,4 @@ mod tests { }], }; } -} \ No newline at end of file +} diff --git a/nibiru-std/src/proto/type_url_cosmos.rs b/nibiru-std/src/proto/type_url_cosmos.rs index affc228..1c5ae54 100644 --- a/nibiru-std/src/proto/type_url_cosmos.rs +++ b/nibiru-std/src/proto/type_url_cosmos.rs @@ -6,6 +6,32 @@ use prost::Name; use crate::proto::cosmos; const PACKAGE_BANK: &str = "cosmos.bank.v1beta1"; +const PACKAGE_AUTH: &str = "cosmos.auth.v1beta1"; +const PACKAGE_GOV: &str = "cosmos.gov.v1"; + +// BANK tx msg + +impl Name for cosmos::bank::v1beta1::MsgSend { + const NAME: &'static str = "MsgSend"; + const PACKAGE: &'static str = PACKAGE_BANK; +} + +impl Name for cosmos::bank::v1beta1::MsgMultiSend { + const NAME: &'static str = "MsgMultiSend"; + const PACKAGE: &'static str = PACKAGE_BANK; +} + +impl Name for cosmos::bank::v1beta1::MsgUpdateParams { + const NAME: &'static str = "MsgUpdateParams"; + const PACKAGE: &'static str = PACKAGE_BANK; +} + +impl Name for cosmos::bank::v1beta1::MsgSetSendEnabled { + const NAME: &'static str = "MsgSetSendEnabled"; + const PACKAGE: &'static str = PACKAGE_BANK; +} + +// BANK query impl Name for cosmos::bank::v1beta1::QuerySupplyOfRequest { const NAME: &'static str = "QuerySupplyOfRequest"; @@ -27,24 +53,107 @@ impl Name for cosmos::bank::v1beta1::QueryDenomMetadataRequest { const PACKAGE: &'static str = PACKAGE_BANK; } -impl Name for cosmos::bank::v1beta1::MsgSend { - const NAME: &'static str = "MsgSend"; - const PACKAGE: &'static str = PACKAGE_BANK; +// AUTH tx msg + +impl Name for cosmos::auth::v1beta1::MsgUpdateParams { + const NAME: &'static str = "MsgUpdateParams"; + const PACKAGE: &'static str = PACKAGE_AUTH; } -impl Name for cosmos::bank::v1beta1::MsgMultiSend { - const NAME: &'static str = "MsgMultiSend"; - const PACKAGE: &'static str = PACKAGE_BANK; +// AUTH query + +impl Name for cosmos::auth::v1beta1::QueryAccountInfoRequest { + const NAME: &'static str = "QueryAccountInfoRequest"; + const PACKAGE: &'static str = PACKAGE_AUTH; } -impl Name for cosmos::bank::v1beta1::MsgUpdateParams { +impl Name for cosmos::auth::v1beta1::QueryAccountRequest { + const NAME: &'static str = "QueryAccountRequest"; + const PACKAGE: &'static str = PACKAGE_AUTH; +} + +impl Name for cosmos::auth::v1beta1::QueryModuleAccountsRequest { + const NAME: &'static str = "QueryModuleAccountsRequest"; + const PACKAGE: &'static str = PACKAGE_AUTH; +} + +impl Name for cosmos::auth::v1beta1::QueryModuleAccountByNameRequest { + const NAME: &'static str = "QueryModuleAccountByNameRequest"; + const PACKAGE: &'static str = PACKAGE_AUTH; +} + +// GOV tx msg + +impl Name for cosmos::gov::v1::MsgSubmitProposal { + const NAME: &'static str = "MsgSubmitProposal"; + const PACKAGE: &'static str = PACKAGE_GOV; +} + +impl Name for cosmos::gov::v1::MsgExecLegacyContent { + const NAME: &'static str = "MsgExecLegacyContent"; + const PACKAGE: &'static str = PACKAGE_GOV; +} + +impl Name for cosmos::gov::v1::MsgVote { + const NAME: &'static str = "MsgVote"; + const PACKAGE: &'static str = PACKAGE_GOV; +} + +impl Name for cosmos::gov::v1::MsgVoteWeighted { + const NAME: &'static str = "MsgVoteWeighted"; + const PACKAGE: &'static str = PACKAGE_GOV; +} + +impl Name for cosmos::gov::v1::MsgDeposit { + const NAME: &'static str = "MsgDeposit"; + const PACKAGE: &'static str = PACKAGE_GOV; +} + +impl Name for cosmos::gov::v1::MsgUpdateParams { const NAME: &'static str = "MsgUpdateParams"; - const PACKAGE: &'static str = PACKAGE_BANK; + const PACKAGE: &'static str = PACKAGE_GOV; } -impl Name for cosmos::bank::v1beta1::MsgSetSendEnabled { - const NAME: &'static str = "MsgSetSendEnabled"; - const PACKAGE: &'static str = PACKAGE_BANK; +// GOV query + +impl Name for cosmos::gov::v1::QueryProposalRequest { + const NAME: &'static str = "QueryProposalRequest"; + const PACKAGE: &'static str = PACKAGE_GOV; +} + +impl Name for cosmos::gov::v1::QueryProposalsRequest { + const NAME: &'static str = "QueryProposalsRequest"; + const PACKAGE: &'static str = PACKAGE_GOV; +} + +impl Name for cosmos::gov::v1::QueryVoteRequest { + const NAME: &'static str = "QueryVoteRequest"; + const PACKAGE: &'static str = PACKAGE_GOV; +} + +impl Name for cosmos::gov::v1::QueryVotesRequest { + const NAME: &'static str = "QueryVotesRequest"; + const PACKAGE: &'static str = PACKAGE_GOV; +} + +impl Name for cosmos::gov::v1::QueryParamsRequest { + const NAME: &'static str = "QueryParamsRequest"; + const PACKAGE: &'static str = PACKAGE_GOV; +} + +impl Name for cosmos::gov::v1::QueryDepositRequest { + const NAME: &'static str = "QueryDepositRequest"; + const PACKAGE: &'static str = PACKAGE_GOV; +} + +impl Name for cosmos::gov::v1::QueryDepositsRequest { + const NAME: &'static str = "QueryDepositsRequest"; + const PACKAGE: &'static str = PACKAGE_GOV; +} + +impl Name for cosmos::gov::v1::QueryTallyResultRequest { + const NAME: &'static str = "QueryTallyResultRequest"; + const PACKAGE: &'static str = PACKAGE_GOV; } #[cfg(test)] diff --git a/nibiru-std/src/proto/type_url_nibiru.rs b/nibiru-std/src/proto/type_url_nibiru.rs index d8685d9..db1f4be 100644 --- a/nibiru-std/src/proto/type_url_nibiru.rs +++ b/nibiru-std/src/proto/type_url_nibiru.rs @@ -6,37 +6,43 @@ use prost::Name; use crate::proto::nibiru; const PACKAGE_TOKENFACTORY: &str = "nibiru.tokenfactory.v1"; +const PACKAGE_ORACLE: &str = "nibiru.oracle.v1"; +const PACKAGE_EPOCHS: &str = "nibiru.epochs.v1"; +const PACKAGE_SPOT: &str = "nibiru.spot.v1"; +const PACKAGE_PERP: &str = "nibiru.perp.v1"; +const PACKAGE_INFLATION: &str = "nibiru.inflation.v1"; +const PACKAGE_DEVGAS: &str = "nibiru.devgas.v1"; +const PACKAGE_SUDO: &str = "nibiru.sudo.v1"; + +// TOKENFACTORY tx msg impl Name for nibiru::tokenfactory::MsgCreateDenom { const NAME: &'static str = "MsgCreateDenom"; const PACKAGE: &'static str = PACKAGE_TOKENFACTORY; } - impl Name for nibiru::tokenfactory::MsgChangeAdmin { const NAME: &'static str = "MsgChangeAdmin"; const PACKAGE: &'static str = PACKAGE_TOKENFACTORY; } - impl Name for nibiru::tokenfactory::MsgUpdateModuleParams { const NAME: &'static str = "MsgUpdateModuleParams"; const PACKAGE: &'static str = PACKAGE_TOKENFACTORY; } - impl Name for nibiru::tokenfactory::MsgMint { const NAME: &'static str = "MsgMint"; const PACKAGE: &'static str = PACKAGE_TOKENFACTORY; } - impl Name for nibiru::tokenfactory::MsgBurn { const NAME: &'static str = "MsgBurn"; const PACKAGE: &'static str = PACKAGE_TOKENFACTORY; } - impl Name for nibiru::tokenfactory::MsgSetDenomMetadata { const NAME: &'static str = "MsgSetDenomMetadata"; const PACKAGE: &'static str = PACKAGE_TOKENFACTORY; } +// TOKENFACTORY query + impl Name for nibiru::tokenfactory::QueryParamsRequest { const NAME: &'static str = "QueryParamsRequest"; const PACKAGE: &'static str = PACKAGE_TOKENFACTORY; @@ -50,82 +56,71 @@ impl Name for nibiru::tokenfactory::QueryDenomInfoRequest { const PACKAGE: &'static str = PACKAGE_TOKENFACTORY; } -const PACKAGE_EPOCHS: &str = "nibiru.epochs.v1"; +// EPOCHS query -impl Name for nibiru::epochs::QueryEpochsInfoRequest { - const NAME: &'static str = "QueryEpochsInfoRequest"; +impl Name for nibiru::epochs::QueryEpochInfosRequest { + const NAME: &'static str = "QueryEpochInfosRequest"; const PACKAGE: &'static str = PACKAGE_EPOCHS; } - impl Name for nibiru::epochs::QueryCurrentEpochRequest { const NAME: &'static str = "QueryCurrentEpochRequest"; const PACKAGE: &'static str = PACKAGE_EPOCHS; } -const PACKAGE_ORACLE: &str = "nibiru.oracle.v1"; +// ORACLE tx msg +// ORACLE query impl Name for nibiru::oracle::QueryExchangeRateRequest { const NAME: &'static str = "QueryExchangeRateRequest"; const PACKAGE: &'static str = PACKAGE_ORACLE; } - // TODO: This type exists but was not exported by the protos. Why? // impl Name for nibiru::oracle::QueryExchangeRateTwapRequest { // const NAME: &'static str = "QueryExchangeRateTwapRequest"; // const PACKAGE: &'static str = PACKAGE_ORACLE; // } - impl Name for nibiru::oracle::QueryExchangeRatesRequest { const NAME: &'static str = "QueryExchangeRatesRequest"; const PACKAGE: &'static str = PACKAGE_ORACLE; } - impl Name for nibiru::oracle::QueryActivesRequest { const NAME: &'static str = "QueryActivesRequest"; const PACKAGE: &'static str = PACKAGE_ORACLE; } - impl Name for nibiru::oracle::QueryVoteTargetsRequest { const NAME: &'static str = "QueryVoteTargetsRequest"; const PACKAGE: &'static str = PACKAGE_ORACLE; } - impl Name for nibiru::oracle::QueryFeederDelegationRequest { const NAME: &'static str = "QueryFeederDelegationRequest"; const PACKAGE: &'static str = PACKAGE_ORACLE; } - impl Name for nibiru::oracle::QueryMissCounterRequest { const NAME: &'static str = "QueryMissCounterRequest"; const PACKAGE: &'static str = PACKAGE_ORACLE; } - impl Name for nibiru::oracle::QueryAggregatePrevoteRequest { const NAME: &'static str = "QueryAggregatePrevoteRequest"; const PACKAGE: &'static str = PACKAGE_ORACLE; } - impl Name for nibiru::oracle::QueryAggregatePrevotesRequest { const NAME: &'static str = "QueryAggregatePrevotesRequest"; const PACKAGE: &'static str = PACKAGE_ORACLE; } - impl Name for nibiru::oracle::QueryAggregateVoteRequest { const NAME: &'static str = "QueryAggregateVoteRequest"; const PACKAGE: &'static str = PACKAGE_ORACLE; } - impl Name for nibiru::oracle::QueryAggregateVotesRequest { const NAME: &'static str = "QueryAggregateVotesRequest"; const PACKAGE: &'static str = PACKAGE_ORACLE; } - impl Name for nibiru::oracle::QueryParamsRequest { const NAME: &'static str = "QueryParamsRequest"; const PACKAGE: &'static str = PACKAGE_ORACLE; } -const PACKAGE_SPOT: &str = "nibiru.spot.v1"; +// SPOT query impl Name for nibiru::spot::QueryParamsRequest { const NAME: &'static str = "QueryParamsRequest"; @@ -192,6 +187,8 @@ impl Name for nibiru::spot::QueryExitExactAmountOutRequest { const PACKAGE: &'static str = PACKAGE_SPOT; } +// SPOT tx msg + impl Name for nibiru::spot::MsgCreatePool { const NAME: &'static str = "MsgCreatePool"; const PACKAGE: &'static str = PACKAGE_SPOT; @@ -209,7 +206,7 @@ impl Name for nibiru::spot::MsgSwapAssets { const PACKAGE: &'static str = PACKAGE_SPOT; } -const PACKAGE_PERP: &str = "nibiru.perp.v1"; +// PERP tx msg impl Name for nibiru::perp::MsgRemoveMargin { const NAME: &'static str = "MsgRemoveMargin"; @@ -239,29 +236,32 @@ impl Name for nibiru::perp::MsgDonateToEcosystemFund { const NAME: &'static str = "MsgDonateToEcosystemFund"; const PACKAGE: &'static str = PACKAGE_PERP; } -// TODO: Msg not included yet in protobuf types: MsgSettlePosition -// impl Name for nibiru::perp::MsgSettlePosition { -// const NAME: &'static str = "MsgSettlePosition"; -// const PACKAGE: &'static str = PACKAGE_PERP; -// } - -// TODO: Msg not included yet in protobuf types: MsgChangeCollateralDenom -// impl Name for nibiru::perp::MsgChangeCollateralDenom { -// const NAME: &'static str = "MsgChangeCollateralDenom"; -// const PACKAGE: &'static str = PACKAGE_PERP; -// } - -// TODO: Msg not included yet in protobuf types: MsgAllocateEpochRebates -// impl Name for nibiru::perp::MsgAllocateEpochRebates { -// const NAME: &'static str = "MsgAllocateEpochRebates"; -// const PACKAGE: &'static str = PACKAGE_PERP; -// } +impl Name for nibiru::perp::MsgSettlePosition { + const NAME: &'static str = "MsgSettlePosition"; + const PACKAGE: &'static str = PACKAGE_PERP; +} +impl Name for nibiru::perp::MsgChangeCollateralDenom { + const NAME: &'static str = "MsgChangeCollateralDenom"; + const PACKAGE: &'static str = PACKAGE_PERP; +} +impl Name for nibiru::perp::MsgAllocateEpochRebates { + const NAME: &'static str = "MsgAllocateEpochRebates"; + const PACKAGE: &'static str = PACKAGE_PERP; +} +impl Name for nibiru::perp::MsgWithdrawEpochRebates { + const NAME: &'static str = "MsgWithdrawEpochRebates"; + const PACKAGE: &'static str = PACKAGE_PERP; +} +impl Name for nibiru::perp::MsgShiftPegMultiplier { + const NAME: &'static str = "MsgShiftPegMultiplier"; + const PACKAGE: &'static str = PACKAGE_PERP; +} +impl Name for nibiru::perp::MsgShiftSwapInvariant { + const NAME: &'static str = "MsgShiftSwapInvariant"; + const PACKAGE: &'static str = PACKAGE_PERP; +} -// TODO: Msg not included yet in protobuf types: MsgWithdrawEpochRebates -// impl Name for nibiru::perp::MsgWithdrawEpochRebates { -// const NAME: &'static str = "MsgWithdrawEpochRebates"; -// const PACKAGE: &'static str = PACKAGE_PERP; -// } +// PERP query impl Name for nibiru::perp::QueryPositionRequest { const NAME: &'static str = "QueryPositionRequest"; @@ -283,11 +283,93 @@ impl Name for nibiru::perp::QueryMarketsRequest { const NAME: &'static str = "QueryMarketsRequest"; const PACKAGE: &'static str = PACKAGE_PERP; } -// TODO: included in v1 but not v0.21 -// impl Name for nibiru::perp::QueryCollateralRequest { -// const NAME: &'static str = "QueryCollateralRequest"; -// const PACKAGE: &'static str = PACKAGE_PERP; -// } +impl Name for nibiru::perp::QueryCollateralRequest { + const NAME: &'static str = "QueryCollateralRequest"; + const PACKAGE: &'static str = PACKAGE_PERP; +} + +// INFLATION query + +impl Name for nibiru::inflation::QueryPeriodRequest { + const NAME: &'static str = "QueryPeriodRequest"; + const PACKAGE: &'static str = PACKAGE_INFLATION; +} +impl Name for nibiru::inflation::QueryEpochMintProvisionRequest { + const NAME: &'static str = "QueryEpochMintProvisionRequest"; + const PACKAGE: &'static str = PACKAGE_INFLATION; +} +impl Name for nibiru::inflation::QuerySkippedEpochsRequest { + const NAME: &'static str = "QuerySkippedEpochsRequest"; + const PACKAGE: &'static str = PACKAGE_INFLATION; +} +impl Name for nibiru::inflation::QueryCirculatingSupplyRequest { + const NAME: &'static str = "QueryCirculatingSupplyRequest"; + const PACKAGE: &'static str = PACKAGE_INFLATION; +} +impl Name for nibiru::inflation::QueryInflationRateRequest { + const NAME: &'static str = "QueryInflationRateRequest"; + const PACKAGE: &'static str = PACKAGE_INFLATION; +} +impl Name for nibiru::inflation::QueryParamsRequest { + const NAME: &'static str = "QueryParamsRequest"; + const PACKAGE: &'static str = PACKAGE_INFLATION; +} + +// DEVGAS tx msg + +impl Name for nibiru::devgas::MsgRegisterFeeShare { + const NAME: &'static str = "MsgRegisterFeeShare"; + const PACKAGE: &'static str = PACKAGE_DEVGAS; +} +impl Name for nibiru::devgas::MsgUpdateFeeShare { + const NAME: &'static str = "MsgUpdateFeeShare"; + const PACKAGE: &'static str = PACKAGE_DEVGAS; +} +impl Name for nibiru::devgas::MsgCancelFeeShare { + const NAME: &'static str = "MsgCancelFeeShare"; + const PACKAGE: &'static str = PACKAGE_DEVGAS; +} +impl Name for nibiru::devgas::MsgUpdateParams { + const NAME: &'static str = "MsgUpdateParams"; + const PACKAGE: &'static str = PACKAGE_DEVGAS; +} + +// DEVGAS query + +impl Name for nibiru::devgas::QueryFeeSharesRequest { + const NAME: &'static str = "QueryFeeSharesRequest"; + const PACKAGE: &'static str = PACKAGE_DEVGAS; +} +impl Name for nibiru::devgas::QueryFeeShareRequest { + const NAME: &'static str = "QueryFeeShareRequest"; + const PACKAGE: &'static str = PACKAGE_DEVGAS; +} +impl Name for nibiru::devgas::QueryParamsRequest { + const NAME: &'static str = "QueryParamsRequest"; + const PACKAGE: &'static str = PACKAGE_DEVGAS; +} +impl Name for nibiru::devgas::QueryFeeSharesByWithdrawerRequest { + const NAME: &'static str = "QueryFeeSharesByWithdrawerRequest"; + const PACKAGE: &'static str = PACKAGE_DEVGAS; +} + +// SUDO tx msg + +impl Name for nibiru::sudo::MsgEditSudoers { + const NAME: &'static str = "MsgEditSudoers"; + const PACKAGE: &'static str = PACKAGE_SUDO; +} +impl Name for nibiru::sudo::MsgChangeRoot { + const NAME: &'static str = "MsgChangeRoot"; + const PACKAGE: &'static str = PACKAGE_SUDO; +} + +// SUDO query + +impl Name for nibiru::sudo::QuerySudoersRequest { + const NAME: &'static str = "QuerySudoersRequest"; + const PACKAGE: &'static str = PACKAGE_SUDO; +} #[cfg(test)] pub mod tests { diff --git a/nibiru-std/src/tutil/mod.rs b/nibiru-std/src/tutil/mod.rs new file mode 100644 index 0000000..5afacd7 --- /dev/null +++ b/nibiru-std/src/tutil/mod.rs @@ -0,0 +1 @@ +//! tutil/mod.rs: Testing utilities for Nibiru smart contracts. diff --git a/packages/core-controller/.cargo/config b/packages/core-controller/.cargo/config new file mode 100644 index 0000000..b613a59 --- /dev/null +++ b/packages/core-controller/.cargo/config @@ -0,0 +1,4 @@ +[alias] +wasm = "build --release --target wasm32-unknown-unknown" +wasm-debug = "build --target wasm32-unknown-unknown" +schema = "run --example schema" diff --git a/contracts/core-controller/Cargo.lock b/packages/core-controller/Cargo.lock similarity index 100% rename from contracts/core-controller/Cargo.lock rename to packages/core-controller/Cargo.lock diff --git a/contracts/core-controller/Cargo.toml b/packages/core-controller/Cargo.toml similarity index 95% rename from contracts/core-controller/Cargo.toml rename to packages/core-controller/Cargo.toml index e2c3c5f..0d851b9 100644 --- a/contracts/core-controller/Cargo.toml +++ b/packages/core-controller/Cargo.toml @@ -19,7 +19,6 @@ cosmwasm-std = { workspace = true } cosmwasm-schema = { workspace = true } cw-storage-plus = { workspace = true } nibiru-std = { workspace = true } -nibiru-macro = { workspace = true } thiserror = { workspace = true } schemars = "0.8.15" serde = { version = "1.0.188", default-features = false, features = ["derive"] } diff --git a/contracts/core-controller/src/contract.rs b/packages/core-controller/src/contract.rs similarity index 78% rename from contracts/core-controller/src/contract.rs rename to packages/core-controller/src/contract.rs index 67e60fa..8507841 100644 --- a/contracts/core-controller/src/contract.rs +++ b/packages/core-controller/src/contract.rs @@ -1,10 +1,7 @@ -use cosmwasm_schema::cw_serde; use cosmwasm_std::{ - attr, entry_point, Binary, CosmosMsg, CustomMsg, Deps, DepsMut, Env, - MessageInfo, Response, StdResult, + attr, entry_point, Binary, Deps, DepsMut, Env, MessageInfo, Response, + StdResult, }; -use nibiru_macro::cw_custom; -use nibiru_std::bindings::msg::NibiruRoute; use crate::{ msgs::{ExecuteMsg, InitMsg, IsMemberResponse, QueryMsg, WhitelistResponse}, @@ -46,59 +43,42 @@ fn check_member(can: CanExecute) -> Result<(), cosmwasm_std::StdError> { } } -/// ExecuteResponse allows the execute entry point to return different response -/// types depending on the input. This is possible because we wrap the Response -/// type with variants of ExecuteResponse. These variants store a Response type. -/// -/// In CosmWasm, there are multiple entry points for handling different message -/// types, such as instantiate, execute, query, sudo, and migrate. However, -/// each entry point returns a single type of response. You cannot have multiple -/// entry points return different returning different response types for the -/// same message type. Ref: https://book.cosmwasm.com/basics/entry-points.html -#[cw_serde] -#[cw_custom] -pub struct ContractExecMsg { - pub route: NibiruRoute, - pub msg: Option, -} - #[entry_point] pub fn execute( deps: DepsMut, _env: Env, info: MessageInfo, msg: ExecuteMsg, -) -> StdResult> { +) -> StdResult { let deps_for_check = &deps; let check: CanExecute = can_execute(deps_for_check.as_ref(), info.sender.as_ref())?; let mut whitelist = check.whitelist.clone(); match msg { + #[allow(unused_variables, deprecated, unreachable_code)] ExecuteMsg::InsuranceFundWithdraw { amount, to } => { check_member(check)?; - let cw_msg = ContractExecMsg { - route: NibiruRoute::Perp, - msg: Some(ExecuteMsg::InsuranceFundWithdraw { amount, to }), - }; - let res = Response::new() - .add_message(cw_msg) - .add_attributes(vec![attr("action", "insurance_fund_withdraw")]); - Ok(res) + todo!(); + let _cw_msg = ExecuteMsg::InsuranceFundWithdraw { amount, to }; + // let res = Response::new() + // .add_message(cw_msg) + // .add_attributes(vec![attr("action", "insurance_fund_withdraw")]); + // Ok(res) } + #[allow(unused_variables, deprecated, unreachable_code)] ExecuteMsg::SetMarketEnabled { pair, enabled } => { check_member(check)?; - let cw_msg = ContractExecMsg { - route: NibiruRoute::Perp, - msg: Some(ExecuteMsg::SetMarketEnabled { pair, enabled }), - }; - let res = Response::new() - .add_message(cw_msg) - .add_attributes(vec![attr("action", "toggle_market_enabled")]); - Ok(res) + todo!(); + let _cw_msg = ExecuteMsg::SetMarketEnabled { pair, enabled }; + // let res = Response::new() + // .add_message(cw_msg) + // .add_attributes(vec![attr("action", "toggle_market_enabled")]); + // Ok(res) } + #[allow(unused_variables, deprecated, unreachable_code)] ExecuteMsg::CreateMarket { pair, peg_mult, @@ -106,21 +86,20 @@ pub fn execute( market_params, } => { check_member(check)?; - let cw_msg = ContractExecMsg { - route: NibiruRoute::Perp, - msg: Some(ExecuteMsg::CreateMarket { - pair, - peg_mult, - sqrt_depth, - market_params, - }), + todo!(); + let _cw_msg = ExecuteMsg::CreateMarket { + pair, + peg_mult, + sqrt_depth, + market_params, }; - let res = Response::new() - .add_message(cw_msg) - .add_attributes(vec![attr("action", "create_market")]); - Ok(res) + // let res = Response::new() + // .add_message(cw_msg) + // .add_attributes(vec![attr("action", "create_market")]); + // Ok(res) } + #[allow(unused_variables, deprecated, unreachable_code)] ExecuteMsg::EditOracleParams { vote_period, vote_threshold, @@ -134,25 +113,23 @@ pub fn execute( validator_fee_ratio, } => { check_member(check)?; - let cw_msg = ContractExecMsg { - route: NibiruRoute::Oracle, - msg: Some(ExecuteMsg::EditOracleParams { - vote_period, - vote_threshold, - reward_band, - whitelist, - slash_fraction, - slash_window, - min_valid_per_window, - twap_lookback_window, - min_voters, - validator_fee_ratio, - }), + todo!(); + let _cw_msg = ExecuteMsg::EditOracleParams { + vote_period, + vote_threshold, + reward_band, + whitelist, + slash_fraction, + slash_window, + min_valid_per_window, + twap_lookback_window, + min_voters, + validator_fee_ratio, }; - let res = Response::new() - .add_message(cw_msg) - .add_attributes(vec![attr("action", "edit_oracle")]); - Ok(res) + // let res = Response::new() + // .add_message(cw_msg) + // .add_attributes(vec![attr("action", "edit_oracle")]); + // Ok(res) } ExecuteMsg::AddMember { address } => { @@ -162,11 +139,7 @@ pub fn execute( whitelist.members.insert(addr.into_string()); WHITELIST.save(deps.storage, &whitelist)?; - let cw_msg = ContractExecMsg { - route: NibiruRoute::NoOp, - msg: None, - }; - let res = Response::new().add_message(cw_msg).add_attributes(vec![ + let res = Response::new().add_attributes(vec![ attr("action", "add_member"), attr("address", address), ]); @@ -178,11 +151,7 @@ pub fn execute( whitelist.members.remove(address.as_str()); WHITELIST.save(deps.storage, &whitelist)?; - let cw_msg = ContractExecMsg { - route: NibiruRoute::NoOp, - msg: None, - }; - let res = Response::new().add_message(cw_msg).add_attributes(vec![ + let res = Response::new().add_attributes(vec![ attr("action", "remove_member"), attr("address", address), ]); @@ -197,11 +166,7 @@ pub fn execute( whitelist.members.insert(new_admin.to_string()); WHITELIST.save(deps.storage, &whitelist)?; - let cw_msg = ContractExecMsg { - route: NibiruRoute::NoOp, - msg: None, - }; - let res = Response::new().add_message(cw_msg).add_attributes(vec![ + let res = Response::new().add_attributes(vec![ attr("action", "change_admin"), attr("address", address), ]); @@ -350,10 +315,10 @@ mod tests { }; let execute_info = testing::mock_info(admin.as_str(), &[]); - let check_resp = |resp: Response| { + let check_resp = |resp: Response| { assert_eq!( resp.messages.len(), - 1, + 0, "resp.messages: {:?}", resp.messages ); @@ -421,10 +386,10 @@ mod tests { address: "satoshi".to_string(), }; let execute_info = testing::mock_info(admin.as_str(), &[]); - let check_resp = |resp: Response| { + let check_resp = |resp: Response| { assert_eq!( resp.messages.len(), - 1, + 0, "resp.messages: {:?}", resp.messages ); @@ -485,10 +450,10 @@ mod tests { }; let execute_info = testing::mock_info(admin.as_str(), &[]); - let check_resp = |resp: Response| { + let check_resp = |resp: Response| { assert_eq!( resp.messages.len(), - 1, + 0, "resp.messages: {:?}", resp.messages ); diff --git a/contracts/core-controller/src/lib.rs b/packages/core-controller/src/lib.rs similarity index 100% rename from contracts/core-controller/src/lib.rs rename to packages/core-controller/src/lib.rs diff --git a/contracts/core-controller/src/msgs.rs b/packages/core-controller/src/msgs.rs similarity index 91% rename from contracts/core-controller/src/msgs.rs rename to packages/core-controller/src/msgs.rs index bbcc9fd..5dcb304 100644 --- a/contracts/core-controller/src/msgs.rs +++ b/packages/core-controller/src/msgs.rs @@ -1,3 +1,4 @@ +#![allow(deprecated)] use cosmwasm_schema::cw_serde; use cosmwasm_std::{Decimal, Uint256, Uint64}; @@ -12,14 +13,17 @@ pub struct InitMsg { /// ExecuteMsg specifies the args for the execute entry point of the contract. #[cw_serde] pub enum ExecuteMsg { + #[deprecated(note = "Needs MsgServer impl added to NibiruChain/nibiru")] SetMarketEnabled { pair: String, enabled: bool, }, + #[deprecated(note = "Needs MsgServer impl added to NibiruChain/nibiru")] InsuranceFundWithdraw { amount: Uint256, to: String, }, + #[deprecated(note = "Needs MsgServer impl added to NibiruChain/nibiru")] EditOracleParams { vote_period: Option, vote_threshold: Option, @@ -32,6 +36,7 @@ pub enum ExecuteMsg { min_voters: Option, validator_fee_ratio: Option, }, + #[deprecated(note = "Needs MsgServer impl added to NibiruChain/nibiru")] CreateMarket { pair: String, peg_mult: Decimal, diff --git a/contracts/core-controller/src/state.rs b/packages/core-controller/src/state.rs similarity index 100% rename from contracts/core-controller/src/state.rs rename to packages/core-controller/src/state.rs diff --git a/scripts/proto_clean.rs b/scripts/proto_clean.rs index e48e0fa..ddbeeac 100644 --- a/scripts/proto_clean.rs +++ b/scripts/proto_clean.rs @@ -12,6 +12,8 @@ /// on the classification. /// 4. Write the modified content back to each file. +pub static PROTO_PATH: &str = "../nibiru-std/src/proto/buf"; + pub fn main() { println!("Running proto_clean.rs..."); @@ -21,7 +23,10 @@ pub fn main() { .filter_map(|e| e.ok()) // filter out directories .filter(|e| !e.file_type().is_dir()) - .filter(|e| e.file_name().to_string_lossy().starts_with("cosmos")) + .filter(|e| { + e.file_name().to_string_lossy().starts_with("cosmos") + || e.file_name().to_string_lossy().starts_with("nibiru") + }) { // Get the path of the file we're going to clean. let path_to_clean = entry.path().to_string_lossy(); @@ -100,14 +105,18 @@ pub fn super_import_to_clean( let elem = elems[submodule_idx]; let prefix: &str; - if proto_submodules::is_cosmos_submod(elem) { + if proto_submodules::is_submod_cosmos(elem) { prefix = "crate::proto::cosmos" - } else if proto_submodules::is_tendermint_submod(elem) { + } else if proto_submodules::is_mod_tendermint(elem) + || proto_submodules::is_mod_cosmos(elem) + { prefix = "crate::proto" - } else if proto_submodules::is_cosmos_base_submod(elem) { + } else if proto_submodules::is_submod_cosmos_base(elem) { prefix = "crate::proto::cosmos::base" - } else if proto_submodules::is_cosmos_tx_submod(elem) { + } else if proto_submodules::is_submod_cosmos_tx(elem) { prefix = "crate::proto::cosmos::tx" + } else if proto_submodules::is_submod_cosmos_crypto(elem) { + prefix = "crate::proto::cosmos::crypto" } else { return Err(Box::new(CustomError(format!( "Unrecognized import submodule: {}", @@ -121,22 +130,26 @@ pub fn super_import_to_clean( mod proto_submodules { - pub fn is_cosmos_submod(s: &str) -> bool { + pub fn is_submod_cosmos(s: &str) -> bool { COSMOS.contains(&s) } - pub fn is_tendermint_submod(s: &str) -> bool { + pub fn is_mod_tendermint(s: &str) -> bool { TENDERMINT.contains(&s) } - pub fn is_cosmos_base_submod(s: &str) -> bool { + pub fn is_submod_cosmos_base(s: &str) -> bool { matches!(s, "query") } - pub fn is_cosmos_tx_submod(s: &str) -> bool { + pub fn is_submod_cosmos_tx(s: &str) -> bool { matches!(s, "signing") } + pub fn is_mod_cosmos(s: &str) -> bool { + matches!(s, "cosmos") + } + pub static COSMOS: [&str; 25] = [ "base", "bank", @@ -165,11 +178,23 @@ mod proto_submodules { "vesting", ]; + /// COSMOS_CRYPTO: Names of the proto packages: cosmos.crypto.* + pub static COSMOS_CRYPTO: [&str; 6] = [ + "ed25519", + "hd", + "keyring", + "multisig", + "secp256k1", + "secp256r1", + ]; + + pub fn is_submod_cosmos_crypto(s: &str) -> bool { + COSMOS_CRYPTO.contains(&s) + } + pub static TENDERMINT: [&str; 1] = ["tendermint"]; } -pub static PROTO_PATH: &str = "../nibiru-std/src/proto/buf"; - #[cfg(test)] mod tests { use std::fs; @@ -199,6 +224,18 @@ mod tests { want_err: true, want_out: None, }, + TestCase { + input: "super::super::super::hd::v1::Bip69Params", + want_err: false, + want_out: Some( + "crate::proto::cosmos::crypto::hd::v1::Bip69Params", + ), + }, + TestCase { + input: "super::super::cosmos::base::v1beta1::Coin", + want_err: false, + want_out: Some("crate::proto::cosmos::base::v1beta1::Coin"), + }, ]; for (i, test_case) in test_cases.iter().enumerate() {