diff --git a/Cargo.lock b/Cargo.lock index 7b6e629..2fc1914 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ahash" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ "getrandom", "once_cell", @@ -15,13 +15,13 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[package]] name = "astro-satellite" -version = "1.1.0" +version = "1.2.0" dependencies = [ "astro-satellite-package", "astroport-ibc", @@ -30,31 +30,15 @@ dependencies = [ "cosmwasm-std", "cosmwasm-storage", "cw-storage-plus 0.15.1", - "cw-utils 0.15.1", - "cw2 0.15.1", + "cw2 1.1.2", "ibc-controller-package", - "itertools", + "itertools 0.12.1", "thiserror", ] -[[package]] -name = "astro-satellite-neutron" -version = "1.1.0" -dependencies = [ - "astro-satellite", - "astro-satellite-package", - "astroport-ibc", - "astroport-mocks", - "cosmwasm-schema", - "cosmwasm-std", - "cw-utils 0.15.1", - "cw2 0.15.1", - "neutron-sdk", -] - [[package]] name = "astro-satellite-package" -version = "1.0.0" +version = "1.2.0" dependencies = [ "astroport-governance", "cosmwasm-schema", @@ -64,30 +48,32 @@ dependencies = [ [[package]] name = "astroport" version = "2.10.0" -source = "git+https://github.com/astroport-fi/astroport-core?branch=feat/merge_hidden_2023_05_22#8d8e65566d17c2933b1fc9367af2d654ac79c856" +source = "git+https://github.com/astroport-fi/astroport-core?branch=feat/merge_hidden_2023_05_22#11e7a81d4b18a40bed916177061a549633e02b1b" dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 0.15.1", - "cw-utils 1.0.1", + "cw-utils 1.0.3", "cw20 0.15.1", "cw3", - "itertools", + "itertools 0.10.5", "uint", ] [[package]] name = "astroport-cw20-ics20" -version = "0.15.1" +version = "0.15.1-astroport" dependencies = [ "cosmwasm-schema", + "cosmwasm-std", + "cw2 1.1.2", "cw20-ics20", ] [[package]] name = "astroport-governance" version = "1.2.0" -source = "git+https://github.com/astroport-fi/astroport-governance#f0ef7c6dde76fc77ce360262923366a5cde3c3f8" +source = "git+https://github.com/astroport-fi/astroport-governance#182dd5bc201dd634995b5e4dc9e2774495693703" dependencies = [ "astroport", "cosmwasm-schema", @@ -98,7 +84,7 @@ dependencies = [ [[package]] name = "astroport-ibc" -version = "1.2.1" +version = "1.3.0" dependencies = [ "cosmwasm-schema", ] @@ -112,34 +98,22 @@ dependencies = [ "astro-satellite-package", "astroport-ibc", "cosmwasm-std", - "cw-multi-test 0.16.5", + "cw-multi-test", "schemars", "serde", ] -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - [[package]] name = "base16ct" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" - -[[package]] -name = "base64" -version = "0.13.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64" -version = "0.21.2" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -173,24 +147,21 @@ dependencies = [ [[package]] name = "bnum" -version = "0.7.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "845141a4fade3f790628b7daaaa298a25b204fb28907eb54febe5142db6ce653" +checksum = "56953345e39537a3e18bdaeba4cb0c58a78c1f61f361dc0fa7c5c7340ae87c5f" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" -dependencies = [ - "serde", -] +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cfg-if" @@ -200,28 +171,18 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "const-oid" -version = "0.9.2" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" - -[[package]] -name = "cosmos-sdk-proto" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4776e787b24d9568dd61d3237eeb4eb321d622fb881b858c7b82806420e87d4" -dependencies = [ - "prost 0.11.9", - "prost-types", - "tendermint-proto", -] +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "cosmwasm-crypto" -version = "1.3.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51dd316b3061747d6f57c1c4a131a5ba2f9446601a9276d05a4d25ab2ce0a7e0" +checksum = "9934c79e58d9676edfd592557dee765d2a6ef54c09d5aa2edb06156b00148966" dependencies = [ "digest 0.10.7", + "ecdsa", "ed25519-zebra", "k256", "rand_core 0.6.4", @@ -230,18 +191,18 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.3.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b14230c6942a301afb96f601af97ae09966601bd1007067a2c7fe8ffcfe303" +checksum = "bc5e72e330bd3bdab11c52b5ecbdeb6a8697a004c57964caeb5d876f0b088b3c" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.3.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1027bdd5941b7d4b45bd773b6d88818dcc043e8db68916bfbd5caf971024dbea" +checksum = "ac3e3a2136e2a60e8b6582f5dffca5d1a683ed77bf38537d330bc1dfccd69010" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -252,9 +213,9 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.3.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6e069f6e65a9a1f55f8d7423703bed35e9311d029d91b357b17a07010d95cd7" +checksum = "f5d803bea6bd9ed61bd1ee0b4a2eb09ee20dbb539cc6e0b8795614d20952ebb1" dependencies = [ "proc-macro2", "quote", @@ -263,11 +224,12 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.3.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c27a06f0f6c35b178563c6b1044245b3f750c4a66d9f6d2b942a6b29ad77d3ae" +checksum = "ef8666e572a3a2519010dde88c04d16e9339ae751b56b2bb35081fe3f7d6be74" dependencies = [ - "base64 0.13.1", + "base64", + "bech32", "bnum", "cosmwasm-crypto", "cosmwasm-derive", @@ -277,15 +239,16 @@ dependencies = [ "schemars", "serde", "serde-json-wasm", - "sha2 0.10.6", + "sha2 0.10.8", + "static_assertions", "thiserror", ] [[package]] name = "cosmwasm-storage" -version = "1.2.5" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3737a3aac48f5ed883b5b73bfb731e77feebd8fc6b43419844ec2971072164d" +checksum = "66de2ab9db04757bcedef2b5984fbe536903ada4a8a9766717a4a71197ef34f6" dependencies = [ "cosmwasm-std", "serde", @@ -293,9 +256,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.7" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -308,9 +271,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.4.9" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", "rand_core 0.6.4", @@ -358,38 +321,21 @@ dependencies = [ [[package]] name = "cw-multi-test" -version = "0.15.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e81b4a7821d5eeba0d23f737c16027b39a600742ca8c32eb980895ffd270f4" -dependencies = [ - "anyhow", - "cosmwasm-std", - "cosmwasm-storage", - "cw-storage-plus 0.15.1", - "cw-utils 0.15.1", - "derivative", - "itertools", - "prost 0.9.0", - "schemars", - "serde", - "thiserror", -] - -[[package]] -name = "cw-multi-test" -version = "0.16.5" -source = "git+https://github.com/astroport-fi/cw-multi-test.git?rev=269a2c829d1ad25d67caa4600f72d2a21fb8fdeb#269a2c829d1ad25d67caa4600f72d2a21fb8fdeb" +checksum = "cc392a5cb7e778e3f90adbf7faa43c4db7f35b6623224b08886d796718edb875" dependencies = [ "anyhow", + "bech32", "cosmwasm-std", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.3", "derivative", - "itertools", - "k256", - "prost 0.9.0", + "itertools 0.12.1", + "prost", "schemars", "serde", + "sha2 0.10.8", "thiserror", ] @@ -406,9 +352,9 @@ dependencies = [ [[package]] name = "cw-storage-plus" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f0e92a069d62067f3472c62e30adedb4cab1754725c0f2a682b3128d2bf3c79" +checksum = "d5ff29294ee99373e2cd5fd21786a3c0ced99a52fec2ca347d565489c61b723c" dependencies = [ "cosmwasm-std", "schemars", @@ -432,13 +378,13 @@ dependencies = [ [[package]] name = "cw-utils" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c80e93d1deccb8588db03945016a292c3c631e6325d349ebb35d2db6f4f946f7" +checksum = "1c4a657e5caacc3a0d00ee96ca8618745d050b8f757c709babafb81208d4239c" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw2 1.0.1", + "cw2 1.1.2", "schemars", "semver", "serde", @@ -460,15 +406,17 @@ dependencies = [ [[package]] name = "cw2" -version = "1.0.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb70cee2cf0b4a8ff7253e6bc6647107905e8eb37208f87d54f67810faa62f8" +checksum = "c6c120b24fbbf5c3bedebb97f2cc85fbfa1c3287e09223428e7e597b5293c1fa" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-storage-plus 1.1.0", + "cw-storage-plus 1.2.0", "schemars", + "semver", "serde", + "thiserror", ] [[package]] @@ -486,13 +434,13 @@ dependencies = [ [[package]] name = "cw20" -version = "1.0.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91666da6c7b40c8dd5ff94df655a28114efc10c79b70b4d06f13c31e37d60609" +checksum = "526e39bb20534e25a1cd0386727f0038f4da294e5e535729ba3ef54055246abd" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-utils 1.0.1", + "cw-utils 1.0.3", "schemars", "serde", ] @@ -518,14 +466,14 @@ dependencies = [ [[package]] name = "cw3" -version = "1.0.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fe0b587008aa221cd2a2579a21990a28c4347dc53ad43167c68ad765f5b6efa" +checksum = "2967fbd073d4b626dd9e7148e05a84a3bebd9794e71342e12351110ffbb12395" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-utils 1.0.1", - "cw20 1.0.1", + "cw-utils 1.0.3", + "cw20 1.1.2", "schemars", "serde", "thiserror", @@ -533,20 +481,14 @@ dependencies = [ [[package]] name = "der" -version = "0.6.1" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "zeroize", ] -[[package]] -name = "deranged" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" - [[package]] name = "derivative" version = "2.2.0" @@ -574,26 +516,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", + "const-oid", "crypto-common", "subtle", ] [[package]] name = "dyn-clone" -version = "1.0.11" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "ecdsa" -version = "0.14.8" +version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", + "digest 0.10.7", "elliptic-curve", "rfc6979", "signature", + "spki", ] [[package]] @@ -613,19 +558,18 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "elliptic-curve" -version = "0.12.3" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", - "der", "digest 0.10.7", "ff", "generic-array", @@ -639,23 +583,14 @@ dependencies = [ [[package]] name = "ff" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ "rand_core 0.6.4", "subtle", ] -[[package]] -name = "flex-error" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c606d892c9de11507fa0dcffc116434f94e105d0bbdc4e405b61519464c49d7b" -dependencies = [ - "paste", -] - [[package]] name = "forward_ref" version = "1.0.0" @@ -670,13 +605,14 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", @@ -685,9 +621,9 @@ dependencies = [ [[package]] name = "group" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ "ff", "rand_core 0.6.4", @@ -720,23 +656,22 @@ dependencies = [ [[package]] name = "ibc-controller" -version = "1.1.0" +version = "1.1.1" dependencies = [ "astro-satellite-package", "astroport-ibc", "cosmwasm-schema", "cosmwasm-std", "cosmwasm-storage", - "cw-multi-test 0.15.1", "cw-storage-plus 0.15.1", - "cw2 0.15.1", + "cw2 1.1.2", "ibc-controller-package", "thiserror", ] [[package]] name = "ibc-controller-package" -version = "1.0.0" +version = "1.1.1" dependencies = [ "astroport-governance", "astroport-ibc", @@ -754,93 +689,66 @@ dependencies = [ ] [[package]] -name = "itoa" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" - -[[package]] -name = "k256" -version = "0.11.6" +name = "itertools" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ - "cfg-if", - "ecdsa", - "elliptic-curve", - "sha2 0.10.6", + "either", ] [[package]] -name = "libc" -version = "0.2.144" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" - -[[package]] -name = "neutron-sdk" -version = "0.6.1" +name = "itertools" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfc6f92cae61b5af9014c09b7bac25ac95b7442be38441a7103377a8edfd37c" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ - "base64 0.21.2", - "bech32", - "cosmos-sdk-proto", - "cosmwasm-schema", - "cosmwasm-std", - "cw-storage-plus 1.1.0", - "prost 0.11.9", - "protobuf", - "schemars", - "serde", - "serde-json-wasm", - "serde_json", - "thiserror", + "either", ] [[package]] -name = "num-derive" -version = "0.3.3" +name = "itoa" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] -name = "num-traits" -version = "0.2.16" +name = "k256" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ - "autocfg", + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2 0.10.8", + "signature", ] [[package]] -name = "once_cell" -version = "1.17.1" +name = "libc" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] -name = "opaque-debug" -version = "0.3.0" +name = "once_cell" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] -name = "paste" -version = "1.0.14" +name = "opaque-debug" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "pkcs8" -version = "0.9.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ "der", "spki", @@ -848,94 +756,41 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] [[package]] name = "prost" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" -dependencies = [ - "bytes", - "prost-derive 0.9.0", -] - -[[package]] -name = "prost" -version = "0.11.9" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" dependencies = [ "bytes", - "prost-derive 0.11.9", + "prost-derive", ] [[package]] name = "prost-derive" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "prost-derive" -version = "0.11.9" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" dependencies = [ "anyhow", - "itertools", + "itertools 0.11.0", "proc-macro2", "quote", - "syn 1.0.109", -] - -[[package]] -name = "prost-types" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" -dependencies = [ - "prost 0.11.9", -] - -[[package]] -name = "protobuf" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b55bad9126f378a853655831eb7363b7b01b81d19f8cb1218861086ca4a1a61e" -dependencies = [ - "bytes", - "once_cell", - "protobuf-support", - "thiserror", -] - -[[package]] -name = "protobuf-support" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d4d7b8601c814cfb36bcebb79f0e61e45e1e93640cf778837833bbed05c372" -dependencies = [ - "thiserror", + "syn 2.0.57", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -957,26 +812,25 @@ dependencies = [ [[package]] name = "rfc6979" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" dependencies = [ - "crypto-bigint", "hmac", - "zeroize", + "subtle", ] [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "schemars" -version = "0.8.12" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" +checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29" dependencies = [ "dyn-clone", "schemars_derive", @@ -986,9 +840,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.12" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" +checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967" dependencies = [ "proc-macro2", "quote", @@ -998,9 +852,9 @@ dependencies = [ [[package]] name = "sec1" -version = "0.3.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct", "der", @@ -1012,15 +866,15 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.17" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "serde" -version = "1.0.183" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] @@ -1034,24 +888,15 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_bytes" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" -dependencies = [ - "serde", -] - [[package]] name = "serde_derive" -version = "1.0.183" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.57", ] [[package]] @@ -1067,9 +912,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ "itoa", "ryu", @@ -1091,9 +936,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -1102,9 +947,9 @@ dependencies = [ [[package]] name = "signature" -version = "1.6.4" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest 0.10.7", "rand_core 0.6.4", @@ -1112,9 +957,9 @@ dependencies = [ [[package]] name = "spki" -version = "0.6.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", "der", @@ -1132,15 +977,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" -[[package]] -name = "subtle-encoding" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dcb1ed7b8330c5eed5441052651dd7a12c75e2ed88f2ec024ae1fa3a5e59945" -dependencies = [ - "zeroize", -] - [[package]] name = "syn" version = "1.0.109" @@ -1154,84 +990,40 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "11a6ae1e52eb25aab8f3fb9fca13be982a373b8f1157ca14b897a825ba4a2d35" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "tendermint-proto" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5895470f28c530f8ae8c4071bf8190304ce00bd131d25e81730453124a3375c" -dependencies = [ - "bytes", - "flex-error", - "num-derive", - "num-traits", - "prost 0.11.9", - "prost-types", - "serde", - "serde_bytes", - "subtle-encoding", - "time", -] - [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", -] - -[[package]] -name = "time" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fdd63d58b18d663fbdf70e049f00a22c8e42be082203be7f26589213cd75ea" -dependencies = [ - "deranged", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" - -[[package]] -name = "time-macros" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb71511c991639bb078fd5bf97757e03914361c48100d52878b8e52b46fb92cd" -dependencies = [ - "time-core", + "syn 2.0.57", ] [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "uint" @@ -1247,9 +1039,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "version_check" @@ -1265,6 +1057,6 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "zeroize" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" diff --git a/Cargo.toml b/Cargo.toml index 0145aa0..fdc2df5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,18 @@ members = [ "packages/*" ] +[workspace.dependencies] +astroport-governance = { git = "https://github.com/astroport-fi/astroport-governance", version = "1" } +astroport-ibc = { path = "packages/astroport-ibc", version = "1" } +cosmwasm-std = "1.5" +cosmwasm-storage = "1.5" +cw-storage-plus = "0.15" +cosmwasm-schema = "1.5" +cw2 = "1" +thiserror = "1.0" +cw-utils = "1" +itertools = "0.12" + [profile.release] opt-level = 'z' debug = false @@ -14,4 +26,7 @@ debug-assertions = false codegen-units = 1 panic = 'abort' incremental = false -overflow-checks = true \ No newline at end of file +overflow-checks = true + +[patch.crates-io] +astro-satellite-package = { path = "packages/satellite" } \ No newline at end of file diff --git a/contracts/controller/Cargo.toml b/contracts/controller/Cargo.toml index b56a678..f605781 100644 --- a/contracts/controller/Cargo.toml +++ b/contracts/controller/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "ibc-controller" -version = "1.1.0" +version = "1.1.1" authors = ["Astroport"] license = "GPL-3.0-only" -description = "IBC controller contract intended to be hosted on the main chain." +description = "Astroport IBC controller serves as a bridge for governance messages between Assembly and outposts." repository = "https://github.com/astroport-fi/astroport_ibc" homepage = "https://astroport.fi" edition = "2021" @@ -15,18 +15,15 @@ crate-type = ["cdylib", "rlib"] # for more explicit tests, cargo test --features=backtraces backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all instantiate/execute/query exports -# library = [] +library = [] [dependencies] -cosmwasm-std = { version = "1.1", features = ["ibc3"] } -cosmwasm-storage = "1.1" -cw-storage-plus = "0.15" -cw2 = "0.15" -thiserror = "1.0" -ibc-controller-package = { path = "../../packages/controller" } -astro-satellite-package = { path = "../../packages/satellite" } -astroport-ibc = { path = "../../packages/astroport-ibc" } -cosmwasm-schema = "1.1" - -[dev-dependencies] -cw-multi-test = "0.15" +cosmwasm-std = { workspace = true, features = ["ibc3"] } +cosmwasm-storage = { workspace = true } +cw-storage-plus = { workspace = true } +cw2 = { workspace = true } +thiserror = { workspace = true } +ibc-controller-package = { path = "../../packages/controller", version = "1" } +astro-satellite-package = { path = "../../packages/satellite", version = "1.0.0" } +astroport-ibc = { workspace = true } +cosmwasm-schema = { workspace = true } \ No newline at end of file diff --git a/contracts/controller/src/contract.rs b/contracts/controller/src/contract.rs index 42563db..499e968 100644 --- a/contracts/controller/src/contract.rs +++ b/contracts/controller/src/contract.rs @@ -2,7 +2,7 @@ use astroport_ibc::TIMEOUT_LIMITS; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - attr, to_binary, Binary, CosmosMsg, Deps, DepsMut, Env, IbcMsg, IbcTimeout, MessageInfo, + attr, to_json_binary, Binary, CosmosMsg, Deps, DepsMut, Env, IbcMsg, IbcTimeout, MessageInfo, Response, StdError, SubMsg, }; use cw2::{get_contract_version, set_contract_version}; @@ -68,7 +68,7 @@ pub fn execute( let ibc_msg = CosmosMsg::Ibc(IbcMsg::SendPacket { channel_id: channel_id.clone(), - data: to_binary(&SatelliteMsg::ExecuteProposal { + data: to_json_binary(&SatelliteMsg::ExecuteProposal { id: proposal_id, messages, })?, @@ -129,7 +129,7 @@ pub fn execute( for channel in channels { let ibc_msg = CosmosMsg::Ibc(IbcMsg::SendPacket { channel_id: channel.clone(), - data: to_binary(&SatelliteMsg::Heartbeat {})?, + data: to_json_binary(&SatelliteMsg::Heartbeat {})?, timeout: IbcTimeout::from(env.block.time.plus_seconds(config.timeout)), }); res.messages.push(SubMsg::new(ibc_msg)); @@ -146,9 +146,9 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> Result { let state = PROPOSAL_STATE.load(deps.storage, id)?; - Ok(to_binary(&state)?) + Ok(to_json_binary(&state)?) } - QueryMsg::LastError {} => Ok(to_binary(&LAST_ERROR.load(deps.storage)?)?), + QueryMsg::LastError {} => Ok(to_json_binary(&LAST_ERROR.load(deps.storage)?)?), } } @@ -175,7 +175,7 @@ pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result { - let msg: SatelliteMsg = from_binary(data).unwrap(); + let msg: SatelliteMsg = from_json(data).unwrap(); assert_eq!( msg, SatelliteMsg::ExecuteProposal { diff --git a/contracts/controller/src/ibc.rs b/contracts/controller/src/ibc.rs index fc863ab..fde384a 100644 --- a/contracts/controller/src/ibc.rs +++ b/contracts/controller/src/ibc.rs @@ -1,5 +1,5 @@ use cosmwasm_std::{ - entry_point, from_binary, wasm_execute, Addr, DepsMut, Env, Ibc3ChannelOpenResponse, + entry_point, from_json, wasm_execute, Addr, DepsMut, Env, Ibc3ChannelOpenResponse, IbcBasicResponse, IbcChannelCloseMsg, IbcChannelConnectMsg, IbcChannelOpenMsg, IbcChannelOpenResponse, IbcOrder, IbcPacketAckMsg, IbcPacketReceiveMsg, IbcPacketTimeoutMsg, IbcReceiveResponse, StdError, StdResult, SubMsg, @@ -100,7 +100,7 @@ pub fn ibc_packet_timeout( ) -> StdResult { let mut res = IbcBasicResponse::new(); - let satellite_msg: SatelliteMsg = from_binary(&msg.packet.data)?; + let satellite_msg: SatelliteMsg = from_json(&msg.packet.data)?; match satellite_msg { SatelliteMsg::ExecuteProposal { id, .. } => { // The original packet was a proposal @@ -146,8 +146,8 @@ pub fn ibc_packet_ack( ) -> StdResult { let mut res = IbcBasicResponse::new(); - let ibc_ack: IbcAckResult = from_binary(&msg.acknowledgement.data)?; - let satellite_msg: SatelliteMsg = from_binary(&msg.original_packet.data)?; + let ibc_ack: IbcAckResult = from_json(&msg.acknowledgement.data)?; + let satellite_msg: SatelliteMsg = from_json(&msg.original_packet.data)?; match satellite_msg { SatelliteMsg::ExecuteProposal { id, .. } => { // The original packet was a proposal @@ -207,7 +207,7 @@ mod tests { use cosmwasm_std::testing::{ mock_ibc_channel_close_init, mock_ibc_packet_ack, mock_ibc_packet_timeout, }; - use cosmwasm_std::{attr, to_binary, Binary, CosmosMsg, IbcAcknowledgement, WasmMsg}; + use cosmwasm_std::{attr, to_json_binary, Binary, CosmosMsg, IbcAcknowledgement, WasmMsg}; use ibc_controller_package::ExecuteMsg; @@ -262,7 +262,7 @@ mod tests { assert_eq!(state, ProposalStatus::Executed); assert_eq!(resp.messages.len(), 1); - let valid_msg = to_binary(&AssemblyExecuteMsg::IBCProposalCompleted { + let valid_msg = to_json_binary(&AssemblyExecuteMsg::IBCProposalCompleted { proposal_id, status: ProposalStatus::Executed, }) @@ -300,7 +300,7 @@ mod tests { assert_eq!(state, ProposalStatus::Failed); assert_eq!(resp.messages.len(), 1); - let valid_msg = to_binary(&AssemblyExecuteMsg::IBCProposalCompleted { + let valid_msg = to_json_binary(&AssemblyExecuteMsg::IBCProposalCompleted { proposal_id, status: ProposalStatus::Failed, }) @@ -392,7 +392,7 @@ mod tests { assert_eq!(state, ProposalStatus::Failed); assert_eq!(resp.messages.len(), 1); - let valid_msg = to_binary(&AssemblyExecuteMsg::IBCProposalCompleted { + let valid_msg = to_json_binary(&AssemblyExecuteMsg::IBCProposalCompleted { proposal_id, status: ProposalStatus::Failed, }) diff --git a/contracts/cw20-ics20/Cargo.toml b/contracts/cw20-ics20/Cargo.toml index af44237..efcb26c 100644 --- a/contracts/cw20-ics20/Cargo.toml +++ b/contracts/cw20-ics20/Cargo.toml @@ -1,13 +1,18 @@ [package] name = "astroport-cw20-ics20" -version = "0.15.1" +version = "0.15.1-astroport" edition = "2021" [lib] crate-type = ["cdylib", "rlib"] +[features] +library = [] + [dependencies] -cw20-ics20-orig = { package = "cw20-ics20", version = "0.15" } +cw20-ics20 = { version = "=0.15.1", features = ["library"] } +cosmwasm-std = "1.1" +cw2 = "1" [dev-dependencies] cosmwasm-schema = "1.1" diff --git a/contracts/cw20-ics20/examples/cw20_ics20_schema.rs b/contracts/cw20-ics20/examples/cw20_ics20_schema.rs index 858ca3e..4f41085 100644 --- a/contracts/cw20-ics20/examples/cw20_ics20_schema.rs +++ b/contracts/cw20-ics20/examples/cw20_ics20_schema.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::write_api; -use cw20_ics20_orig::msg::{ExecuteMsg, InitMsg, QueryMsg}; +use cw20_ics20::msg::{ExecuteMsg, InitMsg, QueryMsg}; fn main() { write_api! { diff --git a/contracts/cw20-ics20/src/contract.rs b/contracts/cw20-ics20/src/contract.rs new file mode 100644 index 0000000..6094e84 --- /dev/null +++ b/contracts/cw20-ics20/src/contract.rs @@ -0,0 +1,70 @@ +use cosmwasm_std::{ + entry_point, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Response, StdError, StdResult, +}; +use cw2::{get_contract_version, set_contract_version}; +use cw20_ics20::msg::{ExecuteMsg, InitMsg, QueryMsg}; + +const CONTRACT_NAME: &str = "crates.io:cw20-ics20"; +const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn instantiate( + _deps: DepsMut, + _env: Env, + _info: MessageInfo, + _msg: InitMsg, +) -> StdResult { + unimplemented!( + "This is transition version of Astroport's cw20_ics20 which cannot be instantiated" + ) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn execute( + _deps: DepsMut, + _env: Env, + _info: MessageInfo, + _msg: ExecuteMsg, +) -> StdResult { + Err(StdError::generic_err( + "This is transition version of Astroport's cw20_ics20. All execute endpoints are disabled. Currently it only receives IBCed ASTRO from remote chains", + )) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { + cw20_ics20::contract::query(deps, env, msg) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn migrate(deps: DepsMut, _env: Env, _msg: Empty) -> StdResult { + let contract_version = get_contract_version(deps.storage)?; + + match contract_version.contract.as_ref() { + "crates.io:cw20-ics20" => match contract_version.version.as_ref() { + // 0.13.4 - testnet + // 0.15.1 - mainnet + "0.13.4" | "0.15.1" => {} + _ => { + return Err(StdError::generic_err(format!( + "Unsupported version: {}", + contract_version.version + ))) + } + }, + _ => { + return Err(StdError::generic_err(format!( + "Unsupported contract {}", + contract_version.contract + ))) + } + }; + + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + + Ok(Response::new() + .add_attribute("previous_contract_name", &contract_version.contract) + .add_attribute("previous_contract_version", &contract_version.version) + .add_attribute("new_contract_name", CONTRACT_NAME) + .add_attribute("new_contract_version", CONTRACT_VERSION)) +} diff --git a/contracts/cw20-ics20/src/ibc.rs b/contracts/cw20-ics20/src/ibc.rs new file mode 100644 index 0000000..4f5fd11 --- /dev/null +++ b/contracts/cw20-ics20/src/ibc.rs @@ -0,0 +1,72 @@ +use cosmwasm_std::{ + entry_point, DepsMut, Env, IbcBasicResponse, IbcChannelCloseMsg, IbcChannelConnectMsg, + IbcChannelOpenMsg, IbcPacketAckMsg, IbcPacketReceiveMsg, IbcPacketTimeoutMsg, + IbcReceiveResponse, Reply, Response, StdResult, +}; +use cw20_ics20::ContractError; + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn reply(deps: DepsMut, env: Env, reply: Reply) -> Result { + cw20_ics20::ibc::reply(deps, env, reply) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +/// enforces ordering and versioning constraints +pub fn ibc_channel_open( + deps: DepsMut, + env: Env, + msg: IbcChannelOpenMsg, +) -> Result<(), ContractError> { + cw20_ics20::ibc::ibc_channel_open(deps, env, msg) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +/// record the channel in CHANNEL_INFO +pub fn ibc_channel_connect( + deps: DepsMut, + env: Env, + msg: IbcChannelConnectMsg, +) -> Result { + cw20_ics20::ibc::ibc_channel_connect(deps, env, msg) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn ibc_channel_close( + deps: DepsMut, + env: Env, + channel: IbcChannelCloseMsg, +) -> Result { + cw20_ics20::ibc::ibc_channel_close(deps, env, channel) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +/// Check to see if we have any balance here +/// We should not return an error if possible, but rather an acknowledgement of failure. +/// This endpoint never errors ensured within imported [`cw20_ics20::ibc::ibc_packet_receive`]. +pub fn ibc_packet_receive( + deps: DepsMut, + env: Env, + msg: IbcPacketReceiveMsg, +) -> StdResult { + Ok(cw20_ics20::ibc::ibc_packet_receive(deps, env, msg).unwrap()) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +/// check if success or failure and update balance, or return funds +pub fn ibc_packet_ack( + deps: DepsMut, + env: Env, + msg: IbcPacketAckMsg, +) -> Result { + cw20_ics20::ibc::ibc_packet_ack(deps, env, msg) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +/// return fund to original sender (same as failure in ibc_packet_ack) +pub fn ibc_packet_timeout( + deps: DepsMut, + env: Env, + msg: IbcPacketTimeoutMsg, +) -> Result { + cw20_ics20::ibc::ibc_packet_timeout(deps, env, msg) +} diff --git a/contracts/cw20-ics20/src/lib.rs b/contracts/cw20-ics20/src/lib.rs index 55a5d31..8467b71 100644 --- a/contracts/cw20-ics20/src/lib.rs +++ b/contracts/cw20-ics20/src/lib.rs @@ -1,2 +1,2 @@ -#![allow(dead_code, unused_imports, clippy::single_component_path_imports)] -use cw20_ics20_orig; +pub mod contract; +pub mod ibc; diff --git a/contracts/satellite/Cargo.toml b/contracts/satellite/Cargo.toml index 6ca902e..32211c7 100644 --- a/contracts/satellite/Cargo.toml +++ b/contracts/satellite/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "astro-satellite" -version = "1.1.0" +version = "1.2.0" authors = ["Astroport"] license = "GPL-3.0-only" description = "IBC enabled astroport satellite contract intended to be hosted on a remote chain." @@ -16,23 +16,18 @@ crate-type = ["cdylib", "rlib"] backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all instantiate/execute/query exports library = [] -# this feature disables instantiate/execute/migrate exports so neutron specific version -# can reimplement them -neutron = [] -default = [] [dependencies] -cosmwasm-std = { version = "1.1", features = ["ibc3"] } -cosmwasm-storage = "1.1" -cw-storage-plus = "0.15" -cw2 = "0.15" -thiserror = "1.0" -cw-utils = "0.15" +cosmwasm-std = { workspace = true, features = ["ibc3"] } +cosmwasm-storage = { workspace = true } +cw-storage-plus = { workspace = true } +cw2 = { workspace = true } +thiserror = { workspace = true } ibc-controller-package = { path = "../../packages/controller", version = "1.0.0" } astro-satellite-package = { path = "../../packages/satellite", version = "1.0.0" } -astroport-ibc = { path = "../../packages/astroport-ibc", version = "1.2.1" } -itertools = "0.10" -cosmwasm-schema = "1.1" +astroport-ibc = { workspace = true } +itertools = { workspace = true } +cosmwasm-schema = { workspace = true } [dev-dependencies] astroport-mocks = { path = "../../packages/astroport_mocks" } diff --git a/contracts/satellite/src/contract.rs b/contracts/satellite/src/contract.rs index e3db34a..b7c1f7f 100644 --- a/contracts/satellite/src/contract.rs +++ b/contracts/satellite/src/contract.rs @@ -1,11 +1,11 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, wasm_execute, Binary, Coin, CosmosMsg, CustomMsg, Deps, DepsMut, Env, IbcMsg, - IbcTimeout, MessageInfo, Reply, Response, StdError, + ensure, to_json_binary, wasm_execute, Addr, Api, Binary, CosmosMsg, CustomMsg, Deps, DepsMut, + Env, IbcMsg, IbcTimeout, MessageInfo, QuerierWrapper, Reply, Response, StdError, WasmMsg, }; use cw2::{get_contract_version, set_contract_version}; -use cw_utils::must_pay; +use cw_storage_plus::Map; use astro_satellite_package::astroport_governance::astroport::common::{ claim_ownership, drop_ownership_proposal, propose_new_owner, @@ -13,7 +13,6 @@ use astro_satellite_package::astroport_governance::astroport::common::{ use astro_satellite_package::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; use crate::error::ContractError; -use crate::migration::migrate_to_v100; use crate::state::{ instantiate_state, set_emergency_owner_as_admin, store_proposal, update_config, CONFIG, OWNERSHIP_PROPOSAL, REPLY_DATA, RESULTS, @@ -22,9 +21,9 @@ use crate::state::{ const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); -pub(crate) const RECEIVE_ID: u64 = 1; +pub const RECEIVE_ID: u64 = 1; -#[cfg_attr(all(not(feature = "library"), not(feature = "neutron")), entry_point)] +#[cfg_attr(all(not(feature = "library")), entry_point)] pub fn instantiate( deps: DepsMut, env: Env, @@ -50,7 +49,7 @@ pub fn reply(deps: DepsMut, env: Env, reply: Reply) -> Result { let config = CONFIG.load(deps.storage)?; - let amount = must_pay(&info, &config.astro_denom)?; + + // Query and send the whole astro balance + let astro_balance = deps + .querier + .query_balance(&env.contract.address, &config.astro_denom)?; + + if astro_balance.amount.is_zero() { + return Err(ContractError::NoAstroBalance {}); + } + let msg = CosmosMsg::Ibc(IbcMsg::Transfer { channel_id: config.transfer_channel, to_address: config.main_maker, - amount: Coin { - denom: config.astro_denom.clone(), - amount, - }, + amount: astro_balance, timeout: IbcTimeout::from(env.block.time.plus_seconds(config.timeout)), }); Ok(Response::new() @@ -75,7 +80,10 @@ pub fn execute( .add_attribute("action", "transfer_astro")) } ExecuteMsg::UpdateConfig(params) => update_config(deps, info, env, params), - ExecuteMsg::CheckMessages(proposal_messages) => check_messages(env, proposal_messages), + ExecuteMsg::CheckMessages(messages) => check_messages(deps.api, env, messages), + ExecuteMsg::ExecuteFromMultisig(proposal_messages) => { + exec_from_multisig(deps.querier, info, env, proposal_messages) + } ExecuteMsg::CheckMessagesPassed {} => Err(ContractError::MessagesCheckPassed {}), ExecuteMsg::ProposeNewOwner { owner, expires_in } => { let config = CONFIG.load(deps.storage)?; @@ -112,53 +120,136 @@ pub fn execute( } } +/// Checks that proposal messages are correct. pub fn check_messages( + api: &dyn Api, env: Env, mut messages: Vec>, ) -> Result, ContractError> where M: CustomMsg, { - messages.push(CosmosMsg::Wasm(wasm_execute( - env.contract.address, - &ExecuteMsg::::CheckMessagesPassed {}, - vec![], - )?)); + messages.iter().try_for_each(|msg| match msg { + CosmosMsg::Wasm( + WasmMsg::Migrate { contract_addr, .. } | WasmMsg::UpdateAdmin { contract_addr, .. }, + ) if api.addr_validate(contract_addr)? == env.contract.address => { + Err(StdError::generic_err( + "Can't check messages with a migration or update admin message of the contract itself", + )) + } + CosmosMsg::Stargate { type_url, .. } if type_url.contains("MsgGrant") => Err( + StdError::generic_err("Can't check messages with a MsgGrant message"), + ), + _ => Ok(()), + })?; + + messages.push( + wasm_execute( + env.contract.address, + &ExecuteMsg::::CheckMessagesPassed {}, + vec![], + )? + .into(), + ); Ok(Response::new() .add_attribute("action", "check_messages") .add_messages(messages)) } +pub fn exec_from_multisig( + querier: QuerierWrapper, + info: MessageInfo, + env: Env, + messages: Vec>, +) -> Result, ContractError> +where + M: CustomMsg, +{ + match querier + .query_wasm_contract_info(&env.contract.address)? + .admin + { + None => Err(ContractError::Unauthorized {}), + // Don't allow to execute this endpoint if the contract is admin of itself + Some(admin) if admin != info.sender || admin == env.contract.address => { + Err(ContractError::Unauthorized {}) + } + _ => Ok(()), + }?; + + Ok(Response::new().add_messages(messages)) +} + #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> Result { match msg { QueryMsg::ProposalState { id } => { let state = RESULTS.load(deps.storage, id)?; - Ok(to_binary(&state)?) + Ok(to_json_binary(&state)?) } } } -#[cfg_attr(all(not(feature = "library"), not(feature = "neutron")), entry_point)] +#[cfg_attr(all(not(feature = "library")), entry_point)] pub fn migrate(mut deps: DepsMut, env: Env, msg: MigrateMsg) -> Result { let contract_version = get_contract_version(deps.storage)?; - match contract_version.contract.as_ref() { + let response = match contract_version.contract.as_ref() { "astro-satellite" => match contract_version.version.as_ref() { - "0.2.0" => { - migrate_to_v100(deps.branch(), &env, &msg)?; + "1.1.0-hubmove" => { + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + Response::new() + } + _ => return Err(ContractError::MigrationError {}), + }, + "astro-assembly" => match contract_version.version.as_ref() { + "1.3.2" => { + // Converting Assembly on Terra into Satellite. + // Tested on forked Terra mainnet. Gas used: 2_492_503. State was successfully wiped out. + // ibc port was obtained. + + ensure!( + env.block.chain_id == "pisco-1" || env.block.chain_id == "phoenix-1", + StdError::generic_err( + "Assembly -> Satellite conversion is only available on Terra" + ) + ); + + let init_msg = msg + .init_msg + .ok_or_else(|| StdError::generic_err("init_msg must be set on Terra"))?; + + deps.storage.remove(b"proposal_count"); + let proposals: Map = Map::new("proposals"); + proposals.clear(deps.storage); + + let cw_admin = deps + .querier + .query_wasm_contract_info(&env.contract.address)? + .admin + .unwrap(); + // Even though info object is ignored in instantiate, we provide it for clarity + let info = MessageInfo { + sender: Addr::unchecked(cw_admin), + funds: vec![], + }; + // Instantiate Satellite state. + // Config and cw2 info will be overwritten. + instantiate(deps.branch(), env, info, init_msg)? } _ => return Err(ContractError::MigrationError {}), }, _ => return Err(ContractError::MigrationError {}), }; - set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - - Ok(Response::new() - .add_attribute("previous_contract_name", &contract_version.contract) - .add_attribute("previous_contract_version", &contract_version.version) - .add_attribute("new_contract_name", CONTRACT_NAME) - .add_attribute("new_contract_version", CONTRACT_VERSION)) + Ok(response.add_attributes([ + ("previous_contract_name", contract_version.contract.as_str()), + ( + "previous_contract_version", + contract_version.version.as_str(), + ), + ("new_contract_name", CONTRACT_NAME), + ("new_contract_version", CONTRACT_VERSION), + ])) } diff --git a/contracts/satellite/src/error.rs b/contracts/satellite/src/error.rs index 8f8b7fc..a728849 100644 --- a/contracts/satellite/src/error.rs +++ b/contracts/satellite/src/error.rs @@ -1,8 +1,8 @@ -use astroport_ibc::{SIGNAL_OUTAGE_LIMITS, TIMEOUT_LIMITS}; use cosmwasm_std::StdError; -use cw_utils::PaymentError; use thiserror::Error; +use astroport_ibc::{SIGNAL_OUTAGE_LIMITS, TIMEOUT_LIMITS}; + /// Never is a placeholder to ensure we don't return any errors #[derive(Error, Debug)] pub enum Never {} @@ -33,9 +33,6 @@ pub enum ContractError { #[error("Invalid source port {invalid}. Should be : {valid}")] InvalidSourcePort { invalid: String, valid: String }, - #[error("{0}")] - PaymentError(#[from] PaymentError), - #[error("Messages check passed. Nothing was committed to the blockchain")] MessagesCheckPassed {}, @@ -54,4 +51,7 @@ pub enum ContractError { SIGNAL_OUTAGE_LIMITS.end() )] SignalOutageLimitsError {}, + + #[error("Satellite doesn't have any ASTRO in balance")] + NoAstroBalance {}, } diff --git a/contracts/satellite/src/ibc.rs b/contracts/satellite/src/ibc.rs index 426f866..98e2d53 100644 --- a/contracts/satellite/src/ibc.rs +++ b/contracts/satellite/src/ibc.rs @@ -1,7 +1,7 @@ use std::fmt::Display; use cosmwasm_std::{ - entry_point, from_binary, to_binary, Binary, DepsMut, Env, Ibc3ChannelOpenResponse, + entry_point, from_json, to_json_binary, Binary, DepsMut, Env, Ibc3ChannelOpenResponse, IbcBasicResponse, IbcChannelCloseMsg, IbcChannelConnectMsg, IbcChannelOpenMsg, IbcChannelOpenResponse, IbcOrder, IbcPacketAckMsg, IbcPacketReceiveMsg, IbcPacketTimeoutMsg, IbcReceiveResponse, ReplyOn, StdError, StdResult, SubMsg, @@ -19,12 +19,12 @@ pub const IBC_ORDERING: IbcOrder = IbcOrder::Unordered; /// Create a serialized success message pub fn ack_ok() -> Binary { - to_binary(&IbcAckResult::Ok(b"ok".into())).unwrap() + to_json_binary(&IbcAckResult::Ok(b"ok".into())).unwrap() } /// Create a serialized error message pub fn ack_fail(err: impl Display) -> Binary { - to_binary(&IbcAckResult::Error(err.to_string())).unwrap() + to_json_binary(&IbcAckResult::Error(err.to_string())).unwrap() } #[cfg_attr(not(feature = "library"), entry_point)] @@ -127,9 +127,9 @@ fn do_packet_receive( } // TODO: Remove or_else and map_err method calls once the controller is upgraded to v1.0.0 - let satellite_msg = from_binary(&msg.packet.data) + let satellite_msg = from_json(&msg.packet.data) .or_else(|_| { - let IbcProposal { id, messages } = from_binary(&msg.packet.data)?; + let IbcProposal { id, messages } = from_json(&msg.packet.data)?; Ok(SatelliteMsg::ExecuteProposal { id, messages }) }) .map_err(ContractError::Std)?; @@ -336,7 +336,7 @@ mod tests { let msg = mock_ibc_packet_recv("random_channel", &()).unwrap(); // However, we will never receive error here, but encoded error message in .acknowledgement field let resp = ibc_packet_receive(deps.as_mut(), env.clone(), msg).unwrap(); - let ack: IbcAckResult = from_binary(&resp.acknowledgement).unwrap(); + let ack: IbcAckResult = from_json(resp.acknowledgement).unwrap(); assert_eq!( ack, IbcAckResult::Error("Governance is not established yet".to_string()) @@ -364,7 +364,7 @@ mod tests { // Trying to send messages via wrong channel let msg = mock_ibc_packet_recv("channel-5", &()).unwrap(); let resp = ibc_packet_receive(deps.as_mut(), env.clone(), msg).unwrap(); - let ack: IbcAckResult = from_binary(&resp.acknowledgement).unwrap(); + let ack: IbcAckResult = from_json(resp.acknowledgement).unwrap(); assert_eq!( ack, IbcAckResult::Error(format!( @@ -385,7 +385,7 @@ mod tests { let msg = mock_ibc_packet_recv(GOV_CHANNEL, &ibc_proposal).unwrap(); let resp = ibc_packet_receive(deps.as_mut(), env.clone(), msg).unwrap(); assert_eq!(resp.messages.last().unwrap().reply_on, ReplyOn::Success); - let ack: IbcAckResult = from_binary(&resp.acknowledgement).unwrap(); + let ack: IbcAckResult = from_json(&resp.acknowledgement).unwrap(); assert_eq!(ack, IbcAckResult::Ok(b"ok".into())); } } diff --git a/contracts/satellite/src/lib.rs b/contracts/satellite/src/lib.rs index e951b43..797945a 100644 --- a/contracts/satellite/src/lib.rs +++ b/contracts/satellite/src/lib.rs @@ -1,5 +1,4 @@ pub mod contract; pub mod error; pub mod ibc; -pub mod migration; pub mod state; diff --git a/contracts/satellite/src/migration.rs b/contracts/satellite/src/migration.rs deleted file mode 100644 index a4b484a..0000000 --- a/contracts/satellite/src/migration.rs +++ /dev/null @@ -1,55 +0,0 @@ -use astro_satellite_package::MigrateMsg; -use astroport_ibc::SIGNAL_OUTAGE_LIMITS; -use cosmwasm_schema::cw_serde; -use cosmwasm_std::{Addr, DepsMut, Env}; -use cw_storage_plus::Item; - -use crate::{ - error::ContractError, - state::{Config, CONFIG, LATEST_HUB_SIGNAL_TIME}, -}; -#[cw_serde] -pub struct ConfigV020 { - /// Address which is able to update contracts' parameters - pub owner: Addr, - /// ASTRO denom on the remote chain. - pub astro_denom: String, - /// Controller contract hosted on the main chain. - pub main_controller_port: String, - /// Maker address on the main chain - pub main_maker: String, - /// Channel used to interact with assembly contract on the main chain. - pub gov_channel: Option, - /// Channel used to transfer Astro tokens - pub transfer_channel: String, - /// when packet times out, measured on remote chain - pub timeout: u64, -} - -pub const CONFIGV020: Item = Item::new("config"); - -pub fn migrate_to_v100(deps: DepsMut, env: &Env, msg: &MigrateMsg) -> Result<(), ContractError> { - let old_config = CONFIGV020.load(deps.storage)?; - - if !SIGNAL_OUTAGE_LIMITS.contains(&msg.max_signal_outage) { - return Err(ContractError::SignalOutageLimitsError {}); - } - - let config = Config { - timeout: old_config.timeout, - owner: old_config.owner, - main_maker: old_config.main_maker, - astro_denom: old_config.astro_denom, - gov_channel: old_config.gov_channel, - transfer_channel: old_config.transfer_channel, - main_controller_port: old_config.main_controller_port, - max_signal_outage: msg.max_signal_outage, - emergency_owner: deps.api.addr_validate(&msg.emergency_owner)?, - }; - - CONFIG.save(deps.storage, &config)?; - - LATEST_HUB_SIGNAL_TIME.save(deps.storage, &env.block.time)?; - - Ok(()) -} diff --git a/contracts/satellite/tests/integration.rs b/contracts/satellite/tests/integration.rs index fcc16fb..4dd3af1 100644 --- a/contracts/satellite/tests/integration.rs +++ b/contracts/satellite/tests/integration.rs @@ -7,8 +7,8 @@ use astro_satellite::state::Config; use astro_satellite_package::{ExecuteMsg, InstantiateMsg, UpdateConfigMsg}; use astroport_mocks::{astroport_address, MockSatelliteBuilder}; use cosmwasm_std::{ - from_slice, wasm_execute, Addr, Binary, Coin, Deps, DepsMut, Empty, Env, MessageInfo, Response, - StdResult, WasmMsg, + from_json, wasm_execute, Addr, Binary, Coin, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, + Response, StdResult, WasmMsg, }; use astroport_ibc::{SIGNAL_OUTAGE_LIMITS, TIMEOUT_LIMITS}; @@ -99,17 +99,26 @@ fn test_check_messages() { }, &[], "Satellite label", - None, + Some(owner.to_string()), ) .unwrap(); + app.execute( + owner.clone(), + WasmMsg::UpdateAdmin { + contract_addr: satellite_addr.to_string(), + admin: satellite_addr.to_string(), + } + .into(), + ) + .unwrap(); + let noop_code = app.store_code(noop_contract()); let noop_addr = app .instantiate_contract(noop_code, owner.clone(), &Empty {}, &[], "none", None) .unwrap(); let messages: Vec<_> = (0..5) - .into_iter() .map(|_| wasm_execute(&noop_addr, &Empty {}, vec![]).unwrap().into()) .collect(); @@ -125,6 +134,153 @@ fn test_check_messages() { ContractError::MessagesCheckPassed {}, err.downcast().unwrap() ); + + // Try to update contract admin + let err = app + .execute_contract( + Addr::unchecked("permissionless"), + satellite_addr.clone(), + &ExecuteMsg::::CheckMessages(vec![WasmMsg::UpdateAdmin { + contract_addr: satellite_addr.to_string(), + admin: "hacker".to_string(), + } + .into()]), + &[], + ) + .unwrap_err(); + assert_eq!( + err.root_cause().to_string(), + "Generic error: Can't check messages with a migration or update admin message of the contract itself" + ); + + // Try to clear contract admin + let err = app + .execute_contract( + Addr::unchecked("permissionless"), + satellite_addr.clone(), + &ExecuteMsg::::CheckMessages(vec![WasmMsg::ClearAdmin { + contract_addr: satellite_addr.to_string(), + } + .into()]), + &[], + ) + .unwrap_err(); + assert_eq!( + err.downcast::().unwrap(), + ContractError::MessagesCheckPassed {} + ); + + // Can't check satellite migration message + let err = app + .execute_contract( + Addr::unchecked("permissionless"), + satellite_addr.clone(), + &ExecuteMsg::::CheckMessages(vec![WasmMsg::Migrate { + contract_addr: satellite_addr.to_string(), + new_code_id: 100, + msg: Default::default(), + } + .into()]), + &[], + ) + .unwrap_err(); + assert_eq!( + err.root_cause().to_string(), + "Generic error: Can't check messages with a migration or update admin message of the contract itself" + ); + + // Check authz MsgGrant message + let err = app + .execute_contract( + Addr::unchecked("permissionless"), + satellite_addr.clone(), + &ExecuteMsg::::CheckMessages(vec![CosmosMsg::Stargate { + type_url: "/cosmos.authz.v1beta1.MsgGrant".to_string(), + value: Default::default(), + }]), + &[], + ) + .unwrap_err(); + assert_eq!( + err.root_cause().to_string(), + "Generic error: Can't check messages with a MsgGrant message" + ); + + // Check execute from multisig message + let err = app + .execute_contract( + Addr::unchecked("permissionless"), + satellite_addr.clone(), + &ExecuteMsg::::CheckMessages(vec![wasm_execute( + &satellite_addr, + &ExecuteMsg::::ExecuteFromMultisig(vec![]), + vec![], + ) + .unwrap() + .into()]), + &[], + ) + .unwrap_err(); + assert_eq!( + err.downcast::().unwrap(), + ContractError::Unauthorized {} + ); +} + +#[test] +fn test_execute_multisig() { + let owner = Addr::unchecked("owner"); + let mut app = mock_app(&owner, vec![]); + + let satellite_code = app.store_code(satellite_contract()); + + let satellite_addr = app + .instantiate_contract( + satellite_code, + owner.clone(), + &InstantiateMsg { + owner: owner.to_string(), + astro_denom: "none".to_string(), + transfer_channel: "none".to_string(), + main_controller: "none".to_string(), + main_maker: "none".to_string(), + timeout: 60, + max_signal_outage: 1209600, + emergency_owner: owner.to_string(), + }, + &[], + "Satellite label", + Some(owner.to_string()), + ) + .unwrap(); + + let noop_code = app.store_code(noop_contract()); + let noop_addr = app + .instantiate_contract(noop_code, owner.clone(), &Empty {}, &[], "none", None) + .unwrap(); + + let messages: Vec<_> = (0..5) + .map(|_| wasm_execute(&noop_addr, &Empty {}, vec![]).unwrap().into()) + .collect(); + + let random = Addr::unchecked("random"); + let err = app + .execute_contract( + random.clone(), + satellite_addr.clone(), + &ExecuteMsg::::ExecuteFromMultisig(messages.clone()), + &[], + ) + .unwrap_err(); + assert_eq!(ContractError::Unauthorized {}, err.downcast().unwrap()); + + app.execute_contract( + owner.clone(), + satellite_addr.clone(), + &ExecuteMsg::::ExecuteFromMultisig(messages), + &[], + ) + .unwrap(); } #[test] @@ -176,7 +332,7 @@ fn test_check_update_configs() { .query_wasm_raw(satellite_addr.clone(), b"config".as_slice()) .unwrap() { - let res: Config = from_slice(&res).unwrap(); + let res: Config = from_json(res).unwrap(); assert_eq!("wasm.controller_addr_test", res.main_controller_port); } diff --git a/contracts/satellite_neutron/.cargo/config b/contracts/satellite_neutron/.cargo/config deleted file mode 100644 index 8438b9b..0000000 --- a/contracts/satellite_neutron/.cargo/config +++ /dev/null @@ -1,4 +0,0 @@ -[alias] -wasm = "build --release --lib --target wasm32-unknown-unknown" -unit-test = "test --lib" -schema = "run --example satellite_neutron_schema" \ No newline at end of file diff --git a/contracts/satellite_neutron/Cargo.toml b/contracts/satellite_neutron/Cargo.toml deleted file mode 100644 index a906afa..0000000 --- a/contracts/satellite_neutron/Cargo.toml +++ /dev/null @@ -1,32 +0,0 @@ -[package] -name = "astro-satellite-neutron" -version = "1.1.0" -authors = ["Astroport"] -license = "GPL-3.0-only" -description = """ -IBC enabled astroport satellite contract intended to be hosted on a remote chain. -This is an extended version of the original astro-satellite contract. -""" -repository = "https://github.com/astroport-fi/astroport_ibc" -homepage = "https://astroport.fi" -edition = "2021" - -[lib] -crate-type = ["cdylib", "rlib"] - -[features] -library = [] - -[dependencies] -# features = ["neutron"] allows to import all IBC-related endpoints as well as reply/query endpoints. -astro-satellite = { path = "../satellite", version = "1.1.0", features = ["neutron"] } -astro-satellite-package = { path = "../../packages/satellite", version = "1.0.0" } -astroport-ibc = { path = "../../packages/astroport-ibc", version = "1.2.1" } -cosmwasm-std = "1" -cw-utils = "0.15" -cw2 = "0.15" -neutron-sdk = "0.6" - -[dev-dependencies] -astroport-mocks = { path = "../../packages/astroport_mocks" } -cosmwasm-schema = "1" \ No newline at end of file diff --git a/contracts/satellite_neutron/src/contract.rs b/contracts/satellite_neutron/src/contract.rs deleted file mode 100644 index 31ee47d..0000000 --- a/contracts/satellite_neutron/src/contract.rs +++ /dev/null @@ -1,254 +0,0 @@ -#[cfg(not(feature = "library"))] -use cosmwasm_std::entry_point; -use cosmwasm_std::{coin, DepsMut, Env, MessageInfo, Response, StdError, StdResult}; -use cw2::{get_contract_version, set_contract_version}; -use cw_utils::must_pay; -use neutron_sdk::bindings::msg::{IbcFee, NeutronMsg}; -use neutron_sdk::bindings::query::NeutronQuery; -use neutron_sdk::query::min_ibc_fee::query_min_ibc_fee; -use neutron_sdk::sudo::msg::{RequestPacketTimeoutHeight, TransferSudoMsg}; - -use astro_satellite::contract::check_messages; -use astro_satellite::error::ContractError; -use astro_satellite::migration::migrate_to_v100; -use astro_satellite::state::{ - instantiate_state, set_emergency_owner_as_admin, update_config, CONFIG, OWNERSHIP_PROPOSAL, -}; -use astro_satellite_package::astroport_governance::astroport::common::{ - claim_ownership, drop_ownership_proposal, propose_new_owner, -}; -use astro_satellite_package::{ExecuteMsg, InstantiateMsg, MigrateMsg}; - -const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); -const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); -/// This contract accepts only one fee denom -const FEE_DENOM: &str = "untrn"; - -#[cfg_attr(not(feature = "library"), entry_point)] -pub fn instantiate( - deps: DepsMut, - env: Env, - _info: MessageInfo, - msg: InstantiateMsg, -) -> Result, ContractError> { - set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - - instantiate_state(deps, env, msg)?; - - Ok(Response::new()) -} - -#[cfg_attr(not(feature = "library"), entry_point)] -pub fn execute( - deps: DepsMut, - env: Env, - info: MessageInfo, - msg: ExecuteMsg, -) -> Result, ContractError> { - match msg { - ExecuteMsg::TransferAstro {} => { - let config = CONFIG.load(deps.storage)?; - let amount = must_pay(&info, &config.astro_denom)?; - let fee = min_ntrn_ibc_fee( - query_min_ibc_fee(deps.as_ref()) - .map_err(|err| StdError::generic_err(err.to_string()))? - .min_fee, - ); - let msg = NeutronMsg::IbcTransfer { - source_port: "transfer".to_string(), - source_channel: config.transfer_channel, - sender: env.contract.address.to_string(), - receiver: config.main_maker, - token: coin(amount.u128(), &config.astro_denom), - timeout_height: RequestPacketTimeoutHeight { - revision_number: None, - revision_height: None, - }, - // Neutron expects nanoseconds - // https://github.com/neutron-org/neutron/blob/303d764b57d871749fcf7d59a67b5d3078779258/proto/transfer/v1/tx.proto#L39-L42 - timeout_timestamp: env.block.time.plus_seconds(config.timeout).nanos(), - memo: "".to_string(), - fee, - }; - Ok(Response::new() - .add_message(msg) - .add_attribute("action", "transfer_astro")) - } - ExecuteMsg::UpdateConfig(params) => update_config(deps, info, env, params), - ExecuteMsg::CheckMessages(proposal_messages) => check_messages(env, proposal_messages), - ExecuteMsg::CheckMessagesPassed {} => Err(ContractError::MessagesCheckPassed {}), - ExecuteMsg::ProposeNewOwner { owner, expires_in } => { - let config = CONFIG.load(deps.storage)?; - - propose_new_owner( - deps, - info, - env, - owner, - expires_in, - config.owner, - OWNERSHIP_PROPOSAL, - ) - .map_err(Into::into) - } - ExecuteMsg::DropOwnershipProposal {} => { - let config = CONFIG.load(deps.storage)?; - - drop_ownership_proposal(deps, info, config.owner, OWNERSHIP_PROPOSAL) - .map_err(Into::into) - } - ExecuteMsg::ClaimOwnership {} => { - claim_ownership(deps, info, env, OWNERSHIP_PROPOSAL, |deps, new_owner| { - CONFIG - .update::<_, StdError>(deps.storage, |mut v| { - v.owner = new_owner; - Ok(v) - }) - .map(|_| ()) - }) - .map_err(Into::into) - } - ExecuteMsg::SetEmergencyOwnerAsAdmin {} => set_emergency_owner_as_admin(deps, env, info), - } -} - -#[cfg_attr(not(feature = "library"), entry_point)] -pub fn sudo(_deps: DepsMut, _env: Env, _msg: TransferSudoMsg) -> StdResult { - // Neutron requires sudo endpoint to be implemented - Ok(Response::new()) -} - -#[cfg_attr(not(feature = "library"), entry_point)] -pub fn migrate(mut deps: DepsMut, env: Env, msg: MigrateMsg) -> Result { - let contract_version = get_contract_version(deps.storage)?; - - match contract_version.contract.as_ref() { - "astro-satellite" => match contract_version.version.as_ref() { - "0.2.0" => { - migrate_to_v100(deps.branch(), &env, &msg)?; - } - _ => return Err(ContractError::MigrationError {}), - }, - _ => return Err(ContractError::MigrationError {}), - }; - - set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - - Ok(Response::new() - .add_attribute("previous_contract_name", &contract_version.contract) - .add_attribute("previous_contract_version", &contract_version.version) - .add_attribute("new_contract_name", CONTRACT_NAME) - .add_attribute("new_contract_version", CONTRACT_VERSION)) -} - -fn min_ntrn_ibc_fee(fee: IbcFee) -> IbcFee { - IbcFee { - recv_fee: fee.recv_fee, - ack_fee: fee - .ack_fee - .into_iter() - .filter(|a| a.denom == FEE_DENOM) - .collect(), - timeout_fee: fee - .timeout_fee - .into_iter() - .filter(|a| a.denom == FEE_DENOM) - .collect(), - } -} - -#[cfg(test)] -mod testing { - use std::marker::PhantomData; - - use astroport_ibc::SIGNAL_OUTAGE_LIMITS; - use cosmwasm_std::testing::{mock_env, mock_info, MockApi, MockQuerier, MockStorage}; - use cosmwasm_std::{coins, to_binary, ContractResult, CosmosMsg, OwnedDeps, SystemResult}; - use neutron_sdk::query::min_ibc_fee::MinIbcFeeResponse; - - use super::*; - - fn mock_neutron_dependencies( - ) -> OwnedDeps, NeutronQuery> { - let neutron_custom_handler = |request: &NeutronQuery| { - let contract_result: ContractResult<_> = match request { - NeutronQuery::MinIbcFee {} => to_binary(&MinIbcFeeResponse { - min_fee: IbcFee { - recv_fee: vec![], - ack_fee: coins(10000, FEE_DENOM), - timeout_fee: coins(10000, FEE_DENOM), - }, - }) - .into(), - _ => unimplemented!("Unsupported query request: {:?}", request), - }; - SystemResult::Ok(contract_result) - }; - - OwnedDeps { - storage: MockStorage::default(), - api: MockApi::default(), - querier: MockQuerier::new(&[]).with_custom_handler(neutron_custom_handler), - custom_query_type: PhantomData, - } - } - - #[test] - fn test_transfer_astro() { - let owner = "owner"; - let astro_denom = "ibc/astro"; - let transfer_channel = "channel-1"; - let main_maker = "wasm1hub_maker"; - let timeout = 60; - - let mut deps = mock_neutron_dependencies(); - instantiate( - deps.as_mut(), - mock_env(), - mock_info(owner, &[]), - InstantiateMsg { - owner: owner.to_string(), - astro_denom: astro_denom.to_string(), - transfer_channel: transfer_channel.to_string(), - main_controller: "".to_string(), - main_maker: main_maker.to_string(), - timeout, - max_signal_outage: *SIGNAL_OUTAGE_LIMITS.start(), - emergency_owner: "test".to_string(), - }, - ) - .unwrap(); - - let env = mock_env(); - let resp = execute( - deps.as_mut(), - env.clone(), - mock_info(owner, &coins(1000, astro_denom)), - ExecuteMsg::TransferAstro {}, - ) - .unwrap(); - - assert_eq!(resp.messages.len(), 1); - assert_eq!( - resp.messages[0].msg, - CosmosMsg::Custom(NeutronMsg::IbcTransfer { - source_port: "transfer".to_string(), - source_channel: transfer_channel.to_string(), - sender: "cosmos2contract".to_string(), - receiver: main_maker.to_string(), - token: coin(1000, astro_denom), - timeout_height: RequestPacketTimeoutHeight { - revision_number: None, - revision_height: None, - }, - timeout_timestamp: env.block.time.plus_seconds(timeout).nanos(), - memo: "".to_string(), - fee: IbcFee { - recv_fee: vec![], - ack_fee: coins(10000, FEE_DENOM), - timeout_fee: coins(10000, FEE_DENOM), - }, - }) - ); - } -} diff --git a/contracts/satellite_neutron/src/lib.rs b/contracts/satellite_neutron/src/lib.rs deleted file mode 100644 index 2943dbb..0000000 --- a/contracts/satellite_neutron/src/lib.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod contract; diff --git a/contracts/satellite_neutron/tests/integration.rs b/contracts/satellite_neutron/tests/integration.rs deleted file mode 100644 index cb6ba2e..0000000 --- a/contracts/satellite_neutron/tests/integration.rs +++ /dev/null @@ -1,311 +0,0 @@ -use std::cell::RefCell; -use std::fmt::Debug; -use std::rc::Rc; - -use cosmwasm_schema::schemars::JsonSchema; -use cosmwasm_schema::serde::Deserialize; -use cosmwasm_std::{ - from_slice, wasm_execute, Addr, Binary, Coin, CustomQuery, Deps, DepsMut, Empty, Env, - MessageInfo, Response, StdResult, WasmMsg, -}; -use neutron_sdk::bindings::msg::NeutronMsg; -use neutron_sdk::bindings::query::NeutronQuery; - -use astro_satellite::error::ContractError; -use astro_satellite::state::Config; -use astro_satellite_neutron::contract::{execute, instantiate}; -use astro_satellite_package::{ExecuteMsg, InstantiateMsg, UpdateConfigMsg}; -use astroport_ibc::{SIGNAL_OUTAGE_LIMITS, TIMEOUT_LIMITS}; -use astroport_mocks::cw_multi_test::{AppBuilder, FailingModule, WasmKeeper}; -use astroport_mocks::{ - anyhow::Result as AnyResult, - cw_multi_test::{AppResponse, BasicApp, Contract, ContractWrapper, Executor}, -}; -use astroport_mocks::{astroport_address, MockSatelliteBuilder}; - -pub type NeutronApp = BasicApp; - -fn mock_app(owner: &Addr, coins: Vec) -> NeutronApp { - AppBuilder::new() - .with_custom(FailingModule::::new()) - .with_wasm::, WasmKeeper<_, _>>( - WasmKeeper::new(), - ) - .build(|router, _, storage| { - // initialization moved to App construction - router.bank.init_balance(storage, owner, coins).unwrap() - }) -} - -fn satellite_contract() -> Box> { - Box::new(ContractWrapper::new(execute, instantiate, noop_query)) -} - -fn noop_query(_deps: Deps, _env: Env, _msg: Empty) -> StdResult -where - Q: CustomQuery, -{ - Ok(Default::default()) -} - -fn noop_contract() -> Box> -where - T: Clone + Debug + PartialEq + JsonSchema + 'static, - C: CustomQuery + for<'de> Deserialize<'de> + 'static, -{ - fn noop_execute( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - _msg: Empty, - ) -> StdResult { - Ok(Response::new()) - } - - Box::new(ContractWrapper::new_with_empty( - noop_execute, - noop_execute, - noop_query, - )) -} - -#[test] -fn test_check_messages() { - let owner = Addr::unchecked("owner"); - let mut app = mock_app(&owner, vec![]); - - let satellite_code = app.store_code(satellite_contract()); - let err = app - .instantiate_contract( - satellite_code, - owner.clone(), - &InstantiateMsg { - owner: owner.to_string(), - astro_denom: "none".to_string(), - transfer_channel: "none".to_string(), - main_controller: "none".to_string(), - main_maker: "none".to_string(), - timeout: 0, - max_signal_outage: 1209600, - emergency_owner: owner.to_string(), - }, - &[], - "Satellite label", - None, - ) - .unwrap_err(); - assert_eq!( - format!( - "Timeout must be within limits ({} <= timeout <= {})", - TIMEOUT_LIMITS.start(), - TIMEOUT_LIMITS.end() - ), - err.root_cause().to_string() - ); - - let satellite_addr = app - .instantiate_contract( - satellite_code, - owner.clone(), - &InstantiateMsg { - owner: owner.to_string(), - astro_denom: "none".to_string(), - transfer_channel: "none".to_string(), - main_controller: "none".to_string(), - main_maker: "none".to_string(), - timeout: 60, - max_signal_outage: 1209600, - emergency_owner: owner.to_string(), - }, - &[], - "Satellite label", - None, - ) - .unwrap(); - - let noop_code = app.store_code(noop_contract()); - let noop_addr = app - .instantiate_contract(noop_code, owner.clone(), &Empty {}, &[], "none", None) - .unwrap(); - - let messages: Vec<_> = (0..5) - .into_iter() - .map(|_| wasm_execute(&noop_addr, &Empty {}, vec![]).unwrap().into()) - .collect(); - - let err = app - .execute_contract( - owner.clone(), - satellite_addr.clone(), - &ExecuteMsg::::CheckMessages(messages), - &[], - ) - .unwrap_err(); - assert_eq!( - ContractError::MessagesCheckPassed {}, - err.downcast().unwrap() - ); -} - -#[test] -fn test_check_update_configs() { - let owner = Addr::unchecked("owner"); - let mut app = mock_app(&owner, vec![]); - - let satellite_code = app.store_code(satellite_contract()); - let satellite_addr = app - .instantiate_contract( - satellite_code, - owner.clone(), - &InstantiateMsg { - owner: owner.to_string(), - astro_denom: "none".to_string(), - transfer_channel: "none".to_string(), - main_controller: "none".to_string(), - main_maker: "none".to_string(), - timeout: 60, - max_signal_outage: 1209600, - emergency_owner: owner.to_string(), - }, - &[], - "Satellite label", - None, - ) - .unwrap(); - - app.execute_contract( - owner.clone(), - satellite_addr.clone(), - &ExecuteMsg::::UpdateConfig(UpdateConfigMsg { - astro_denom: None, - gov_channel: None, - main_controller_addr: Some(Addr::unchecked("controller_addr_test").to_string()), - main_maker: None, - transfer_channel: None, - accept_new_connections: None, - timeout: None, - emergency_owner: None, - max_signal_outage: None, - }), - &[], - ) - .unwrap(); - - if let Some(res) = app - .wrap() - .query_wasm_raw(satellite_addr.clone(), b"config".as_slice()) - .unwrap() - { - let res: Config = from_slice(&res).unwrap(); - assert_eq!("wasm.controller_addr_test", res.main_controller_port); - } - - let err = app - .execute_contract( - owner.clone(), - satellite_addr.clone(), - &ExecuteMsg::::UpdateConfig(UpdateConfigMsg { - astro_denom: None, - gov_channel: Some(Addr::unchecked("controller_addr_test").to_string()), - main_controller_addr: None, - main_maker: None, - transfer_channel: None, - accept_new_connections: Some(true), - timeout: None, - max_signal_outage: None, - emergency_owner: None, - }), - &[], - ) - .unwrap_err(); - assert_eq!("The gov_channel and the accept_new_connections settings cannot be specified at the same time", err.root_cause().to_string()); - - app.execute_contract( - owner.clone(), - satellite_addr.clone(), - &ExecuteMsg::::UpdateConfig(UpdateConfigMsg { - astro_denom: None, - gov_channel: Some(Addr::unchecked("controller_addr_test").to_string()), - main_controller_addr: None, - main_maker: None, - transfer_channel: None, - accept_new_connections: Some(false), - timeout: None, - max_signal_outage: None, - emergency_owner: None, - }), - &[], - ) - .unwrap(); -} - -#[test] -fn check_ownership_capabilities() { - let app = Rc::new(RefCell::new(BasicApp::default())); - - let astroport = astroport_address(); - let emergency_owner = Addr::unchecked("emergency_owner"); - let another_user = Addr::unchecked("another_user"); - - let satellite = MockSatelliteBuilder::new(&app, &emergency_owner).instantiate(); - - // Setting the same emergency owner just to check the capability - satellite - .update_emergency_owner(&astroport, &emergency_owner) - .unwrap(); - - // As the owner may manage this contract, using this endpoint does not make sense - assert_unauthorized(satellite.update_admin(&astroport)); - - // Instead, we set the contract's admin to itself - app.borrow_mut() - .execute( - astroport.clone(), - WasmMsg::UpdateAdmin { - contract_addr: satellite.address.to_string(), - admin: satellite.address.to_string(), - } - .into(), - ) - .unwrap(); - - // The emergency owner may not change any parameters nor contract admin until max signal outage - // is reached - assert_unauthorized(satellite.update_emergency_owner(&emergency_owner, &emergency_owner)); - assert_unauthorized(satellite.update_admin(&emergency_owner)); - - // No one else, of course, may change anything - assert_unauthorized(satellite.update_emergency_owner(&another_user, &another_user)); - assert_unauthorized(satellite.update_admin(&another_user)); - - // Let's check the same when signal outage is reached - app.borrow_mut().update_block(|b| { - b.time = b.time.plus_seconds(*SIGNAL_OUTAGE_LIMITS.start() + 1); - b.height += 1; - }); - - // The main owner still can change everything - satellite - .update_emergency_owner(&astroport, &emergency_owner) - .unwrap(); - - // Again, as the owner may manage this contract, using this endpoint does not make sense - assert_unauthorized(satellite.update_admin(&astroport)); - - // The emergency owner may change many parameters or contract admin now - satellite - .update_emergency_owner(&emergency_owner, &emergency_owner) - .unwrap(); - satellite.update_admin(&emergency_owner).unwrap(); - - // Again, no one else, of course, may change anything - assert_unauthorized(satellite.update_emergency_owner(&another_user, &another_user)); - assert_unauthorized(satellite.update_admin(&another_user)); -} - -fn assert_unauthorized(result: AnyResult) { - assert_eq!( - result.unwrap_err().downcast::().unwrap(), - ContractError::Unauthorized {} - ) -} diff --git a/packages/astroport-ibc/Cargo.toml b/packages/astroport-ibc/Cargo.toml index f65fcc4..b723664 100644 --- a/packages/astroport-ibc/Cargo.toml +++ b/packages/astroport-ibc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "astroport-ibc" -version = "1.2.1" +version = "1.3.0" authors = ["Astroport"] edition = "2021" description = "Common Astroport IBC types and constants" @@ -11,4 +11,4 @@ homepage = "https://astroport.fi" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -cosmwasm-schema = "1.1" +cosmwasm-schema = { workspace = true } diff --git a/packages/astroport_mocks/Cargo.toml b/packages/astroport_mocks/Cargo.toml index 8572368..8cd426c 100644 --- a/packages/astroport_mocks/Cargo.toml +++ b/packages/astroport_mocks/Cargo.toml @@ -15,7 +15,7 @@ astroport-ibc = { path = "../astroport-ibc" } astro-satellite = { path = "../../contracts/satellite" } astro-satellite-package = { path = "../satellite" } cosmwasm-std = "1.2.5" -cw-multi-test = { git = "https://github.com/astroport-fi/cw-multi-test.git", rev = "269a2c829d1ad25d67caa4600f72d2a21fb8fdeb" } +cw-multi-test = "0.20.0" anyhow = "1.0.41" schemars = "0.8.1" serde = "1.0" diff --git a/packages/controller/Cargo.toml b/packages/controller/Cargo.toml index 75e0067..4c27396 100644 --- a/packages/controller/Cargo.toml +++ b/packages/controller/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ibc-controller-package" -version = "1.0.0" +version = "1.1.1" authors = ["Astroport"] license = "GPL-3.0-only" description = "Astroport ibc-controller contract's types" @@ -9,7 +9,7 @@ homepage = "https://astroport.fi" edition = "2021" [dependencies] -astroport-governance = { git = "https://github.com/astroport-fi/astroport-governance", version = "1" } -astroport-ibc = { path = "../astroport-ibc", version = "1" } -cosmwasm-std = "1.1" -cosmwasm-schema = "1.1" +astroport-governance = { workspace = true } +astroport-ibc = { workspace = true } +cosmwasm-std = { workspace = true } +cosmwasm-schema = { workspace = true } diff --git a/packages/satellite/Cargo.toml b/packages/satellite/Cargo.toml index 60b4a6d..b3643e7 100644 --- a/packages/satellite/Cargo.toml +++ b/packages/satellite/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "astro-satellite-package" -version = "1.0.0" +version = "1.2.0" authors = ["Astroport"] license = "GPL-3.0-only" description = "Astroport satellite contract's types" @@ -9,6 +9,6 @@ homepage = "https://astroport.fi" edition = "2021" [dependencies] -astroport-governance = { git = "https://github.com/astroport-fi/astroport-governance", version = "1" } -cosmwasm-std = "1.1" -cosmwasm-schema = "1.1" +astroport-governance = { workspace = true } +cosmwasm-std = { workspace = true } +cosmwasm-schema = { workspace = true } diff --git a/packages/satellite/src/lib.rs b/packages/satellite/src/lib.rs index e785bbf..1c004c0 100644 --- a/packages/satellite/src/lib.rs +++ b/packages/satellite/src/lib.rs @@ -40,6 +40,7 @@ pub enum ExecuteMsg { TransferAstro {}, UpdateConfig(UpdateConfigMsg), CheckMessages(Vec>), + ExecuteFromMultisig(Vec>), CheckMessagesPassed {}, /// Creates a request to change contract ownership /// ## Executor @@ -75,12 +76,11 @@ pub enum QueryMsg { ProposalState { id: u64 }, } +// MigrateMsg for 1.1.0-hubmove -> 1.2.0. +// init_msg must be set on Terra to perform assembly -> satellite conversion. #[cw_serde] pub struct MigrateMsg { - /// Time in seconds after which the satellite considers itself lost - pub max_signal_outage: u64, - /// An address that can migrate the contract and change its config if the satellite is lost - pub emergency_owner: String, + pub init_msg: Option, } /// This is a generic ICS acknowledgement format.