diff --git a/Cargo.lock b/Cargo.lock index 053c799b..30ce6899 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,16 +13,31 @@ dependencies = [ "version_check", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" [[package]] name = "astroport" version = "2.0.0" -source = "git+https://github.com/neutron-org/neutron-tge-contracts.git?branch=main#2dc53b4f011bd8c0de838f9e76345a6766620464" +source = "git+https://github.com/neutron-org/neutron-tge-contracts.git?branch=main#127d9f844e325029ba61fa776555f7bb7d9b85c3" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -48,7 +63,7 @@ dependencies = [ [[package]] name = "astroport" version = "2.0.0" -source = "git+https://github.com/neutron-org/neutron-tge-contracts.git#2dc53b4f011bd8c0de838f9e76345a6766620464" +source = "git+https://github.com/neutron-org/neutron-tge-contracts.git#127d9f844e325029ba61fa776555f7bb7d9b85c3" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -86,6 +101,34 @@ dependencies = [ "uint", ] +[[package]] +name = "astroport" +version = "3.11.0" +source = "git+https://github.com/astroport-fi/astroport-core.git?tag=v3.11.0#d6adad9bcbf5df75ea503601115de7a1aed501db" +dependencies = [ + "astroport-circular-buffer", + "cosmwasm-schema", + "cosmwasm-std", + "cw-asset", + "cw-storage-plus 0.15.1", + "cw-utils 1.0.3", + "cw20 0.15.1", + "cw3 1.1.2", + "itertools 0.10.5", + "uint", +] + +[[package]] +name = "astroport-circular-buffer" +version = "0.1.0" +source = "git+https://github.com/astroport-fi/astroport-core.git?tag=v3.11.0#d6adad9bcbf5df75ea503601115de7a1aed501db" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 0.15.1", + "thiserror", +] + [[package]] name = "astroport-factory" version = "1.5.1" @@ -121,9 +164,9 @@ dependencies = [ [[package]] name = "astroport-periphery" version = "1.1.0" -source = "git+https://github.com/neutron-org/neutron-tge-contracts.git?branch=main#2dc53b4f011bd8c0de838f9e76345a6766620464" +source = "git+https://github.com/neutron-org/neutron-tge-contracts.git?branch=main#127d9f844e325029ba61fa776555f7bb7d9b85c3" dependencies = [ - "astroport 2.5.0", + "astroport 3.11.0", "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 0.15.1", @@ -164,9 +207,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "base16ct" @@ -186,6 +229,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "base64ct" version = "1.6.0" @@ -222,6 +271,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56953345e39537a3e18bdaeba4cb0c58a78c1f61f361dc0fa7c5c7340ae87c5f" +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + [[package]] name = "byteorder" version = "1.5.0" @@ -237,34 +292,59 @@ dependencies = [ "serde", ] +[[package]] +name = "cc" +version = "1.0.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" + [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "windows-targets", +] + [[package]] name = "const-oid" version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + [[package]] name = "cosmos-sdk-proto" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32560304ab4c365791fd307282f76637213d8083c1a98490c35159cd67852237" dependencies = [ - "prost 0.12.3", + "prost 0.12.4", "prost-types", "tendermint-proto", ] [[package]] name = "cosmwasm-crypto" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9934c79e58d9676edfd592557dee765d2a6ef54c09d5aa2edb06156b00148966" +checksum = "e6b4c3f9c4616d6413d4b5fc4c270a4cc32a374b9be08671e80e1a019f805d8f" dependencies = [ "digest 0.10.7", "ecdsa 0.16.9", @@ -276,18 +356,18 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5e72e330bd3bdab11c52b5ecbdeb6a8697a004c57964caeb5d876f0b088b3c" +checksum = "c586ced10c3b00e809ee664a895025a024f60d65d34fe4c09daed4a4db68a3f3" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e3a2136e2a60e8b6582f5dffca5d1a683ed77bf38537d330bc1dfccd69010" +checksum = "8467874827d384c131955ff6f4d47d02e72a956a08eb3c0ff24f8c903a5517b4" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -298,9 +378,9 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5d803bea6bd9ed61bd1ee0b4a2eb09ee20dbb539cc6e0b8795614d20952ebb1" +checksum = "f6db85d98ac80922aef465e564d5b21fa9cfac5058cb62df7f116c3682337393" dependencies = [ "proc-macro2", "quote", @@ -309,11 +389,11 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8666e572a3a2519010dde88c04d16e9339ae751b56b2bb35081fe3f7d6be74" +checksum = "712fe58f39d55c812f7b2c84e097cdede3a39d520f89b6dc3153837e31741927" dependencies = [ - "base64", + "base64 0.21.7", "bech32", "bnum", "cosmwasm-crypto", @@ -433,6 +513,20 @@ dependencies = [ "cosmwasm-std", ] +[[package]] +name = "cw-asset" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c999a12f8cd8736f6f86e9a4ede5905530cb23cfdef946b9da1c506ad1b70799" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-address-like", + "cw-storage-plus 1.2.0", + "cw20 1.1.2", + "thiserror", +] + [[package]] name = "cw-controllers" version = "1.1.2" @@ -981,7 +1075,7 @@ dependencies = [ "cw721 0.18.0", "cwd-interface", "cwd-macros", - "neutron-sdk", + "neutron-sdk 0.10.0", "neutron-subdao-core", "schemars", "serde", @@ -1063,7 +1157,7 @@ dependencies = [ "cwd-proposal-hooks", "cwd-proposal-single", "cwd-voting", - "neutron-sdk", + "neutron-sdk 0.10.0", "schemars", "serde", ] @@ -1085,7 +1179,7 @@ dependencies = [ "cwd-proposal-single", "cwd-voting", "neutron-dao-pre-propose-overrule", - "neutron-sdk", + "neutron-sdk 0.10.0", "neutron-subdao-core", "neutron-subdao-timelock-single", "schemars", @@ -1112,7 +1206,7 @@ dependencies = [ "cwd-proposal-hooks", "cwd-proposal-single", "cwd-voting", - "neutron-sdk", + "neutron-sdk 0.10.0", "schemars", "serde", ] @@ -1157,7 +1251,7 @@ dependencies = [ "cwd-testing", "cwd-vote-hooks", "cwd-voting", - "neutron-sdk", + "neutron-sdk 0.10.0", "neutron-vault", "neutron-voting-registry", "rand", @@ -1196,7 +1290,7 @@ dependencies = [ "cwd-testing", "cwd-vote-hooks", "cwd-voting", - "neutron-sdk", + "neutron-sdk 0.10.0", "neutron-subdao-core", "neutron-vault", "neutron-voting-registry", @@ -1220,7 +1314,7 @@ dependencies = [ "cwd-interface", "cwd-pre-propose-base", "cwd-voting", - "neutron-sdk", + "neutron-sdk 0.10.0", "neutron-security-subdao-pre-propose", "neutron-subdao-core", "neutron-subdao-proposal-single", @@ -1247,7 +1341,7 @@ dependencies = [ "cwd-macros", "cwd-voting", "exec-control", - "neutron-sdk", + "neutron-sdk 0.10.0", "neutron-subdao-core", "neutron-subdao-pre-propose-single", "neutron-subdao-proposal-single", @@ -1270,7 +1364,7 @@ dependencies = [ "cwd-interface", "cwd-pre-propose-base", "cwd-voting", - "neutron-sdk", + "neutron-sdk 0.10.0", "neutron-subdao-core", "neutron-subdao-pre-propose-single", "neutron-subdao-proposal-single", @@ -1306,7 +1400,7 @@ dependencies = [ "cwd-subdao-pre-propose-single", "cwd-vote-hooks", "cwd-voting", - "neutron-sdk", + "neutron-sdk 0.10.0", "neutron-subdao-core", "neutron-subdao-pre-propose-single", "neutron-subdao-proposal-single", @@ -1335,7 +1429,7 @@ dependencies = [ "cwd-proposal-single", "cwd-voting", "neutron-dao-pre-propose-overrule", - "neutron-sdk", + "neutron-sdk 0.10.0", "neutron-subdao-core", "neutron-subdao-pre-propose-single", "neutron-subdao-proposal-single", @@ -1397,12 +1491,47 @@ dependencies = [ "cwd-core", "cwd-interface", "cwd-macros", - "neutron-sdk", + "neutron-sdk 0.10.0", "schemars", "serde", "thiserror", ] +[[package]] +name = "darling" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.60", +] + +[[package]] +name = "darling_macro" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.60", +] + [[package]] name = "der" version = "0.6.1" @@ -1415,9 +1544,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "zeroize", @@ -1430,6 +1559,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", + "serde", ] [[package]] @@ -1494,7 +1624,7 @@ version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ - "der 0.7.8", + "der 0.7.9", "digest 0.10.7", "elliptic-curve 0.13.8", "rfc6979 0.4.0", @@ -1509,7 +1639,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", @@ -1519,9 +1649,9 @@ dependencies = [ [[package]] name = "either" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "elliptic-curve" @@ -1562,6 +1692,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "exec-control" version = "0.1.0" @@ -1601,6 +1737,12 @@ dependencies = [ "paste", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "forward_ref" version = "1.0.0" @@ -1620,9 +1762,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -1660,6 +1802,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + [[package]] name = "heck" version = "0.4.1" @@ -1681,6 +1829,35 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "iana-time-zone" +version = "0.1.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "indexable-hooks" version = "0.1.0" @@ -1693,6 +1870,28 @@ dependencies = [ "thiserror", ] +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", + "serde", +] + [[package]] name = "investors-vesting-vault" version = "0.2.1" @@ -1735,12 +1934,30 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +[[package]] +name = "js-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +dependencies = [ + "wasm-bindgen", +] + [[package]] name = "k256" version = "0.11.6" @@ -1769,9 +1986,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] name = "lockdrop-vault" @@ -1817,6 +2034,37 @@ dependencies = [ "thiserror", ] +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "neutron-chain-manager" +version = "0.3.0" +dependencies = [ + "anyhow", + "cosmwasm-schema", + "cosmwasm-std", + "cosmwasm-storage", + "cw-controllers", + "cw-multi-test", + "cw-paginate 0.2.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.3", + "cw2 1.1.2", + "cwd-interface", + "cwd-macros", + "neutron-sdk 0.8.0", + "prost 0.9.0", + "schemars", + "serde", + "serde-json-wasm 1.0.1", + "serde_with", + "thiserror", +] + [[package]] name = "neutron-dao-pre-propose-overrule" version = "0.1.0" @@ -1892,12 +2140,33 @@ dependencies = [ "cw20 0.13.4", "cwd-macros", "exec-control", - "neutron-sdk", + "neutron-sdk 0.10.0", "schemars", "serde", "thiserror", ] +[[package]] +name = "neutron-sdk" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46f60e477bd71007d9ff78ae020ec1c6b3b47798578af6151429434d86472efc" +dependencies = [ + "bech32", + "cosmos-sdk-proto", + "cosmwasm-schema", + "cosmwasm-std", + "prost 0.12.4", + "prost-types", + "protobuf 3.4.0", + "schemars", + "serde", + "serde-json-wasm 1.0.1", + "speedate", + "tendermint-proto", + "thiserror", +] + [[package]] name = "neutron-sdk" version = "0.10.0" @@ -1908,7 +2177,7 @@ dependencies = [ "cosmos-sdk-proto", "cosmwasm-schema", "cosmwasm-std", - "prost 0.12.3", + "prost 0.12.4", "prost-types", "protobuf 3.4.0", "schemars", @@ -1929,7 +2198,7 @@ dependencies = [ "cwd-interface", "cwd-pre-propose-base", "cwd-voting", - "neutron-sdk", + "neutron-sdk 0.10.0", "schemars", "serde", ] @@ -1945,7 +2214,7 @@ dependencies = [ "cwd-interface", "cwd-macros", "exec-control", - "neutron-sdk", + "neutron-sdk 0.10.0", "schemars", "serde", "thiserror", @@ -1959,7 +2228,7 @@ dependencies = [ "cwd-interface", "cwd-pre-propose-base", "cwd-voting", - "neutron-sdk", + "neutron-sdk 0.10.0", "schemars", "serde", ] @@ -1975,7 +2244,7 @@ dependencies = [ "cwd-interface", "cwd-macros", "cwd-voting", - "neutron-sdk", + "neutron-sdk 0.10.0", "schemars", "serde", ] @@ -1986,7 +2255,7 @@ version = "0.1.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "neutron-sdk", + "neutron-sdk 0.10.0", "schemars", "serde", ] @@ -2088,9 +2357,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -2129,7 +2398,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ - "der 0.7.8", + "der 0.7.9", "spki 0.7.3", ] @@ -2147,9 +2416,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] @@ -2177,12 +2446,12 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" +checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" dependencies = [ "bytes", - "prost-derive 0.12.3", + "prost-derive 0.12.4", ] [[package]] @@ -2200,24 +2469,24 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" +checksum = "19de2de2a00075bf566bee3bd4db014b11587e84184d3f7a791bc17f1a8e9e48" dependencies = [ "anyhow", - "itertools 0.11.0", + "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.60", ] [[package]] name = "prost-types" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" +checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" dependencies = [ - "prost 0.12.3", + "prost 0.12.4", ] [[package]] @@ -2251,9 +2520,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -2317,9 +2586,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" [[package]] name = "ryu" @@ -2329,9 +2598,9 @@ checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "schemars" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29" +checksum = "fc6e7ed6919cb46507fb01ff1654309219f62b4d603822501b0b80d42f6f21ef" dependencies = [ "dyn-clone", "schemars_derive", @@ -2341,14 +2610,14 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967" +checksum = "185f2b7aa7e02d418e453790dde16890256bbd2bcd04b7dc5348811052b53f49" dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 1.0.109", + "syn 2.0.60", ] [[package]] @@ -2372,7 +2641,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct 0.2.0", - "der 0.7.8", + "der 0.7.9", "generic-array", "pkcs8 0.10.2", "subtle", @@ -2387,9 +2656,9 @@ checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "serde" -version = "1.0.197" +version = "1.0.200" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" dependencies = [ "serde_derive", ] @@ -2423,37 +2692,67 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.200" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.60", ] [[package]] name = "serde_derive_internals" -version = "0.26.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" +checksum = "330f01ce65a3a5fe59a60c82f3c9a024b573b8a6e875bd233fe5f934e71d54e3" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.60", ] [[package]] name = "serde_json" -version = "1.0.115" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" +checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" dependencies = [ "itoa", "ryu", "serde", ] +[[package]] +name = "serde_with" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.2.6", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.60", +] + [[package]] name = "sha2" version = "0.9.9" @@ -2546,7 +2845,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", - "der 0.7.8", + "der 0.7.9", ] [[package]] @@ -2555,6 +2854,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "strum" version = "0.25.0" @@ -2574,7 +2879,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.55", + "syn 2.0.60", ] [[package]] @@ -2605,9 +2910,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.55" +version = "2.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" +checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" dependencies = [ "proc-macro2", "quote", @@ -2624,7 +2929,7 @@ dependencies = [ "flex-error", "num-derive", "num-traits", - "prost 0.12.3", + "prost 0.12.4", "prost-types", "serde", "serde_bytes", @@ -2649,33 +2954,35 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.60", ] [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", + "itoa", "num-conv", "powerfmt", + "serde", "time-core", "time-macros", ] @@ -2688,9 +2995,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", @@ -2729,14 +3036,14 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "vesting-base" version = "1.1.0" -source = "git+https://github.com/neutron-org/neutron-tge-contracts.git?branch=main#2dc53b4f011bd8c0de838f9e76345a6766620464" +source = "git+https://github.com/neutron-org/neutron-tge-contracts.git?branch=main#127d9f844e325029ba61fa776555f7bb7d9b85c3" dependencies = [ "astroport 2.0.0 (git+https://github.com/neutron-org/neutron-tge-contracts.git?branch=main)", "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 1.2.0", "cw-utils 0.15.1", - "cw20 1.1.2", + "cw20 0.15.1", "thiserror", ] @@ -2759,41 +3066,57 @@ dependencies = [ [[package]] name = "vesting-base" version = "1.1.0" -source = "git+https://github.com/neutron-org/neutron-tge-contracts.git#2dc53b4f011bd8c0de838f9e76345a6766620464" +source = "git+https://github.com/neutron-org/neutron-tge-contracts.git#127d9f844e325029ba61fa776555f7bb7d9b85c3" dependencies = [ "astroport 2.0.0 (git+https://github.com/neutron-org/neutron-tge-contracts.git)", "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 1.2.0", "cw-utils 0.15.1", - "cw20 1.1.2", + "cw20 0.15.1", "thiserror", ] [[package]] name = "vesting-lp" version = "1.1.0" -source = "git+https://github.com/neutron-org/neutron-tge-contracts.git?branch=main#2dc53b4f011bd8c0de838f9e76345a6766620464" +source = "git+https://github.com/neutron-org/neutron-tge-contracts.git?rev=e306308dd23d567399c15d899f295a910ede945b#e306308dd23d567399c15d899f295a910ede945b" +dependencies = [ + "astroport 2.0.0 (git+https://github.com/neutron-org/neutron-tge-contracts.git?rev=e306308dd23d567399c15d899f295a910ede945b)", + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 0.15.1", + "cw2 0.15.1", + "vesting-base 1.1.0 (git+https://github.com/neutron-org/neutron-tge-contracts.git?rev=e306308dd23d567399c15d899f295a910ede945b)", +] + +[[package]] +name = "vesting-lp" +version = "1.2.0" +source = "git+https://github.com/neutron-org/neutron-tge-contracts.git?branch=main#127d9f844e325029ba61fa776555f7bb7d9b85c3" dependencies = [ "astroport 2.0.0 (git+https://github.com/neutron-org/neutron-tge-contracts.git?branch=main)", "cosmwasm-schema", "cosmwasm-std", - "cw2 1.1.2", - "cw20 1.1.2", + "cw-storage-plus 0.15.1", + "cw2 0.15.1", + "cw20 0.15.1", "vesting-base 1.1.0 (git+https://github.com/neutron-org/neutron-tge-contracts.git?branch=main)", + "vesting-lp-pcl", ] [[package]] -name = "vesting-lp" +name = "vesting-lp-pcl" version = "1.1.0" -source = "git+https://github.com/neutron-org/neutron-tge-contracts.git?rev=e306308dd23d567399c15d899f295a910ede945b#e306308dd23d567399c15d899f295a910ede945b" +source = "git+https://github.com/neutron-org/neutron-tge-contracts.git?branch=main#127d9f844e325029ba61fa776555f7bb7d9b85c3" dependencies = [ - "astroport 2.0.0 (git+https://github.com/neutron-org/neutron-tge-contracts.git?rev=e306308dd23d567399c15d899f295a910ede945b)", + "astroport 2.0.0 (git+https://github.com/neutron-org/neutron-tge-contracts.git?branch=main)", "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 0.15.1", - "cw2 0.15.1", - "vesting-base 1.1.0 (git+https://github.com/neutron-org/neutron-tge-contracts.git?rev=e306308dd23d567399c15d899f295a910ede945b)", + "cw2 1.1.2", + "cw20 0.15.1", + "vesting-base 1.1.0 (git+https://github.com/neutron-org/neutron-tge-contracts.git?branch=main)", ] [[package]] @@ -2814,7 +3137,7 @@ dependencies = [ "serde", "thiserror", "vesting-base 1.1.0 (git+https://github.com/neutron-org/neutron-tge-contracts.git?branch=main)", - "vesting-lp 1.1.0 (git+https://github.com/neutron-org/neutron-tge-contracts.git?branch=main)", + "vesting-lp 1.2.0", ] [[package]] @@ -2839,7 +3162,7 @@ dependencies = [ "serde", "thiserror", "vesting-base 1.1.0 (git+https://github.com/neutron-org/neutron-tge-contracts.git?rev=e306308dd23d567399c15d899f295a910ede945b)", - "vesting-lp 1.1.0 (git+https://github.com/neutron-org/neutron-tge-contracts.git?rev=e306308dd23d567399c15d899f295a910ede945b)", + "vesting-lp 1.1.0", ] [[package]] @@ -2870,6 +3193,133 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasm-bindgen" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.60", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.60", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + [[package]] name = "zeroize" version = "1.7.0" diff --git a/Cargo.toml b/Cargo.toml index eeae4e0f..c4e12f08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [workspace] members = [ "contracts/dao/cwd-core", + "contracts/dao/neutron-chain-manager", "contracts/dao/proposal/*", "contracts/dao/pre-propose/*", "contracts/dao/voting/*", diff --git a/contracts/dao/neutron-chain-manager/.cargo/config b/contracts/dao/neutron-chain-manager/.cargo/config new file mode 100644 index 00000000..19cfdc6d --- /dev/null +++ b/contracts/dao/neutron-chain-manager/.cargo/config @@ -0,0 +1,4 @@ +[alias] +wasm = "build --release --target wasm32-unknown-unknown" +unit-test = "test --lib" +schema = "run --example neutron-chain-manager_schema" diff --git a/contracts/dao/neutron-chain-manager/.gitignore b/contracts/dao/neutron-chain-manager/.gitignore new file mode 100644 index 00000000..dfdaaa6b --- /dev/null +++ b/contracts/dao/neutron-chain-manager/.gitignore @@ -0,0 +1,15 @@ +# Build results +/target + +# Cargo+Git helper file (https://github.com/rust-lang/cargo/blob/0.44.1/src/cargo/sources/git/utils.rs#L320-L327) +.cargo-ok + +# Text file backups +**/*.rs.bk + +# macOS +.DS_Store + +# IDEs +*.iml +.idea diff --git a/contracts/dao/neutron-chain-manager/Cargo.toml b/contracts/dao/neutron-chain-manager/Cargo.toml new file mode 100644 index 00000000..883f91fd --- /dev/null +++ b/contracts/dao/neutron-chain-manager/Cargo.toml @@ -0,0 +1,39 @@ +[package] +authors = ["Andrei Zavgorodnii "] +description = "A chain manager implementation that grants fine-grained admin permissions to other contracts" +edition = "2021" +name = "neutron-chain-manager" +repository = "https://github.com/neutron-org/neutron-dao" +version = "0.3.0" + +[lib] +crate-type = ["cdylib", "rlib"] + +[features] +# for more explicit tests, cargo test --features=backtraces +backtraces = ["cosmwasm-std/backtraces"] +# use library feature to disable all instantiate/execute/query exports +library = [] + +[dependencies] +cosmwasm-schema = {version = "1.3.0"} +cosmwasm-std = {version = "1.3.0"} +cosmwasm-storage = {version = "1.3.0"} +cw-controllers = "1.1.0" +cw-paginate = {path = "../../../packages/cw-paginate"} +cw-storage-plus = "1.1.0" +cw-utils = {version = "1.0.1"} +cw2 = "1.1.0" +cwd-interface = {path = "../../../packages/cwd-interface"} +cwd-macros = {path = "../../../packages/cwd-macros"} +schemars = "0.8.8" +serde = {version = "1.0.175", default-features = false, features = ["derive"]} +serde_with = {version = "3.7.0", features = ["json"]} +thiserror = {version = "1.0"} +neutron-sdk = "0.8.0" +serde-json-wasm = "1.0.1" +prost = "0.9.0" + +[dev-dependencies] +anyhow = "1.0.57" +cw-multi-test = "0.16.5" diff --git a/contracts/dao/neutron-chain-manager/README.md b/contracts/dao/neutron-chain-manager/README.md new file mode 100644 index 00000000..bb568f99 --- /dev/null +++ b/contracts/dao/neutron-chain-manager/README.md @@ -0,0 +1,6 @@ +### Neutron Chain Manager + +This contract implements a **chain management** **model** with two types of permission strategies: + +1. **ALLOW_ALL**: gives a given address full access to the admin module, allowing to submit all possible types of privileged messages; +2. **ALLOW_ONLY**: allows a given address to submit privileged messages of a specific type, with further restrictions if applicable (see below). diff --git a/contracts/dao/neutron-chain-manager/examples/neutron-chain-manager_schema.rs b/contracts/dao/neutron-chain-manager/examples/neutron-chain-manager_schema.rs new file mode 100644 index 00000000..84b1c52f --- /dev/null +++ b/contracts/dao/neutron-chain-manager/examples/neutron-chain-manager_schema.rs @@ -0,0 +1,11 @@ +use cosmwasm_schema::write_api; +use neutron_chain_manager::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; + +fn main() { + write_api! { + instantiate: InstantiateMsg, + query: QueryMsg, + execute: ExecuteMsg, + migrate: MigrateMsg + } +} diff --git a/contracts/dao/neutron-chain-manager/schema/neutron-chain-manager.json b/contracts/dao/neutron-chain-manager/schema/neutron-chain-manager.json new file mode 100644 index 00000000..339b6f74 --- /dev/null +++ b/contracts/dao/neutron-chain-manager/schema/neutron-chain-manager.json @@ -0,0 +1,2267 @@ +{ + "contract_name": "neutron-chain-manager", + "contract_version": "0.3.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "initial_strategy_address" + ], + "properties": { + "initial_strategy_address": { + "description": "Defines the address for the initial strategy.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + } + } + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "add_strategy" + ], + "properties": { + "add_strategy": { + "type": "object", + "required": [ + "address", + "strategy" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "strategy": { + "$ref": "#/definitions/StrategyMsg" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "remove_strategy" + ], + "properties": { + "remove_strategy": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "execute_messages" + ], + "properties": { + "execute_messages": { + "type": "object", + "required": [ + "messages" + ], + "properties": { + "messages": { + "type": "array", + "items": { + "$ref": "#/definitions/CosmosMsg_for_NeutronMsg" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "AdminProposal": { + "description": "AdminProposal defines the struct for various proposals which Neutron's Admin Module may accept.", + "oneOf": [ + { + "description": "Proposal to change params. Note that this works for old params. New params has their own `MsgUpdateParams` msgs that can be supplied to `ProposalExecuteMessage`", + "type": "object", + "required": [ + "param_change_proposal" + ], + "properties": { + "param_change_proposal": { + "$ref": "#/definitions/ParamChangeProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Proposal to upgrade IBC client", + "type": "object", + "required": [ + "upgrade_proposal" + ], + "properties": { + "upgrade_proposal": { + "$ref": "#/definitions/UpgradeProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Proposal to update IBC client", + "type": "object", + "required": [ + "client_update_proposal" + ], + "properties": { + "client_update_proposal": { + "$ref": "#/definitions/ClientUpdateProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Proposal to execute CosmosMsg.", + "type": "object", + "required": [ + "proposal_execute_message" + ], + "properties": { + "proposal_execute_message": { + "$ref": "#/definitions/ProposalExecuteMessage" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to upgrade network", + "deprecated": true, + "type": "object", + "required": [ + "software_upgrade_proposal" + ], + "properties": { + "software_upgrade_proposal": { + "$ref": "#/definitions/SoftwareUpgradeProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to cancel existing software upgrade", + "deprecated": true, + "type": "object", + "required": [ + "cancel_software_upgrade_proposal" + ], + "properties": { + "cancel_software_upgrade_proposal": { + "$ref": "#/definitions/CancelSoftwareUpgradeProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Will fail to execute if you use it. Deprecated. Proposal to pin wasm contract codes", + "deprecated": true, + "type": "object", + "required": [ + "pin_codes_proposal" + ], + "properties": { + "pin_codes_proposal": { + "$ref": "#/definitions/PinCodesProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Deprecated. Proposal to unpin wasm contract codes.", + "deprecated": true, + "type": "object", + "required": [ + "unpin_codes_proposal" + ], + "properties": { + "unpin_codes_proposal": { + "$ref": "#/definitions/UnpinCodesProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to call sudo on contract.", + "deprecated": true, + "type": "object", + "required": [ + "sudo_contract_proposal" + ], + "properties": { + "sudo_contract_proposal": { + "$ref": "#/definitions/SudoContractProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to update contract admin.", + "deprecated": true, + "type": "object", + "required": [ + "update_admin_proposal" + ], + "properties": { + "update_admin_proposal": { + "$ref": "#/definitions/UpdateAdminProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to clear contract admin.", + "deprecated": true, + "type": "object", + "required": [ + "clear_admin_proposal" + ], + "properties": { + "clear_admin_proposal": { + "$ref": "#/definitions/ClearAdminProposal" + } + }, + "additionalProperties": false + } + ] + }, + "BankMsg": { + "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", + "oneOf": [ + { + "description": "Sends native tokens from the contract to the given address.\n\nThis is translated to a [MsgSend](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto#L19-L28). `from_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "send" + ], + "properties": { + "send": { + "type": "object", + "required": [ + "amount", + "to_address" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "to_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will burn the given coins from the contract's account. There is no Cosmos SDK message that performs this, but it can be done by calling the bank keeper. Important if a contract controls significant token supply that must be retired.", + "type": "object", + "required": [ + "burn" + ], + "properties": { + "burn": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "CancelSoftwareUpgradeProposal": { + "description": "Deprecated. CancelSoftwareUpgradeProposal defines the struct for cancel software upgrade proposal.", + "deprecated": true, + "type": "object", + "required": [ + "description", + "title" + ], + "properties": { + "description": { + "description": "*description** is a text description of proposal. Non unique.", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal. Non unique.", + "type": "string" + } + } + }, + "ClearAdminProposal": { + "description": "Deprecated. SudoContractProposal defines the struct for clear admin proposal.", + "deprecated": true, + "type": "object", + "required": [ + "contract", + "description", + "title" + ], + "properties": { + "contract": { + "description": "*contract** is an address of contract admin will be removed.", + "type": "string" + }, + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + } + }, + "ClientUpdateProposal": { + "description": "ClientUpdateProposal defines the struct for client update proposal.", + "type": "object", + "required": [ + "description", + "subject_client_id", + "substitute_client_id", + "title" + ], + "properties": { + "description": { + "description": "*description** is a text description of proposal. Non unique.", + "type": "string" + }, + "subject_client_id": { + "description": "*subject_client_id** is a subject client id.", + "type": "string" + }, + "substitute_client_id": { + "description": "*substitute_client_id** is a substitute client id.", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + } + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "CosmosMsg_for_NeutronMsg": { + "oneOf": [ + { + "type": "object", + "required": [ + "bank" + ], + "properties": { + "bank": { + "$ref": "#/definitions/BankMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "custom" + ], + "properties": { + "custom": { + "$ref": "#/definitions/NeutronMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "staking" + ], + "properties": { + "staking": { + "$ref": "#/definitions/StakingMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "distribution" + ], + "properties": { + "distribution": { + "$ref": "#/definitions/DistributionMsg" + } + }, + "additionalProperties": false + }, + { + "description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", + "type": "object", + "required": [ + "stargate" + ], + "properties": { + "stargate": { + "type": "object", + "required": [ + "type_url", + "value" + ], + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/Binary" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "ibc" + ], + "properties": { + "ibc": { + "$ref": "#/definitions/IbcMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "wasm" + ], + "properties": { + "wasm": { + "$ref": "#/definitions/WasmMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "gov" + ], + "properties": { + "gov": { + "$ref": "#/definitions/GovMsg" + } + }, + "additionalProperties": false + } + ] + }, + "CronPermission": { + "type": "object", + "required": [ + "add_schedule", + "remove_schedule" + ], + "properties": { + "add_schedule": { + "type": "boolean" + }, + "remove_schedule": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "CronUpdateParamsPermission": { + "type": "object", + "required": [ + "limit", + "security_address" + ], + "properties": { + "limit": { + "type": "boolean" + }, + "security_address": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "DistributionMsg": { + "description": "The message types of the distribution module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgSetWithdrawAddress](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L29-L37). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "set_withdraw_address" + ], + "properties": { + "set_withdraw_address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "The `withdraw_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [[MsgWithdrawDelegatorReward](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L42-L50). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "withdraw_delegator_reward" + ], + "properties": { + "withdraw_delegator_reward": { + "type": "object", + "required": [ + "validator" + ], + "properties": { + "validator": { + "description": "The `validator_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "GovMsg": { + "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, vote: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", + "oneOf": [ + { + "description": "This maps directly to [MsgVote](https://github.com/cosmos/cosmos-sdk/blob/v0.42.5/proto/cosmos/gov/v1beta1/tx.proto#L46-L56) in the Cosmos SDK with voter set to the contract address.", + "type": "object", + "required": [ + "vote" + ], + "properties": { + "vote": { + "type": "object", + "required": [ + "proposal_id", + "vote" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "description": "The vote option.\n\nThis should be called \"option\" for consistency with Cosmos SDK. Sorry for that. See .", + "allOf": [ + { + "$ref": "#/definitions/VoteOption" + } + ] + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcFee": { + "description": "IbcFee defines struct for fees that refund the relayer for `SudoMsg` messages submission. Unused fee kind will be returned back to message sender. Please refer to these links for more information: IBC transaction structure - General mechanics of fee payments - ", + "type": "object", + "required": [ + "ack_fee", + "recv_fee", + "timeout_fee" + ], + "properties": { + "ack_fee": { + "description": "*ack_fee** is an amount of coins to refund relayer for submitting ack message for a particular IBC packet.", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "recv_fee": { + "description": "**recv_fee** currently is used for compatibility with ICS-29 interface only and must be set to zero (i.e. 0untrn), because Neutron's fee module can't refund relayer for submission of Recv IBC packets due to compatibility with target chains.", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "timeout_fee": { + "description": "*timeout_fee** amount of coins to refund relayer for submitting timeout message for a particular IBC packet.", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + } + }, + "IbcMsg": { + "description": "These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts (contracts that directly speak the IBC protocol via 6 entry points)", + "oneOf": [ + { + "description": "Sends bank tokens owned by the contract to the given address on another chain. The channel must already be established between the ibctransfer module on this chain and a matching module on the remote chain. We cannot select the port_id, this is whatever the local chain has bound the ibctransfer module to.", + "type": "object", + "required": [ + "transfer" + ], + "properties": { + "transfer": { + "type": "object", + "required": [ + "amount", + "channel_id", + "timeout", + "to_address" + ], + "properties": { + "amount": { + "description": "packet data only supports one coin https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "channel_id": { + "description": "existing channel to send the tokens over", + "type": "string" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + }, + "to_address": { + "description": "address on the remote chain to receive these tokens", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sends an IBC packet with given data over the existing channel. Data should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", + "type": "object", + "required": [ + "send_packet" + ], + "properties": { + "send_packet": { + "type": "object", + "required": [ + "channel_id", + "data", + "timeout" + ], + "properties": { + "channel_id": { + "type": "string" + }, + "data": { + "$ref": "#/definitions/Binary" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will close an existing channel that is owned by this contract. Port is auto-assigned to the contract's IBC port", + "type": "object", + "required": [ + "close_channel" + ], + "properties": { + "close_channel": { + "type": "object", + "required": [ + "channel_id" + ], + "properties": { + "channel_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcTimeout": { + "description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.", + "type": "object", + "properties": { + "block": { + "anyOf": [ + { + "$ref": "#/definitions/IbcTimeoutBlock" + }, + { + "type": "null" + } + ] + }, + "timestamp": { + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + } + } + }, + "IbcTimeoutBlock": { + "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", + "type": "object", + "required": [ + "height", + "revision" + ], + "properties": { + "height": { + "description": "block height after which the packet times out. the height within the given revision", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "revision": { + "description": "the version that the client is currently on (e.g. after resetting the chain this could increment 1 as height drops to 0)", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "KVKey": { + "description": "Describes a KV key for which you want to get value from the storage on remote chain", + "type": "object", + "required": [ + "key", + "path" + ], + "properties": { + "key": { + "description": "*key** is a key you want to read from the storage", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "path": { + "description": "*path** is a path to the storage (storage prefix) where you want to read value by key (usually name of cosmos-packages module: 'staking', 'bank', etc.)", + "type": "string" + } + } + }, + "MsgExecuteContract": { + "description": "MsgExecuteContract defines a call to the contract execution", + "type": "object", + "required": [ + "contract", + "msg" + ], + "properties": { + "contract": { + "description": "*contract** is a contract address that will be called", + "type": "string" + }, + "msg": { + "description": "*msg** is a contract call message", + "type": "string" + } + } + }, + "NeutronMsg": { + "description": "A number of Custom messages that can call into the Neutron bindings.", + "oneOf": [ + { + "description": "RegisterInterchainAccount registers an interchain account on remote chain.", + "type": "object", + "required": [ + "register_interchain_account" + ], + "properties": { + "register_interchain_account": { + "type": "object", + "required": [ + "connection_id", + "interchain_account_id" + ], + "properties": { + "connection_id": { + "description": "*connection_id** is an IBC connection identifier between Neutron and remote chain.", + "type": "string" + }, + "interchain_account_id": { + "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", + "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Coin" + } + } + } + } + }, + "additionalProperties": false + }, + { + "description": "SubmitTx starts the process of executing any Cosmos-SDK *msgs* on remote chain.", + "type": "object", + "required": [ + "submit_tx" + ], + "properties": { + "submit_tx": { + "type": "object", + "required": [ + "connection_id", + "fee", + "interchain_account_id", + "memo", + "msgs", + "timeout" + ], + "properties": { + "connection_id": { + "description": "*connection_id** is an IBC connection identifier between Neutron and remote chain.", + "type": "string" + }, + "fee": { + "description": "**fee** is an ibc fee for the transaction.", + "allOf": [ + { + "$ref": "#/definitions/IbcFee" + } + ] + }, + "interchain_account_id": { + "description": "*interchain_account_id** is an identifier of your interchain account from which you want to execute msgs.", + "type": "string" + }, + "memo": { + "description": "*memo** is a memo you want to attach to your interchain transaction.It behaves like a memo in usual Cosmos transaction.", + "type": "string" + }, + "msgs": { + "description": "*msgs** is a list of protobuf encoded Cosmos-SDK messages you want to execute on remote chain.", + "type": "array", + "items": { + "$ref": "#/definitions/ProtobufAny" + } + }, + "timeout": { + "description": "*timeout** is a timeout in seconds after which the packet times out.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "RegisterInterchainQuery registers an interchain query.", + "type": "object", + "required": [ + "register_interchain_query" + ], + "properties": { + "register_interchain_query": { + "type": "object", + "required": [ + "connection_id", + "keys", + "query_type", + "transactions_filter", + "update_period" + ], + "properties": { + "connection_id": { + "description": "*connection_id** is an IBC connection identifier between Neutron and remote chain.", + "type": "string" + }, + "keys": { + "description": "*keys** is the KV-storage keys for which we want to get values from remote chain.", + "type": "array", + "items": { + "$ref": "#/definitions/KVKey" + } + }, + "query_type": { + "description": "*query_type** is a query type identifier ('tx' or 'kv' for now).", + "type": "string" + }, + "transactions_filter": { + "description": "*transactions_filter** is the filter for transaction search ICQ.", + "type": "string" + }, + "update_period": { + "description": "*update_period** is used to say how often the query must be updated.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "RegisterInterchainQuery updates an interchain query.", + "type": "object", + "required": [ + "update_interchain_query" + ], + "properties": { + "update_interchain_query": { + "type": "object", + "required": [ + "query_id" + ], + "properties": { + "new_keys": { + "description": "*new_keys** is the new query keys to retrive.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/KVKey" + } + }, + "new_transactions_filter": { + "description": "*new_transactions_filter** is a new transactions filter of the query.", + "type": [ + "string", + "null" + ] + }, + "new_update_period": { + "description": "*new_update_period** is a new update period of the query.", + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "query_id": { + "description": "*query_id** is the ID of the query we want to update.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "RemoveInterchainQuery removes as interchain query.", + "type": "object", + "required": [ + "remove_interchain_query" + ], + "properties": { + "remove_interchain_query": { + "type": "object", + "required": [ + "query_id" + ], + "properties": { + "query_id": { + "description": "*query_id** is ID of the query we want to remove.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "IbcTransfer sends a fungible token packet over IBC.", + "type": "object", + "required": [ + "ibc_transfer" + ], + "properties": { + "ibc_transfer": { + "type": "object", + "required": [ + "fee", + "memo", + "receiver", + "sender", + "source_channel", + "source_port", + "timeout_height", + "timeout_timestamp", + "token" + ], + "properties": { + "fee": { + "$ref": "#/definitions/IbcFee" + }, + "memo": { + "type": "string" + }, + "receiver": { + "type": "string" + }, + "sender": { + "type": "string" + }, + "source_channel": { + "type": "string" + }, + "source_port": { + "type": "string" + }, + "timeout_height": { + "$ref": "#/definitions/RequestPacketTimeoutHeight" + }, + "timeout_timestamp": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "token": { + "$ref": "#/definitions/Coin" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "SubmitAdminProposal sends a proposal to neutron's Admin module. This type of messages can be only executed by Neutron DAO.", + "type": "object", + "required": [ + "submit_admin_proposal" + ], + "properties": { + "submit_admin_proposal": { + "type": "object", + "required": [ + "admin_proposal" + ], + "properties": { + "admin_proposal": { + "$ref": "#/definitions/AdminProposal" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "TokenFactory message. Contracts can create denoms, namespaced under the contract's address. A contract may create any number of independent sub-denoms.", + "type": "object", + "required": [ + "create_denom" + ], + "properties": { + "create_denom": { + "type": "object", + "required": [ + "subdenom" + ], + "properties": { + "subdenom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "TokenFactory message. Contracts can change the admin of a denom that they are the admin of.", + "type": "object", + "required": [ + "change_admin" + ], + "properties": { + "change_admin": { + "type": "object", + "required": [ + "denom", + "new_admin_address" + ], + "properties": { + "denom": { + "type": "string" + }, + "new_admin_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "TokenFactory message. Contracts can mint native tokens for an existing factory denom that they are the admin of.", + "type": "object", + "required": [ + "mint_tokens" + ], + "properties": { + "mint_tokens": { + "type": "object", + "required": [ + "amount", + "denom", + "mint_to_address" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + }, + "mint_to_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "TokenFactory message. Contracts can burn native tokens for an existing factory denom that they are the admin of. Currently, the burn from address must be the admin contract.", + "type": "object", + "required": [ + "burn_tokens" + ], + "properties": { + "burn_tokens": { + "type": "object", + "required": [ + "amount", + "burn_from_address", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "burn_from_address": { + "description": "Must be set to `\"\"` for now", + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", + "type": "object", + "required": [ + "add_schedule" + ], + "properties": { + "add_schedule": { + "type": "object", + "required": [ + "msgs", + "name", + "period" + ], + "properties": { + "msgs": { + "description": "list of cosmwasm messages to be executed", + "type": "array", + "items": { + "$ref": "#/definitions/MsgExecuteContract" + } + }, + "name": { + "description": "Name of a new schedule. Needed to be able to `RemoveSchedule` and to log information about it", + "type": "string" + }, + "period": { + "description": "period in blocks with which `msgs` will be executed", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "RemoveSchedule removes the schedule with a given `name`. [Permissioned - DAO or Security DAO only]", + "type": "object", + "required": [ + "remove_schedule" + ], + "properties": { + "remove_schedule": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "type": "object", + "required": [ + "resubmit_failure" + ], + "properties": { + "resubmit_failure": { + "type": "object", + "required": [ + "failure_id" + ], + "properties": { + "failure_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + } + ] + }, + "ParamChange": { + "description": "ParamChange defines the struct for parameter change request.", + "type": "object", + "required": [ + "key", + "subspace", + "value" + ], + "properties": { + "key": { + "description": "*key** is a name of parameter. Unique for subspace.", + "type": "string" + }, + "subspace": { + "description": "*subspace** is a key of module to which the parameter to change belongs. Unique for each module.", + "type": "string" + }, + "value": { + "description": "*value** is a new value for given parameter. Non unique.", + "type": "string" + } + } + }, + "ParamChangePermission": { + "type": "object", + "required": [ + "params" + ], + "properties": { + "params": { + "type": "array", + "items": { + "$ref": "#/definitions/ParamPermission" + } + } + }, + "additionalProperties": false + }, + "ParamChangeProposal": { + "description": "ParamChangeProposal defines the struct for single parameter change proposal.", + "type": "object", + "required": [ + "description", + "param_changes", + "title" + ], + "properties": { + "description": { + "description": "*description** is a text description of proposal. Non unique.", + "type": "string" + }, + "param_changes": { + "description": "*param_changes** is a vector of params to be changed. Non unique.", + "type": "array", + "items": { + "$ref": "#/definitions/ParamChange" + } + }, + "title": { + "description": "*title** is a text title of proposal. Non unique.", + "type": "string" + } + } + }, + "ParamPermission": { + "type": "object", + "required": [ + "key", + "subspace" + ], + "properties": { + "key": { + "type": "string" + }, + "subspace": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Permission": { + "oneOf": [ + { + "type": "object", + "required": [ + "param_change_permission" + ], + "properties": { + "param_change_permission": { + "$ref": "#/definitions/ParamChangePermission" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_params_permission" + ], + "properties": { + "update_params_permission": { + "$ref": "#/definitions/UpdateParamsPermission" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "cron_permission" + ], + "properties": { + "cron_permission": { + "$ref": "#/definitions/CronPermission" + } + }, + "additionalProperties": false + } + ] + }, + "PinCodesProposal": { + "description": "Deprecated. PinCodesProposal defines the struct for pin contract codes proposal.", + "deprecated": true, + "type": "object", + "required": [ + "code_ids", + "description", + "title" + ], + "properties": { + "code_ids": { + "description": "*code_ids** is an array of codes to be pined.", + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + } + }, + "Plan": { + "description": "Plan defines the struct for planned upgrade.", + "type": "object", + "required": [ + "height", + "info", + "name" + ], + "properties": { + "height": { + "description": "*height** is a height at which the upgrade must be performed", + "type": "integer", + "format": "int64" + }, + "info": { + "description": "*info** is any application specific upgrade info to be included on-chain", + "type": "string" + }, + "name": { + "description": "*name** is a name for the upgrade", + "type": "string" + } + } + }, + "ProposalExecuteMessage": { + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" + } + } + }, + "ProtobufAny": { + "description": "Type for wrapping any protobuf message", + "type": "object", + "required": [ + "type_url", + "value" + ], + "properties": { + "type_url": { + "description": "*type_url** describes the type of the serialized message", + "type": "string" + }, + "value": { + "description": "*value** must be a valid serialized protocol buffer of the above specified type", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + }, + "RequestPacketTimeoutHeight": { + "type": "object", + "properties": { + "revision_height": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "revision_number": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + } + }, + "SoftwareUpgradeProposal": { + "description": "Deprecated. SoftwareUpgradeProposal defines the struct for software upgrade proposal.", + "deprecated": true, + "type": "object", + "required": [ + "description", + "plan", + "title" + ], + "properties": { + "description": { + "description": "*description** is a text description of proposal. Non unique.", + "type": "string" + }, + "plan": { + "description": "*plan** is a plan of upgrade.", + "allOf": [ + { + "$ref": "#/definitions/Plan" + } + ] + }, + "title": { + "description": "*title** is a text title of proposal. Non unique.", + "type": "string" + } + } + }, + "StakingMsg": { + "description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgDelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L81-L90). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "delegate" + ], + "properties": { + "delegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgUndelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L112-L121). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "undelegate" + ], + "properties": { + "undelegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgBeginRedelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L95-L105). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "redelegate" + ], + "properties": { + "redelegate": { + "type": "object", + "required": [ + "amount", + "dst_validator", + "src_validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "dst_validator": { + "type": "string" + }, + "src_validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "StrategyMsg": { + "oneOf": [ + { + "type": "string", + "enum": [ + "allow_all" + ] + }, + { + "type": "object", + "required": [ + "allow_only" + ], + "properties": { + "allow_only": { + "type": "array", + "items": { + "$ref": "#/definitions/Permission" + } + } + }, + "additionalProperties": false + } + ] + }, + "SudoContractProposal": { + "description": "Deprecated. SudoContractProposal defines the struct for sudo execution proposal.", + "deprecated": true, + "type": "object", + "required": [ + "contract", + "description", + "msg", + "title" + ], + "properties": { + "contract": { + "description": "*contract** is an address of contract to be executed.", + "type": "string" + }, + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "msg": { + "description": "**msg*** is a sudo message.", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + }, + "UnpinCodesProposal": { + "description": "Deprecated. UnpinCodesProposal defines the struct for unpin contract codes proposal.", + "deprecated": true, + "type": "object", + "required": [ + "code_ids", + "description", + "title" + ], + "properties": { + "code_ids": { + "description": "*code_ids** is an array of codes to be unpined.", + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + } + }, + "UpdateAdminProposal": { + "description": "Deprecated. UpdateAdminProposal defines the struct for update admin proposal.", + "deprecated": true, + "type": "object", + "required": [ + "contract", + "description", + "new_admin", + "title" + ], + "properties": { + "contract": { + "description": "*contract** is an address of contract to update admin.", + "type": "string" + }, + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "new_admin": { + "description": "**new_admin*** is an address of new admin", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + } + }, + "UpdateParamsPermission": { + "oneOf": [ + { + "type": "object", + "required": [ + "cron_update_params_permission" + ], + "properties": { + "cron_update_params_permission": { + "$ref": "#/definitions/CronUpdateParamsPermission" + } + }, + "additionalProperties": false + } + ] + }, + "UpgradeProposal": { + "description": "UpgradeProposal defines the struct for IBC upgrade proposal.", + "type": "object", + "required": [ + "description", + "plan", + "title", + "upgraded_client_state" + ], + "properties": { + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "plan": { + "description": "*plan** is a plan of upgrade.", + "allOf": [ + { + "$ref": "#/definitions/Plan" + } + ] + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + }, + "upgraded_client_state": { + "description": "*upgraded_client_state** is an upgraded client state.", + "allOf": [ + { + "$ref": "#/definitions/ProtobufAny" + } + ] + } + } + }, + "VoteOption": { + "type": "string", + "enum": [ + "yes", + "no", + "abstain", + "no_with_veto" + ] + }, + "WasmMsg": { + "description": "The message types of the wasm module.\n\nSee https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto", + "oneOf": [ + { + "description": "Dispatches a call to another contract at a known address (with known ABI).\n\nThis is translated to a [MsgExecuteContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L68-L78). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "contract_addr", + "funds", + "msg" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "msg": { + "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "instantiate" + ], + "properties": { + "instantiate": { + "type": "object", + "required": [ + "code_id", + "funds", + "label", + "msg" + ], + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + }, + "code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "label": { + "description": "A human-readable label for the contract.\n\nValid values should: - not be empty - not be bigger than 128 bytes (or some chain-specific limit) - not start / end with whitespace", + "type": "string" + }, + "msg": { + "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "migrate" + ], + "properties": { + "migrate": { + "type": "object", + "required": [ + "contract_addr", + "msg", + "new_code_id" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "msg": { + "description": "msg is the json-encoded MigrateMsg struct that will be passed to the new code", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "new_code_id": { + "description": "the code_id of the new logic to place in the given contract", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sets a new admin (for migrate) on the given contract. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "update_admin" + ], + "properties": { + "update_admin": { + "type": "object", + "required": [ + "admin", + "contract_addr" + ], + "properties": { + "admin": { + "type": "string" + }, + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Clears the admin on the given contract, so no more migration possible. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "clear_admin" + ], + "properties": { + "clear_admin": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "strategies" + ], + "properties": { + "strategies": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "migrate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "type": "object", + "additionalProperties": false + }, + "sudo": null, + "responses": { + "strategies": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Array_of_StrategyMsg", + "type": "array", + "items": { + "$ref": "#/definitions/StrategyMsg" + }, + "definitions": { + "CronPermission": { + "type": "object", + "required": [ + "add_schedule", + "remove_schedule" + ], + "properties": { + "add_schedule": { + "type": "boolean" + }, + "remove_schedule": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "CronUpdateParamsPermission": { + "type": "object", + "required": [ + "limit", + "security_address" + ], + "properties": { + "limit": { + "type": "boolean" + }, + "security_address": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "ParamChangePermission": { + "type": "object", + "required": [ + "params" + ], + "properties": { + "params": { + "type": "array", + "items": { + "$ref": "#/definitions/ParamPermission" + } + } + }, + "additionalProperties": false + }, + "ParamPermission": { + "type": "object", + "required": [ + "key", + "subspace" + ], + "properties": { + "key": { + "type": "string" + }, + "subspace": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Permission": { + "oneOf": [ + { + "type": "object", + "required": [ + "param_change_permission" + ], + "properties": { + "param_change_permission": { + "$ref": "#/definitions/ParamChangePermission" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_params_permission" + ], + "properties": { + "update_params_permission": { + "$ref": "#/definitions/UpdateParamsPermission" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "cron_permission" + ], + "properties": { + "cron_permission": { + "$ref": "#/definitions/CronPermission" + } + }, + "additionalProperties": false + } + ] + }, + "StrategyMsg": { + "oneOf": [ + { + "type": "string", + "enum": [ + "allow_all" + ] + }, + { + "type": "object", + "required": [ + "allow_only" + ], + "properties": { + "allow_only": { + "type": "array", + "items": { + "$ref": "#/definitions/Permission" + } + } + }, + "additionalProperties": false + } + ] + }, + "UpdateParamsPermission": { + "oneOf": [ + { + "type": "object", + "required": [ + "cron_update_params_permission" + ], + "properties": { + "cron_update_params_permission": { + "$ref": "#/definitions/CronUpdateParamsPermission" + } + }, + "additionalProperties": false + } + ] + } + } + } + } +} diff --git a/contracts/dao/neutron-chain-manager/schema/raw/execute.json b/contracts/dao/neutron-chain-manager/schema/raw/execute.json new file mode 100644 index 00000000..04d90cf9 --- /dev/null +++ b/contracts/dao/neutron-chain-manager/schema/raw/execute.json @@ -0,0 +1,2055 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "add_strategy" + ], + "properties": { + "add_strategy": { + "type": "object", + "required": [ + "address", + "strategy" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "strategy": { + "$ref": "#/definitions/StrategyMsg" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "remove_strategy" + ], + "properties": { + "remove_strategy": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "execute_messages" + ], + "properties": { + "execute_messages": { + "type": "object", + "required": [ + "messages" + ], + "properties": { + "messages": { + "type": "array", + "items": { + "$ref": "#/definitions/CosmosMsg_for_NeutronMsg" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "AdminProposal": { + "description": "AdminProposal defines the struct for various proposals which Neutron's Admin Module may accept.", + "oneOf": [ + { + "description": "Proposal to change params. Note that this works for old params. New params has their own `MsgUpdateParams` msgs that can be supplied to `ProposalExecuteMessage`", + "type": "object", + "required": [ + "param_change_proposal" + ], + "properties": { + "param_change_proposal": { + "$ref": "#/definitions/ParamChangeProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Proposal to upgrade IBC client", + "type": "object", + "required": [ + "upgrade_proposal" + ], + "properties": { + "upgrade_proposal": { + "$ref": "#/definitions/UpgradeProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Proposal to update IBC client", + "type": "object", + "required": [ + "client_update_proposal" + ], + "properties": { + "client_update_proposal": { + "$ref": "#/definitions/ClientUpdateProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Proposal to execute CosmosMsg.", + "type": "object", + "required": [ + "proposal_execute_message" + ], + "properties": { + "proposal_execute_message": { + "$ref": "#/definitions/ProposalExecuteMessage" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to upgrade network", + "deprecated": true, + "type": "object", + "required": [ + "software_upgrade_proposal" + ], + "properties": { + "software_upgrade_proposal": { + "$ref": "#/definitions/SoftwareUpgradeProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to cancel existing software upgrade", + "deprecated": true, + "type": "object", + "required": [ + "cancel_software_upgrade_proposal" + ], + "properties": { + "cancel_software_upgrade_proposal": { + "$ref": "#/definitions/CancelSoftwareUpgradeProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Will fail to execute if you use it. Deprecated. Proposal to pin wasm contract codes", + "deprecated": true, + "type": "object", + "required": [ + "pin_codes_proposal" + ], + "properties": { + "pin_codes_proposal": { + "$ref": "#/definitions/PinCodesProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Deprecated. Proposal to unpin wasm contract codes.", + "deprecated": true, + "type": "object", + "required": [ + "unpin_codes_proposal" + ], + "properties": { + "unpin_codes_proposal": { + "$ref": "#/definitions/UnpinCodesProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to call sudo on contract.", + "deprecated": true, + "type": "object", + "required": [ + "sudo_contract_proposal" + ], + "properties": { + "sudo_contract_proposal": { + "$ref": "#/definitions/SudoContractProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to update contract admin.", + "deprecated": true, + "type": "object", + "required": [ + "update_admin_proposal" + ], + "properties": { + "update_admin_proposal": { + "$ref": "#/definitions/UpdateAdminProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to clear contract admin.", + "deprecated": true, + "type": "object", + "required": [ + "clear_admin_proposal" + ], + "properties": { + "clear_admin_proposal": { + "$ref": "#/definitions/ClearAdminProposal" + } + }, + "additionalProperties": false + } + ] + }, + "BankMsg": { + "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", + "oneOf": [ + { + "description": "Sends native tokens from the contract to the given address.\n\nThis is translated to a [MsgSend](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto#L19-L28). `from_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "send" + ], + "properties": { + "send": { + "type": "object", + "required": [ + "amount", + "to_address" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "to_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will burn the given coins from the contract's account. There is no Cosmos SDK message that performs this, but it can be done by calling the bank keeper. Important if a contract controls significant token supply that must be retired.", + "type": "object", + "required": [ + "burn" + ], + "properties": { + "burn": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "CancelSoftwareUpgradeProposal": { + "description": "Deprecated. CancelSoftwareUpgradeProposal defines the struct for cancel software upgrade proposal.", + "deprecated": true, + "type": "object", + "required": [ + "description", + "title" + ], + "properties": { + "description": { + "description": "*description** is a text description of proposal. Non unique.", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal. Non unique.", + "type": "string" + } + } + }, + "ClearAdminProposal": { + "description": "Deprecated. SudoContractProposal defines the struct for clear admin proposal.", + "deprecated": true, + "type": "object", + "required": [ + "contract", + "description", + "title" + ], + "properties": { + "contract": { + "description": "*contract** is an address of contract admin will be removed.", + "type": "string" + }, + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + } + }, + "ClientUpdateProposal": { + "description": "ClientUpdateProposal defines the struct for client update proposal.", + "type": "object", + "required": [ + "description", + "subject_client_id", + "substitute_client_id", + "title" + ], + "properties": { + "description": { + "description": "*description** is a text description of proposal. Non unique.", + "type": "string" + }, + "subject_client_id": { + "description": "*subject_client_id** is a subject client id.", + "type": "string" + }, + "substitute_client_id": { + "description": "*substitute_client_id** is a substitute client id.", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + } + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "CosmosMsg_for_NeutronMsg": { + "oneOf": [ + { + "type": "object", + "required": [ + "bank" + ], + "properties": { + "bank": { + "$ref": "#/definitions/BankMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "custom" + ], + "properties": { + "custom": { + "$ref": "#/definitions/NeutronMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "staking" + ], + "properties": { + "staking": { + "$ref": "#/definitions/StakingMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "distribution" + ], + "properties": { + "distribution": { + "$ref": "#/definitions/DistributionMsg" + } + }, + "additionalProperties": false + }, + { + "description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", + "type": "object", + "required": [ + "stargate" + ], + "properties": { + "stargate": { + "type": "object", + "required": [ + "type_url", + "value" + ], + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/Binary" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "ibc" + ], + "properties": { + "ibc": { + "$ref": "#/definitions/IbcMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "wasm" + ], + "properties": { + "wasm": { + "$ref": "#/definitions/WasmMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "gov" + ], + "properties": { + "gov": { + "$ref": "#/definitions/GovMsg" + } + }, + "additionalProperties": false + } + ] + }, + "CronPermission": { + "type": "object", + "required": [ + "add_schedule", + "remove_schedule" + ], + "properties": { + "add_schedule": { + "type": "boolean" + }, + "remove_schedule": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "CronUpdateParamsPermission": { + "type": "object", + "required": [ + "limit", + "security_address" + ], + "properties": { + "limit": { + "type": "boolean" + }, + "security_address": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "DistributionMsg": { + "description": "The message types of the distribution module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgSetWithdrawAddress](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L29-L37). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "set_withdraw_address" + ], + "properties": { + "set_withdraw_address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "description": "The `withdraw_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [[MsgWithdrawDelegatorReward](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L42-L50). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "withdraw_delegator_reward" + ], + "properties": { + "withdraw_delegator_reward": { + "type": "object", + "required": [ + "validator" + ], + "properties": { + "validator": { + "description": "The `validator_address`", + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "GovMsg": { + "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, vote: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", + "oneOf": [ + { + "description": "This maps directly to [MsgVote](https://github.com/cosmos/cosmos-sdk/blob/v0.42.5/proto/cosmos/gov/v1beta1/tx.proto#L46-L56) in the Cosmos SDK with voter set to the contract address.", + "type": "object", + "required": [ + "vote" + ], + "properties": { + "vote": { + "type": "object", + "required": [ + "proposal_id", + "vote" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "description": "The vote option.\n\nThis should be called \"option\" for consistency with Cosmos SDK. Sorry for that. See .", + "allOf": [ + { + "$ref": "#/definitions/VoteOption" + } + ] + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcFee": { + "description": "IbcFee defines struct for fees that refund the relayer for `SudoMsg` messages submission. Unused fee kind will be returned back to message sender. Please refer to these links for more information: IBC transaction structure - General mechanics of fee payments - ", + "type": "object", + "required": [ + "ack_fee", + "recv_fee", + "timeout_fee" + ], + "properties": { + "ack_fee": { + "description": "*ack_fee** is an amount of coins to refund relayer for submitting ack message for a particular IBC packet.", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "recv_fee": { + "description": "**recv_fee** currently is used for compatibility with ICS-29 interface only and must be set to zero (i.e. 0untrn), because Neutron's fee module can't refund relayer for submission of Recv IBC packets due to compatibility with target chains.", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "timeout_fee": { + "description": "*timeout_fee** amount of coins to refund relayer for submitting timeout message for a particular IBC packet.", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + } + }, + "IbcMsg": { + "description": "These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts (contracts that directly speak the IBC protocol via 6 entry points)", + "oneOf": [ + { + "description": "Sends bank tokens owned by the contract to the given address on another chain. The channel must already be established between the ibctransfer module on this chain and a matching module on the remote chain. We cannot select the port_id, this is whatever the local chain has bound the ibctransfer module to.", + "type": "object", + "required": [ + "transfer" + ], + "properties": { + "transfer": { + "type": "object", + "required": [ + "amount", + "channel_id", + "timeout", + "to_address" + ], + "properties": { + "amount": { + "description": "packet data only supports one coin https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20", + "allOf": [ + { + "$ref": "#/definitions/Coin" + } + ] + }, + "channel_id": { + "description": "existing channel to send the tokens over", + "type": "string" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + }, + "to_address": { + "description": "address on the remote chain to receive these tokens", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sends an IBC packet with given data over the existing channel. Data should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", + "type": "object", + "required": [ + "send_packet" + ], + "properties": { + "send_packet": { + "type": "object", + "required": [ + "channel_id", + "data", + "timeout" + ], + "properties": { + "channel_id": { + "type": "string" + }, + "data": { + "$ref": "#/definitions/Binary" + }, + "timeout": { + "description": "when packet times out, measured on remote chain", + "allOf": [ + { + "$ref": "#/definitions/IbcTimeout" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will close an existing channel that is owned by this contract. Port is auto-assigned to the contract's IBC port", + "type": "object", + "required": [ + "close_channel" + ], + "properties": { + "close_channel": { + "type": "object", + "required": [ + "channel_id" + ], + "properties": { + "channel_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "IbcTimeout": { + "description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.", + "type": "object", + "properties": { + "block": { + "anyOf": [ + { + "$ref": "#/definitions/IbcTimeoutBlock" + }, + { + "type": "null" + } + ] + }, + "timestamp": { + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + } + } + }, + "IbcTimeoutBlock": { + "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", + "type": "object", + "required": [ + "height", + "revision" + ], + "properties": { + "height": { + "description": "block height after which the packet times out. the height within the given revision", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "revision": { + "description": "the version that the client is currently on (e.g. after resetting the chain this could increment 1 as height drops to 0)", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "KVKey": { + "description": "Describes a KV key for which you want to get value from the storage on remote chain", + "type": "object", + "required": [ + "key", + "path" + ], + "properties": { + "key": { + "description": "*key** is a key you want to read from the storage", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "path": { + "description": "*path** is a path to the storage (storage prefix) where you want to read value by key (usually name of cosmos-packages module: 'staking', 'bank', etc.)", + "type": "string" + } + } + }, + "MsgExecuteContract": { + "description": "MsgExecuteContract defines a call to the contract execution", + "type": "object", + "required": [ + "contract", + "msg" + ], + "properties": { + "contract": { + "description": "*contract** is a contract address that will be called", + "type": "string" + }, + "msg": { + "description": "*msg** is a contract call message", + "type": "string" + } + } + }, + "NeutronMsg": { + "description": "A number of Custom messages that can call into the Neutron bindings.", + "oneOf": [ + { + "description": "RegisterInterchainAccount registers an interchain account on remote chain.", + "type": "object", + "required": [ + "register_interchain_account" + ], + "properties": { + "register_interchain_account": { + "type": "object", + "required": [ + "connection_id", + "interchain_account_id" + ], + "properties": { + "connection_id": { + "description": "*connection_id** is an IBC connection identifier between Neutron and remote chain.", + "type": "string" + }, + "interchain_account_id": { + "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", + "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Coin" + } + } + } + } + }, + "additionalProperties": false + }, + { + "description": "SubmitTx starts the process of executing any Cosmos-SDK *msgs* on remote chain.", + "type": "object", + "required": [ + "submit_tx" + ], + "properties": { + "submit_tx": { + "type": "object", + "required": [ + "connection_id", + "fee", + "interchain_account_id", + "memo", + "msgs", + "timeout" + ], + "properties": { + "connection_id": { + "description": "*connection_id** is an IBC connection identifier between Neutron and remote chain.", + "type": "string" + }, + "fee": { + "description": "**fee** is an ibc fee for the transaction.", + "allOf": [ + { + "$ref": "#/definitions/IbcFee" + } + ] + }, + "interchain_account_id": { + "description": "*interchain_account_id** is an identifier of your interchain account from which you want to execute msgs.", + "type": "string" + }, + "memo": { + "description": "*memo** is a memo you want to attach to your interchain transaction.It behaves like a memo in usual Cosmos transaction.", + "type": "string" + }, + "msgs": { + "description": "*msgs** is a list of protobuf encoded Cosmos-SDK messages you want to execute on remote chain.", + "type": "array", + "items": { + "$ref": "#/definitions/ProtobufAny" + } + }, + "timeout": { + "description": "*timeout** is a timeout in seconds after which the packet times out.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "RegisterInterchainQuery registers an interchain query.", + "type": "object", + "required": [ + "register_interchain_query" + ], + "properties": { + "register_interchain_query": { + "type": "object", + "required": [ + "connection_id", + "keys", + "query_type", + "transactions_filter", + "update_period" + ], + "properties": { + "connection_id": { + "description": "*connection_id** is an IBC connection identifier between Neutron and remote chain.", + "type": "string" + }, + "keys": { + "description": "*keys** is the KV-storage keys for which we want to get values from remote chain.", + "type": "array", + "items": { + "$ref": "#/definitions/KVKey" + } + }, + "query_type": { + "description": "*query_type** is a query type identifier ('tx' or 'kv' for now).", + "type": "string" + }, + "transactions_filter": { + "description": "*transactions_filter** is the filter for transaction search ICQ.", + "type": "string" + }, + "update_period": { + "description": "*update_period** is used to say how often the query must be updated.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "RegisterInterchainQuery updates an interchain query.", + "type": "object", + "required": [ + "update_interchain_query" + ], + "properties": { + "update_interchain_query": { + "type": "object", + "required": [ + "query_id" + ], + "properties": { + "new_keys": { + "description": "*new_keys** is the new query keys to retrive.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/KVKey" + } + }, + "new_transactions_filter": { + "description": "*new_transactions_filter** is a new transactions filter of the query.", + "type": [ + "string", + "null" + ] + }, + "new_update_period": { + "description": "*new_update_period** is a new update period of the query.", + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "query_id": { + "description": "*query_id** is the ID of the query we want to update.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "RemoveInterchainQuery removes as interchain query.", + "type": "object", + "required": [ + "remove_interchain_query" + ], + "properties": { + "remove_interchain_query": { + "type": "object", + "required": [ + "query_id" + ], + "properties": { + "query_id": { + "description": "*query_id** is ID of the query we want to remove.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "IbcTransfer sends a fungible token packet over IBC.", + "type": "object", + "required": [ + "ibc_transfer" + ], + "properties": { + "ibc_transfer": { + "type": "object", + "required": [ + "fee", + "memo", + "receiver", + "sender", + "source_channel", + "source_port", + "timeout_height", + "timeout_timestamp", + "token" + ], + "properties": { + "fee": { + "$ref": "#/definitions/IbcFee" + }, + "memo": { + "type": "string" + }, + "receiver": { + "type": "string" + }, + "sender": { + "type": "string" + }, + "source_channel": { + "type": "string" + }, + "source_port": { + "type": "string" + }, + "timeout_height": { + "$ref": "#/definitions/RequestPacketTimeoutHeight" + }, + "timeout_timestamp": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "token": { + "$ref": "#/definitions/Coin" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "SubmitAdminProposal sends a proposal to neutron's Admin module. This type of messages can be only executed by Neutron DAO.", + "type": "object", + "required": [ + "submit_admin_proposal" + ], + "properties": { + "submit_admin_proposal": { + "type": "object", + "required": [ + "admin_proposal" + ], + "properties": { + "admin_proposal": { + "$ref": "#/definitions/AdminProposal" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "TokenFactory message. Contracts can create denoms, namespaced under the contract's address. A contract may create any number of independent sub-denoms.", + "type": "object", + "required": [ + "create_denom" + ], + "properties": { + "create_denom": { + "type": "object", + "required": [ + "subdenom" + ], + "properties": { + "subdenom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "TokenFactory message. Contracts can change the admin of a denom that they are the admin of.", + "type": "object", + "required": [ + "change_admin" + ], + "properties": { + "change_admin": { + "type": "object", + "required": [ + "denom", + "new_admin_address" + ], + "properties": { + "denom": { + "type": "string" + }, + "new_admin_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "TokenFactory message. Contracts can mint native tokens for an existing factory denom that they are the admin of.", + "type": "object", + "required": [ + "mint_tokens" + ], + "properties": { + "mint_tokens": { + "type": "object", + "required": [ + "amount", + "denom", + "mint_to_address" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + }, + "mint_to_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "TokenFactory message. Contracts can burn native tokens for an existing factory denom that they are the admin of. Currently, the burn from address must be the admin contract.", + "type": "object", + "required": [ + "burn_tokens" + ], + "properties": { + "burn_tokens": { + "type": "object", + "required": [ + "amount", + "burn_from_address", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "burn_from_address": { + "description": "Must be set to `\"\"` for now", + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", + "type": "object", + "required": [ + "add_schedule" + ], + "properties": { + "add_schedule": { + "type": "object", + "required": [ + "msgs", + "name", + "period" + ], + "properties": { + "msgs": { + "description": "list of cosmwasm messages to be executed", + "type": "array", + "items": { + "$ref": "#/definitions/MsgExecuteContract" + } + }, + "name": { + "description": "Name of a new schedule. Needed to be able to `RemoveSchedule` and to log information about it", + "type": "string" + }, + "period": { + "description": "period in blocks with which `msgs` will be executed", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "RemoveSchedule removes the schedule with a given `name`. [Permissioned - DAO or Security DAO only]", + "type": "object", + "required": [ + "remove_schedule" + ], + "properties": { + "remove_schedule": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "type": "object", + "required": [ + "resubmit_failure" + ], + "properties": { + "resubmit_failure": { + "type": "object", + "required": [ + "failure_id" + ], + "properties": { + "failure_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + } + ] + }, + "ParamChange": { + "description": "ParamChange defines the struct for parameter change request.", + "type": "object", + "required": [ + "key", + "subspace", + "value" + ], + "properties": { + "key": { + "description": "*key** is a name of parameter. Unique for subspace.", + "type": "string" + }, + "subspace": { + "description": "*subspace** is a key of module to which the parameter to change belongs. Unique for each module.", + "type": "string" + }, + "value": { + "description": "*value** is a new value for given parameter. Non unique.", + "type": "string" + } + } + }, + "ParamChangePermission": { + "type": "object", + "required": [ + "params" + ], + "properties": { + "params": { + "type": "array", + "items": { + "$ref": "#/definitions/ParamPermission" + } + } + }, + "additionalProperties": false + }, + "ParamChangeProposal": { + "description": "ParamChangeProposal defines the struct for single parameter change proposal.", + "type": "object", + "required": [ + "description", + "param_changes", + "title" + ], + "properties": { + "description": { + "description": "*description** is a text description of proposal. Non unique.", + "type": "string" + }, + "param_changes": { + "description": "*param_changes** is a vector of params to be changed. Non unique.", + "type": "array", + "items": { + "$ref": "#/definitions/ParamChange" + } + }, + "title": { + "description": "*title** is a text title of proposal. Non unique.", + "type": "string" + } + } + }, + "ParamPermission": { + "type": "object", + "required": [ + "key", + "subspace" + ], + "properties": { + "key": { + "type": "string" + }, + "subspace": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Permission": { + "oneOf": [ + { + "type": "object", + "required": [ + "param_change_permission" + ], + "properties": { + "param_change_permission": { + "$ref": "#/definitions/ParamChangePermission" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_params_permission" + ], + "properties": { + "update_params_permission": { + "$ref": "#/definitions/UpdateParamsPermission" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "cron_permission" + ], + "properties": { + "cron_permission": { + "$ref": "#/definitions/CronPermission" + } + }, + "additionalProperties": false + } + ] + }, + "PinCodesProposal": { + "description": "Deprecated. PinCodesProposal defines the struct for pin contract codes proposal.", + "deprecated": true, + "type": "object", + "required": [ + "code_ids", + "description", + "title" + ], + "properties": { + "code_ids": { + "description": "*code_ids** is an array of codes to be pined.", + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + } + }, + "Plan": { + "description": "Plan defines the struct for planned upgrade.", + "type": "object", + "required": [ + "height", + "info", + "name" + ], + "properties": { + "height": { + "description": "*height** is a height at which the upgrade must be performed", + "type": "integer", + "format": "int64" + }, + "info": { + "description": "*info** is any application specific upgrade info to be included on-chain", + "type": "string" + }, + "name": { + "description": "*name** is a name for the upgrade", + "type": "string" + } + } + }, + "ProposalExecuteMessage": { + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" + } + } + }, + "ProtobufAny": { + "description": "Type for wrapping any protobuf message", + "type": "object", + "required": [ + "type_url", + "value" + ], + "properties": { + "type_url": { + "description": "*type_url** describes the type of the serialized message", + "type": "string" + }, + "value": { + "description": "*value** must be a valid serialized protocol buffer of the above specified type", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + }, + "RequestPacketTimeoutHeight": { + "type": "object", + "properties": { + "revision_height": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "revision_number": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + } + }, + "SoftwareUpgradeProposal": { + "description": "Deprecated. SoftwareUpgradeProposal defines the struct for software upgrade proposal.", + "deprecated": true, + "type": "object", + "required": [ + "description", + "plan", + "title" + ], + "properties": { + "description": { + "description": "*description** is a text description of proposal. Non unique.", + "type": "string" + }, + "plan": { + "description": "*plan** is a plan of upgrade.", + "allOf": [ + { + "$ref": "#/definitions/Plan" + } + ] + }, + "title": { + "description": "*title** is a text title of proposal. Non unique.", + "type": "string" + } + } + }, + "StakingMsg": { + "description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgDelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L81-L90). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "delegate" + ], + "properties": { + "delegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgUndelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L112-L121). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "undelegate" + ], + "properties": { + "undelegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgBeginRedelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L95-L105). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "redelegate" + ], + "properties": { + "redelegate": { + "type": "object", + "required": [ + "amount", + "dst_validator", + "src_validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "dst_validator": { + "type": "string" + }, + "src_validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "StrategyMsg": { + "oneOf": [ + { + "type": "string", + "enum": [ + "allow_all" + ] + }, + { + "type": "object", + "required": [ + "allow_only" + ], + "properties": { + "allow_only": { + "type": "array", + "items": { + "$ref": "#/definitions/Permission" + } + } + }, + "additionalProperties": false + } + ] + }, + "SudoContractProposal": { + "description": "Deprecated. SudoContractProposal defines the struct for sudo execution proposal.", + "deprecated": true, + "type": "object", + "required": [ + "contract", + "description", + "msg", + "title" + ], + "properties": { + "contract": { + "description": "*contract** is an address of contract to be executed.", + "type": "string" + }, + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "msg": { + "description": "**msg*** is a sudo message.", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + }, + "UnpinCodesProposal": { + "description": "Deprecated. UnpinCodesProposal defines the struct for unpin contract codes proposal.", + "deprecated": true, + "type": "object", + "required": [ + "code_ids", + "description", + "title" + ], + "properties": { + "code_ids": { + "description": "*code_ids** is an array of codes to be unpined.", + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + } + }, + "UpdateAdminProposal": { + "description": "Deprecated. UpdateAdminProposal defines the struct for update admin proposal.", + "deprecated": true, + "type": "object", + "required": [ + "contract", + "description", + "new_admin", + "title" + ], + "properties": { + "contract": { + "description": "*contract** is an address of contract to update admin.", + "type": "string" + }, + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "new_admin": { + "description": "**new_admin*** is an address of new admin", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + } + }, + "UpdateParamsPermission": { + "oneOf": [ + { + "type": "object", + "required": [ + "cron_update_params_permission" + ], + "properties": { + "cron_update_params_permission": { + "$ref": "#/definitions/CronUpdateParamsPermission" + } + }, + "additionalProperties": false + } + ] + }, + "UpgradeProposal": { + "description": "UpgradeProposal defines the struct for IBC upgrade proposal.", + "type": "object", + "required": [ + "description", + "plan", + "title", + "upgraded_client_state" + ], + "properties": { + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "plan": { + "description": "*plan** is a plan of upgrade.", + "allOf": [ + { + "$ref": "#/definitions/Plan" + } + ] + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + }, + "upgraded_client_state": { + "description": "*upgraded_client_state** is an upgraded client state.", + "allOf": [ + { + "$ref": "#/definitions/ProtobufAny" + } + ] + } + } + }, + "VoteOption": { + "type": "string", + "enum": [ + "yes", + "no", + "abstain", + "no_with_veto" + ] + }, + "WasmMsg": { + "description": "The message types of the wasm module.\n\nSee https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto", + "oneOf": [ + { + "description": "Dispatches a call to another contract at a known address (with known ABI).\n\nThis is translated to a [MsgExecuteContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L68-L78). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "contract_addr", + "funds", + "msg" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "msg": { + "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "instantiate" + ], + "properties": { + "instantiate": { + "type": "object", + "required": [ + "code_id", + "funds", + "label", + "msg" + ], + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + }, + "code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "label": { + "description": "A human-readable label for the contract.\n\nValid values should: - not be empty - not be bigger than 128 bytes (or some chain-specific limit) - not start / end with whitespace", + "type": "string" + }, + "msg": { + "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "migrate" + ], + "properties": { + "migrate": { + "type": "object", + "required": [ + "contract_addr", + "msg", + "new_code_id" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "msg": { + "description": "msg is the json-encoded MigrateMsg struct that will be passed to the new code", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "new_code_id": { + "description": "the code_id of the new logic to place in the given contract", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sets a new admin (for migrate) on the given contract. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "update_admin" + ], + "properties": { + "update_admin": { + "type": "object", + "required": [ + "admin", + "contract_addr" + ], + "properties": { + "admin": { + "type": "string" + }, + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Clears the admin on the given contract, so no more migration possible. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "clear_admin" + ], + "properties": { + "clear_admin": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/dao/neutron-chain-manager/schema/raw/instantiate.json b/contracts/dao/neutron-chain-manager/schema/raw/instantiate.json new file mode 100644 index 00000000..51d7ec02 --- /dev/null +++ b/contracts/dao/neutron-chain-manager/schema/raw/instantiate.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "initial_strategy_address" + ], + "properties": { + "initial_strategy_address": { + "description": "Defines the address for the initial strategy.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + } + } +} diff --git a/contracts/dao/neutron-chain-manager/schema/raw/migrate.json b/contracts/dao/neutron-chain-manager/schema/raw/migrate.json new file mode 100644 index 00000000..7fbe8c57 --- /dev/null +++ b/contracts/dao/neutron-chain-manager/schema/raw/migrate.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MigrateMsg", + "type": "object", + "additionalProperties": false +} diff --git a/contracts/dao/neutron-chain-manager/schema/raw/query.json b/contracts/dao/neutron-chain-manager/schema/raw/query.json new file mode 100644 index 00000000..37922f03 --- /dev/null +++ b/contracts/dao/neutron-chain-manager/schema/raw/query.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "strategies" + ], + "properties": { + "strategies": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/contracts/dao/neutron-chain-manager/schema/raw/response_to_strategies.json b/contracts/dao/neutron-chain-manager/schema/raw/response_to_strategies.json new file mode 100644 index 00000000..1e825ca7 --- /dev/null +++ b/contracts/dao/neutron-chain-manager/schema/raw/response_to_strategies.json @@ -0,0 +1,154 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Array_of_StrategyMsg", + "type": "array", + "items": { + "$ref": "#/definitions/StrategyMsg" + }, + "definitions": { + "CronPermission": { + "type": "object", + "required": [ + "add_schedule", + "remove_schedule" + ], + "properties": { + "add_schedule": { + "type": "boolean" + }, + "remove_schedule": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "CronUpdateParamsPermission": { + "type": "object", + "required": [ + "limit", + "security_address" + ], + "properties": { + "limit": { + "type": "boolean" + }, + "security_address": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "ParamChangePermission": { + "type": "object", + "required": [ + "params" + ], + "properties": { + "params": { + "type": "array", + "items": { + "$ref": "#/definitions/ParamPermission" + } + } + }, + "additionalProperties": false + }, + "ParamPermission": { + "type": "object", + "required": [ + "key", + "subspace" + ], + "properties": { + "key": { + "type": "string" + }, + "subspace": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Permission": { + "oneOf": [ + { + "type": "object", + "required": [ + "param_change_permission" + ], + "properties": { + "param_change_permission": { + "$ref": "#/definitions/ParamChangePermission" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_params_permission" + ], + "properties": { + "update_params_permission": { + "$ref": "#/definitions/UpdateParamsPermission" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "cron_permission" + ], + "properties": { + "cron_permission": { + "$ref": "#/definitions/CronPermission" + } + }, + "additionalProperties": false + } + ] + }, + "StrategyMsg": { + "oneOf": [ + { + "type": "string", + "enum": [ + "allow_all" + ] + }, + { + "type": "object", + "required": [ + "allow_only" + ], + "properties": { + "allow_only": { + "type": "array", + "items": { + "$ref": "#/definitions/Permission" + } + } + }, + "additionalProperties": false + } + ] + }, + "UpdateParamsPermission": { + "oneOf": [ + { + "type": "object", + "required": [ + "cron_update_params_permission" + ], + "properties": { + "cron_update_params_permission": { + "$ref": "#/definitions/CronUpdateParamsPermission" + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/dao/neutron-chain-manager/src/contract.rs b/contracts/dao/neutron-chain-manager/src/contract.rs new file mode 100644 index 00000000..eb9e1e32 --- /dev/null +++ b/contracts/dao/neutron-chain-manager/src/contract.rs @@ -0,0 +1,301 @@ +use crate::cron_module_param_types::{ + MsgUpdateParamsCron, ParamsRequestCron, ParamsResponseCron, MSG_TYPE_UPDATE_PARAMS_CRON, + PARAMS_QUERY_PATH_CRON, +}; +#[cfg(not(feature = "library"))] +use cosmwasm_std::entry_point; +use cosmwasm_std::{ + to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Response, StdResult, +}; +use cw2::set_contract_version; +use neutron_sdk::bindings::msg::{AdminProposal, NeutronMsg, ProposalExecuteMessage}; +use neutron_sdk::proto_types::neutron::cron::QueryParamsRequest; +use neutron_sdk::stargate::aux::make_stargate_query; + +use crate::error::ContractError; +use crate::msg::{ + ExecuteMsg, InstantiateMsg, MigrateMsg, Permission, ProposalExecuteMessageJSON, QueryMsg, + Strategy, StrategyMsg, +}; +use crate::state::STRATEGIES; + +pub(crate) const CONTRACT_NAME: &str = "crates.io:neutron-chain-manager"; +pub(crate) 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: InstantiateMsg, +) -> Result { + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + + STRATEGIES.save( + deps.storage, + msg.initial_strategy_address.clone(), + &Strategy::AllowAll, + )?; + + Ok(Response::new() + .add_attribute("action", "instantiate") + .add_attribute("init_allow_all_address", msg.initial_strategy_address)) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn execute( + deps: DepsMut, + _env: Env, + info: MessageInfo, + msg: ExecuteMsg, +) -> Result, ContractError> { + match msg { + ExecuteMsg::AddStrategy { address, strategy } => { + execute_add_strategy(deps, info, address, strategy) + } + ExecuteMsg::RemoveStrategy { address } => execute_remove_strategy(deps, info, address), + ExecuteMsg::ExecuteMessages { messages } => execute_execute_messages(deps, info, messages), + } +} + +pub fn execute_add_strategy( + deps: DepsMut, + info: MessageInfo, + address: Addr, + strategy: StrategyMsg, +) -> Result, ContractError> { + is_authorized(deps.as_ref(), info.sender.clone())?; + + // We add the new strategy, and then we check that it did not replace + // the only existing ALLOW_ALL strategy. + STRATEGIES.save(deps.storage, address.clone(), &strategy.clone().into())?; + if let StrategyMsg::AllowOnly(_) = strategy { + if no_admins_left(deps.as_ref())? { + return Err(ContractError::InvalidDemotion {}); + } + } + + Ok(Response::new() + .add_attribute("action", "execute_add_strategy") + .add_attribute("address", address)) +} + +pub fn execute_remove_strategy( + deps: DepsMut, + info: MessageInfo, + address: Addr, +) -> Result, ContractError> { + is_authorized(deps.as_ref(), info.sender.clone())?; + + // First we remove the strategy, then we check that it was not the only + // ALLOW_ALL strategy we had. + STRATEGIES.remove(deps.storage, address.clone()); + if no_admins_left(deps.as_ref())? { + return Err(ContractError::InvalidDemotion {}); + } + + Ok(Response::new() + .add_attribute("action", "execute_remove_strategy") + .add_attribute("address", address)) +} + +pub fn execute_execute_messages( + deps: DepsMut, + info: MessageInfo, + messages: Vec>, +) -> Result, ContractError> { + // If the sender doesn't have a strategy associated with them, abort immediately. + if !STRATEGIES.has(deps.storage, info.sender.clone()) { + return Err(ContractError::Unauthorized {}); + } + + let response = Response::new() + .add_attribute("action", "execute_execute_messages") + .add_attribute("address", info.sender.clone()); + + let strategy = STRATEGIES.load(deps.storage, info.sender)?; + match strategy { + Strategy::AllowAll => Ok(response + .add_attribute("strategy", "allow_all") + .add_messages(messages)), + Strategy::AllowOnly(_) => { + check_allow_only_permissions(deps.as_ref(), strategy.clone(), messages.clone())?; + Ok(response + .add_attribute("strategy", "allow_only") + .add_messages(messages)) + } + } +} + +fn is_authorized(deps: Deps, address: Addr) -> Result<(), ContractError> { + match STRATEGIES.load(deps.storage, address) { + Ok(Strategy::AllowAll) => Ok(()), + _ => Err(ContractError::Unauthorized {}), + } +} + +/// This function returns true if there is no more allow_all strategies left. +fn no_admins_left(deps: Deps) -> Result { + let not_found: bool = !STRATEGIES + .range(deps.storage, None, None, cosmwasm_std::Order::Ascending) + .collect::, _>>()? + .into_iter() + .any(|(_, strategy)| matches!(strategy, Strategy::AllowAll)); + + Ok(not_found) +} + +/// For every message, check whether we have the permission to execute it. +/// Any missing permission aborts the execution. Trying to execute any +/// unknown message aborts the execution. +fn check_allow_only_permissions( + deps: Deps, + strategy: Strategy, + messages: Vec>, +) -> Result<(), ContractError> { + for msg in messages.clone() { + if let CosmosMsg::Custom(neutron_msg) = msg { + check_neutron_msg(deps, strategy.clone(), neutron_msg)? + } else { + return Err(ContractError::Unauthorized {}); + } + } + + Ok(()) +} + +fn check_neutron_msg( + deps: Deps, + strategy: Strategy, + neutron_msg: NeutronMsg, +) -> Result<(), ContractError> { + match neutron_msg { + NeutronMsg::AddSchedule { .. } => { + if !strategy.has_cron_add_schedule_permission() { + return Err(ContractError::Unauthorized {}); + } + } + NeutronMsg::RemoveSchedule { name: _ } => { + if !strategy.has_cron_remove_schedule_permission() { + return Err(ContractError::Unauthorized {}); + } + } + NeutronMsg::SubmitAdminProposal { admin_proposal } => { + check_submit_admin_proposal_message(deps, strategy, admin_proposal)?; + } + _ => { + return Err(ContractError::Unauthorized {}); + } + } + + Ok(()) +} + +fn check_submit_admin_proposal_message( + deps: Deps, + strategy: Strategy, + proposal: AdminProposal, +) -> Result<(), ContractError> { + match proposal { + AdminProposal::ParamChangeProposal(proposal) => { + for param_change in proposal.param_changes { + if !strategy.has_param_change_permission(param_change) { + return Err(ContractError::Unauthorized {}); + } + } + } + AdminProposal::ProposalExecuteMessage(proposal) => { + check_proposal_execute_message(deps, strategy.clone(), proposal)?; + } + _ => { + return Err(ContractError::Unauthorized {}); + } + } + + Ok(()) +} + +/// Processes ProposalExecuteMessage messages. Message type has to be checked +/// as a string; after that, you can parse the JSON payload into a specific +/// message. +fn check_proposal_execute_message( + deps: Deps, + strategy: Strategy, + proposal: ProposalExecuteMessage, +) -> Result<(), ContractError> { + let typed_proposal: ProposalExecuteMessageJSON = + serde_json_wasm::from_str(proposal.message.as_str())?; + + if typed_proposal.type_field.as_str() == MSG_TYPE_UPDATE_PARAMS_CRON { + check_cron_update_msg_params(deps, strategy, proposal)?; + Ok(()) + } else { + Err(ContractError::Unauthorized {}) + } +} +/// Checks that the strategy owner is authorised to change the parameters of the +/// cron module. We query the current values for each parameter & compare them to +/// the values in the proposal; all modifications must be allowed by the strategy. +fn check_cron_update_msg_params( + deps: Deps, + strategy: Strategy, + proposal: ProposalExecuteMessage, +) -> Result<(), ContractError> { + let msg_update_params: MsgUpdateParamsCron = + serde_json_wasm::from_str(proposal.message.as_str())?; + + let cron_update_param_permission = strategy + .get_cron_update_param_permission() + .ok_or(ContractError::Unauthorized {})?; + + let cron_params = get_cron_params(deps, ParamsRequestCron {})?; + if cron_params.params.limit != msg_update_params.params.limit + && !cron_update_param_permission.limit + { + return Err(ContractError::Unauthorized {}); + } + + if cron_params.params.security_address != msg_update_params.params.security_address + && !cron_update_param_permission.security_address + { + return Err(ContractError::Unauthorized {}); + } + + Ok(()) +} + +/// Queries the parameters of the cron module. +pub fn get_cron_params(deps: Deps, req: ParamsRequestCron) -> StdResult { + make_stargate_query(deps, PARAMS_QUERY_PATH_CRON, QueryParamsRequest::from(req)) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { + match msg { + QueryMsg::Strategies {} => to_json_binary(&query_strategies(deps)?), + } +} + +/// No pagination is added because it's unlikely that there is going +/// to be more than 10 strategies. +pub fn query_strategies(deps: Deps) -> StdResult> { + let all_strategies: Vec<(Addr, StrategyMsg)> = STRATEGIES + .range(deps.storage, None, None, cosmwasm_std::Order::Ascending) + .map(|v| match v { + Ok((addr, Strategy::AllowAll)) => Ok((addr, StrategyMsg::AllowAll)), + Ok((addr, Strategy::AllowOnly(permissions))) => Ok(( + addr, + StrategyMsg::AllowOnly(permissions.values().cloned().collect::>()), + )), + Err(e) => Err(e), + }) + .collect::, _>>()?; + Ok(all_strategies) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result { + // Set contract to version to latest + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + Ok(Response::default()) +} diff --git a/contracts/dao/neutron-chain-manager/src/cron_module_param_types.rs b/contracts/dao/neutron-chain-manager/src/cron_module_param_types.rs new file mode 100644 index 00000000..7ae68fa2 --- /dev/null +++ b/contracts/dao/neutron-chain-manager/src/cron_module_param_types.rs @@ -0,0 +1,71 @@ +use neutron_sdk::proto_types::neutron::cron::QueryParamsRequest; +use schemars::JsonSchema; +use serde::de::{self, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use std::fmt; + +pub const PARAMS_QUERY_PATH_CRON: &str = "/neutron.cron.Query/Params"; +pub const MSG_TYPE_UPDATE_PARAMS_CRON: &str = "/neutron.cron.MsgUpdateParams"; + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct MsgUpdateParamsCron { + pub params: ParamsCron, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct ParamsCron { + pub security_address: String, + #[serde(deserialize_with = "deserialize_cron_limit")] + pub limit: u64, +} + +/// Unfortunately, stargate returns a string instead of a number for the +/// limit parameter, so we need to have a custom deserializer for this +/// field. +fn deserialize_cron_limit<'de, D>(deserializer: D) -> Result +where + D: Deserializer<'de>, +{ + struct StringOrNumberVisitor; + + impl<'de> Visitor<'de> for StringOrNumberVisitor { + type Value = u64; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a string or a number") + } + + fn visit_u64(self, value: u64) -> Result + where + E: de::Error, + { + Ok(value) + } + + fn visit_str(self, value: &str) -> Result + where + E: de::Error, + { + value.parse::().map_err(de::Error::custom) + } + } + + deserializer.deserialize_any(StringOrNumberVisitor) +} + +/// The types below are used for querying cron module parameters via stargate. +#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, ::prost::Message)] +pub struct ParamsRequestCron {} + +impl From for QueryParamsRequest { + fn from(_: ParamsRequestCron) -> QueryParamsRequest { + QueryParamsRequest {} + } +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct ParamsResponseCron { + pub params: ParamsCron, +} diff --git a/contracts/dao/neutron-chain-manager/src/error.rs b/contracts/dao/neutron-chain-manager/src/error.rs new file mode 100644 index 00000000..8844a724 --- /dev/null +++ b/contracts/dao/neutron-chain-manager/src/error.rs @@ -0,0 +1,29 @@ +use cosmwasm_std::StdError; +use thiserror::Error; + +#[derive(Error, Debug, PartialEq)] +pub enum ContractError { + #[error("{0}")] + Std(#[from] StdError), + + #[error("Initial strategy of a wrong type was submitted")] + InvalidInitialStrategy {}, + + #[error("Unauthorized")] + Unauthorized {}, + + // This error is returned when you try to remove the only existing + // ALLOW_ALL strategy. + #[error("An invalid demotion was attempted")] + InvalidDemotion {}, + + // A variant for serde_json_wasm deserialization errors. + #[error("Deserialization error: {0}")] + DeserializationError(String), +} + +impl From for ContractError { + fn from(err: serde_json_wasm::de::Error) -> ContractError { + ContractError::DeserializationError(err.to_string()) + } +} diff --git a/contracts/dao/neutron-chain-manager/src/lib.rs b/contracts/dao/neutron-chain-manager/src/lib.rs new file mode 100644 index 00000000..bbf9755f --- /dev/null +++ b/contracts/dao/neutron-chain-manager/src/lib.rs @@ -0,0 +1,8 @@ +pub mod contract; +mod error; +pub mod msg; +pub mod state; + +mod cron_module_param_types; +#[cfg(test)] +mod testing; diff --git a/contracts/dao/neutron-chain-manager/src/msg.rs b/contracts/dao/neutron-chain-manager/src/msg.rs new file mode 100644 index 00000000..92ffc9fc --- /dev/null +++ b/contracts/dao/neutron-chain-manager/src/msg.rs @@ -0,0 +1,210 @@ +use std::collections::HashMap; + +use cosmwasm_schema::{cw_serde, QueryResponses}; +use cosmwasm_std::{Addr, CosmosMsg}; +use neutron_sdk::bindings::msg::{NeutronMsg, ParamChange}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use serde_with::{json::JsonString, serde_as}; + +#[cw_serde] +#[serde(rename_all = "snake_case")] +pub struct InstantiateMsg { + /// Defines the address for the initial strategy. + pub initial_strategy_address: Addr, +} + +#[cw_serde] +pub enum ExecuteMsg { + AddStrategy { + address: Addr, + strategy: StrategyMsg, + }, + RemoveStrategy { + address: Addr, + }, + ExecuteMessages { + messages: Vec>, + }, +} + +#[cw_serde] +#[derive(QueryResponses)] +pub enum QueryMsg { + #[returns(Vec < StrategyMsg >)] + Strategies {}, +} + +#[cw_serde] +#[serde(rename_all = "snake_case")] +pub struct MigrateMsg {} + +// StrategyMsg is used only as UI struct to simplify intaraction with the contract +// Internally we work with `Strategy` +#[cw_serde] +pub enum StrategyMsg { + AllowAll, + AllowOnly(Vec), +} + +#[derive(JsonSchema)] +#[serde_as] +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)] +pub enum Strategy { + AllowAll, + // the macro param required because serde allows only string as keys of hashmap during serialisation + AllowOnly(#[serde_as(as = "HashMap")] HashMap), +} + +impl From for Strategy { + fn from(value: StrategyMsg) -> Self { + match value { + StrategyMsg::AllowAll => Strategy::AllowAll, + StrategyMsg::AllowOnly(list_permissions) => { + let mut perms: HashMap = HashMap::new(); + for p in list_permissions { + perms.insert(p.clone().into(), p); + } + Strategy::AllowOnly(perms) + } + } + } +} + +impl Strategy { + pub fn has_cron_add_schedule_permission(&self) -> bool { + match self { + Strategy::AllowAll => true, + Strategy::AllowOnly(permissions) => { + match permissions.get(&PermissionType::CronPermission) { + Some(Permission::CronPermission(permission)) => permission.add_schedule, + _ => false, + } + } + } + } + pub fn has_cron_remove_schedule_permission(&self) -> bool { + match self { + Strategy::AllowAll => true, + Strategy::AllowOnly(permissions) => { + match permissions.get(&PermissionType::CronPermission) { + Some(Permission::CronPermission(permission)) => permission.remove_schedule, + _ => false, + } + } + } + } + pub fn has_param_change_permission(&self, param_change: ParamChange) -> bool { + match self { + Strategy::AllowAll => true, + Strategy::AllowOnly(permissions) => { + match permissions.get(&PermissionType::ParamChangePermission) { + Some(Permission::ParamChangePermission(param_change_permissions)) => { + for param_change_permission in param_change_permissions.params.clone() { + if param_change.subspace == param_change_permission.subspace + && param_change.key == param_change_permission.key + { + return true; + } + } + false + } + _ => false, + } + } + } + } + + pub fn get_cron_update_param_permission(&self) -> Option { + match self { + Strategy::AllowAll => Some(CronUpdateParamsPermission { + security_address: true, + limit: true, + }), + Strategy::AllowOnly(permissions) => { + match permissions.get(&PermissionType::UpdateParamsPermission) { + Some(Permission::UpdateParamsPermission(update_params_permission)) => { + match update_params_permission { + UpdateParamsPermission::CronUpdateParamsPermission( + cron_update_params, + ) => Some(cron_update_params.clone()), + } + } + _ => None, + } + } + } + } +} + +#[cw_serde] +#[derive(Eq)] +pub enum Permission { + // Deprecated, for legacy parameter updates using `params` module. + ParamChangePermission(ParamChangePermission), + // For new-style parameter updates. + UpdateParamsPermission(UpdateParamsPermission), + CronPermission(CronPermission), +} + +impl From for PermissionType { + fn from(value: Permission) -> Self { + match value { + Permission::ParamChangePermission(_) => PermissionType::ParamChangePermission, + Permission::UpdateParamsPermission(_) => PermissionType::UpdateParamsPermission, + Permission::CronPermission(_) => PermissionType::CronPermission, + } + } +} + +#[cw_serde] +#[derive(Hash, Eq)] +pub enum PermissionType { + ParamChangePermission, + UpdateParamsPermission, + CronPermission, +} + +#[cw_serde] +#[derive(Eq)] +#[serde(rename_all = "snake_case")] +pub struct ParamChangePermission { + pub params: Vec, +} + +#[cw_serde] +#[derive(Eq)] +#[serde(rename_all = "snake_case")] +pub struct ParamPermission { + pub subspace: String, + pub key: String, +} + +#[cw_serde] +#[derive(Eq)] +pub enum UpdateParamsPermission { + CronUpdateParamsPermission(CronUpdateParamsPermission), +} + +#[cw_serde] +#[derive(Eq)] +#[serde(rename_all = "snake_case")] +pub struct CronUpdateParamsPermission { + pub security_address: bool, + pub limit: bool, +} + +#[cw_serde] +#[derive(Eq)] +#[serde(rename_all = "snake_case")] +pub struct CronPermission { + pub add_schedule: bool, + pub remove_schedule: bool, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct ProposalExecuteMessageJSON { + #[serde(rename = "@type")] + pub type_field: String, +} diff --git a/contracts/dao/neutron-chain-manager/src/state.rs b/contracts/dao/neutron-chain-manager/src/state.rs new file mode 100644 index 00000000..370e53ca --- /dev/null +++ b/contracts/dao/neutron-chain-manager/src/state.rs @@ -0,0 +1,6 @@ +use crate::msg::Strategy; +use cosmwasm_std::Addr; +use cw_storage_plus::Map; + +/// Defines a mapping from an address to a strategy associated with the address. +pub const STRATEGIES: Map = Map::new("chain-manager-strategies"); diff --git a/contracts/dao/neutron-chain-manager/src/testing/mock_querier.rs b/contracts/dao/neutron-chain-manager/src/testing/mock_querier.rs new file mode 100644 index 00000000..61372343 --- /dev/null +++ b/contracts/dao/neutron-chain-manager/src/testing/mock_querier.rs @@ -0,0 +1,64 @@ +use crate::cron_module_param_types::{ParamsCron, ParamsResponseCron}; +use cosmwasm_std::testing::{MockApi, MockQuerier, MockStorage}; +use cosmwasm_std::{ + from_json, to_json_binary, ContractResult, Empty, OwnedDeps, Querier, QuerierResult, + QueryRequest, SystemError, SystemResult, +}; +use std::marker::PhantomData; + +pub fn mock_dependencies() -> OwnedDeps { + let custom_storage = MockStorage::default(); + let custom_querier = WasmMockQuerier::new(MockQuerier::new(&[])); + + OwnedDeps { + storage: custom_storage, + api: MockApi::default(), + querier: custom_querier, + custom_query_type: PhantomData, + } +} + +pub struct WasmMockQuerier { + base: MockQuerier, +} + +impl Querier for WasmMockQuerier { + fn raw_query(&self, bin_request: &[u8]) -> QuerierResult { + let request: QueryRequest = match from_json(bin_request) { + Ok(v) => v, + Err(e) => { + return QuerierResult::Err(SystemError::InvalidRequest { + error: format!("Parsing query request: {}", e), + request: bin_request.into(), + }); + } + }; + self.handle_query(&request) + } +} + +impl WasmMockQuerier { + pub fn handle_query(&self, request: &QueryRequest) -> QuerierResult { + match &request { + QueryRequest::Stargate { path, data: _ } => match path.as_str() { + "/neutron.cron.Query/Params" => { + let resp = to_json_binary(&ParamsResponseCron { + params: ParamsCron { + security_address: "neutron_dao_address".to_string(), + limit: 10, + }, + }); + SystemResult::Ok(ContractResult::from(resp)) + } + _ => todo!(), + }, + _ => self.base.handle_query(request), + } + } +} + +impl WasmMockQuerier { + fn new(base: MockQuerier) -> WasmMockQuerier { + WasmMockQuerier { base } + } +} diff --git a/contracts/dao/neutron-chain-manager/src/testing/mod.rs b/contracts/dao/neutron-chain-manager/src/testing/mod.rs new file mode 100644 index 00000000..a1e507b6 --- /dev/null +++ b/contracts/dao/neutron-chain-manager/src/testing/mod.rs @@ -0,0 +1,2 @@ +mod mock_querier; +mod tests; diff --git a/contracts/dao/neutron-chain-manager/src/testing/tests.rs b/contracts/dao/neutron-chain-manager/src/testing/tests.rs new file mode 100644 index 00000000..6cc412cf --- /dev/null +++ b/contracts/dao/neutron-chain-manager/src/testing/tests.rs @@ -0,0 +1,659 @@ +use crate::contract::{ + execute_add_strategy, execute_execute_messages, execute_remove_strategy, instantiate, +}; +use crate::error::ContractError::{InvalidDemotion, Unauthorized}; +use crate::msg::InstantiateMsg; +use crate::msg::Permission::{CronPermission, ParamChangePermission, UpdateParamsPermission}; +use crate::msg::UpdateParamsPermission::CronUpdateParamsPermission as CronUpdateParamsPermissionEnumField; +use crate::msg::{CronPermission as CronPermissionType, CronUpdateParamsPermission, StrategyMsg}; +use crate::msg::{ParamChangePermission as ParamChangePermissionType, ParamPermission}; +use crate::testing::mock_querier::mock_dependencies; +use cosmwasm_std::testing::{mock_env, mock_info}; +use cosmwasm_std::{Addr, BankMsg, Coin, CosmosMsg, Uint128}; +use neutron_sdk::bindings::msg::{ + AdminProposal, ClientUpdateProposal, NeutronMsg, ParamChange, ParamChangeProposal, + ProposalExecuteMessage, +}; + +#[test] +fn test_instantiate() { + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info("addr1", &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); +} + +#[test] +fn test_add_strategy() { + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info("addr1", &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + // Scenario 1: An ALLOW_ALL strategy is added for a new address (passes). + let info = mock_info("neutron_dao_address", &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowAll, + ) + .unwrap(); + + // Scenario 2: An ALLOW_ONLY strategy is added for a new address (passes). + let info = mock_info("neutron_dao_address", &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr2".to_string()), + StrategyMsg::AllowOnly(vec![CronPermission(CronPermissionType { + add_schedule: true, + remove_schedule: true, + })]), + ) + .unwrap(); +} + +/// An ALLOW_ALL strategy is added for an existing ALLOW_ONLY address (passes, +/// the promoted address can make privileged actions). +#[test] +fn test_add_strategy_promotion() { + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info("addr1", &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = mock_info("neutron_dao_address", &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr2".to_string()), + StrategyMsg::AllowOnly(vec![CronPermission(CronPermissionType { + add_schedule: true, + remove_schedule: true, + })]), + ) + .unwrap(); + + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr2".to_string()), + StrategyMsg::AllowAll, + ) + .unwrap(); + let info = mock_info("addr2", &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr3".to_string()), + StrategyMsg::AllowAll, + ) + .unwrap(); +} + +/// An ALLOW_ONLY strategy is added for one of the existing ALLOW_ALL address +/// (passes, the demoted address can not make privileged actions). +#[test] +fn test_add_strategy_demotion() { + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info("addr1", &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = mock_info("neutron_dao_address", &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowAll, + ) + .unwrap(); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![CronPermission(CronPermissionType { + add_schedule: true, + remove_schedule: true, + })]), + ) + .unwrap(); + let info = mock_info("addr1", &[]); + let err = execute_add_strategy( + deps.as_mut(), + info, + Addr::unchecked("addr2".to_string()), + StrategyMsg::AllowAll, + ) + .unwrap_err(); + assert_eq!(err, Unauthorized {}) +} + +/// An ALLOW_ONLY strategy is added for the only existing ALLOW_ALL address +/// (fails). +#[test] +fn test_add_strategy_invalid_demotion() { + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info("addr1", &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = mock_info("neutron_dao_address", &[]); + let err = execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("neutron_dao_address".to_string()), + StrategyMsg::AllowOnly(vec![CronPermission(CronPermissionType { + add_schedule: true, + remove_schedule: true, + })]), + ) + .unwrap_err(); + assert_eq!(err, InvalidDemotion {}); +} + +#[test] +fn test_remove_strategy() { + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info("addr1", &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = mock_info("neutron_dao_address", &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowAll, + ) + .unwrap(); + execute_remove_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + ) + .unwrap(); + + let info = mock_info("addr1", &[]); + let err = execute_add_strategy( + deps.as_mut(), + info, + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowAll, + ) + .unwrap_err(); + assert_eq!(err, Unauthorized {}) +} + +#[test] +fn test_remove_strategy_invalid_demotion() { + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info("neutron_dao_address", &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let err = execute_remove_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("neutron_dao_address".to_string()), + ) + .unwrap_err(); + assert_eq!(err, InvalidDemotion {}); +} + +/// Checks that if you have permissions, you can change both parameters of the cron +/// module (new style parameter changes). NOTE: this does not check that the +/// parameters have actually been changed. +#[test] +pub fn test_execute_execute_message_update_params_cron_authorized() { + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: r#"{"@type":"/neutron.cron.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {"security_address": "addr1", "limit": 16}}"# + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info("neutron_dao_address", &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = mock_info("neutron_dao_address", &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateParamsPermission( + CronUpdateParamsPermissionEnumField(CronUpdateParamsPermission { + security_address: true, + limit: true, + }), + )]), + ) + .unwrap(); + + let info = mock_info("addr1", &[]); + execute_execute_messages(deps.as_mut(), info.clone(), vec![msg]).unwrap(); +} + +/// Checks that unsupported message types inside a ProposalExecuteMessage are not +/// executed. +#[test] +pub fn test_execute_execute_message_unsupported_message_type_unauthorized() { + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: r#"{"@type":"/neutron.cron.MsgUnsupported", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {"security_address": "addr1", "limit": 16}}"# + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info("neutron_dao_address", &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = mock_info("neutron_dao_address", &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateParamsPermission( + CronUpdateParamsPermissionEnumField(CronUpdateParamsPermission { + security_address: true, + limit: true, + }), + )]), + ) + .unwrap(); + + let info = mock_info("addr1", &[]); + let err = execute_execute_messages(deps.as_mut(), info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}) +} + +/// Checks that you can't check the limit if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_cron_unauthorized_limit() { + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: r#"{"@type":"/neutron.cron.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {"security_address": "neutron_dao_address", "limit": 16}}"# + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info("neutron_dao_address", &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = mock_info("neutron_dao_address", &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateParamsPermission( + CronUpdateParamsPermissionEnumField(CronUpdateParamsPermission { + security_address: true, + limit: false, + }), + )]), + ) + .unwrap(); + + let info = mock_info("addr1", &[]); + let err = execute_execute_messages(deps.as_mut(), info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}) +} + +/// Checks that you can't check the security_address if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_cron_unauthorized_security_address() { + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: r#"{"@type":"/neutron.cron.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {"security_address": "addr1", "limit": 10}}"# + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info("neutron_dao_address", &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = mock_info("neutron_dao_address", &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateParamsPermission( + CronUpdateParamsPermissionEnumField(CronUpdateParamsPermission { + security_address: false, + limit: true, + }), + )]), + ) + .unwrap(); + + let info = mock_info("addr1", &[]); + let err = execute_execute_messages(deps.as_mut(), info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can update a legacy param if you have the necessary ALLOW_ONLY permission. +#[test] +pub fn test_execute_execute_message_param_change_success() { + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ParamChangeProposal(ParamChangeProposal { + title: "test_proposal".to_string(), + description: "Test proposal".to_string(), + param_changes: vec![ParamChange { + subspace: "globalfee".to_string(), + key: "MinimumGasPricesParam".to_string(), + value: "1000".to_string(), + }], + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info("neutron_dao_address", &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = mock_info("neutron_dao_address", &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![ParamChangePermission(ParamChangePermissionType { + params: vec![ParamPermission { + subspace: "globalfee".to_string(), + key: "MinimumGasPricesParam".to_string(), + }], + })]), + ) + .unwrap(); + + let info = mock_info("addr1", &[]); + execute_execute_messages(deps.as_mut(), info.clone(), vec![msg]).unwrap(); +} + +/// Checks that you can not update a legacy param without the necessary ALLOW_ONLY permission. +/// In this scenario, the subspace permission is correct, but the key permission is incorrect. +#[test] +pub fn test_execute_execute_message_param_change_unauthorized_key() { + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ParamChangeProposal(ParamChangeProposal { + title: "test_proposal".to_string(), + description: "Test proposal".to_string(), + param_changes: vec![ParamChange { + subspace: "globalfee".to_string(), + key: "MinimumGasPricesParam".to_string(), + value: "1000".to_string(), + }], + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info("neutron_dao_address", &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = mock_info("neutron_dao_address", &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![ParamChangePermission(ParamChangePermissionType { + params: vec![ParamPermission { + subspace: "globalfee".to_string(), + key: "0xdeadbeef".to_string(), + }], + })]), + ) + .unwrap(); + + let info = mock_info("addr1", &[]); + let err = execute_execute_messages(deps.as_mut(), info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can not update a legacy param without the necessary ALLOW_ONLY permission. +/// In this scenario, the key permission is correct, but the subspace permission is incorrect. +#[test] +pub fn test_execute_execute_message_param_change_unauthorized_subspace() { + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ParamChangeProposal(ParamChangeProposal { + title: "test_proposal".to_string(), + description: "Test proposal".to_string(), + param_changes: vec![ParamChange { + subspace: "globalfee".to_string(), + key: "MinimumGasPricesParam".to_string(), + value: "1000".to_string(), + }], + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info("neutron_dao_address", &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = mock_info("neutron_dao_address", &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![ParamChangePermission(ParamChangePermissionType { + params: vec![ParamPermission { + subspace: "0xdeadbeef".to_string(), + key: "MinimumGasPricesParam".to_string(), + }], + })]), + ) + .unwrap(); + + let info = mock_info("addr1", &[]); + let err = execute_execute_messages(deps.as_mut(), info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can not execute a message that the contract manager +/// doesn't have specific handlers for. +#[test] +pub fn test_execute_execute_unknown_message() { + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info("neutron_dao_address", &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = mock_info("neutron_dao_address", &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![ParamChangePermission(ParamChangePermissionType { + params: vec![ParamPermission { + subspace: "0xdeadbeef".to_string(), + key: "0xdeadbeef".to_string(), + }], + })]), + ) + .unwrap(); + + let msg = CosmosMsg::Bank(BankMsg::Burn { + amount: vec![Coin::new(42, "0xdeadbeef".to_string())], + }); + + let info = mock_info("addr1", &[]); + let err = execute_execute_messages(deps.as_mut(), info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); + + let msg = CosmosMsg::Custom(NeutronMsg::BurnTokens { + denom: "0xdeadbeef".to_string(), + amount: Uint128::new(42), + burn_from_address: "".to_string(), + }); + + let info = mock_info("addr1", &[]); + let err = execute_execute_messages(deps.as_mut(), info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); + + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ClientUpdateProposal(ClientUpdateProposal { + title: "0xdeadbeef".to_string(), + description: "0xdeadbeef".to_string(), + subject_client_id: "0xdeadbeef".to_string(), + substitute_client_id: "0xdeadbeef".to_string(), + }), + }); + + let info = mock_info("addr1", &[]); + let err = execute_execute_messages(deps.as_mut(), info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +}