diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..6a4bc48 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,17 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.2.0] - 2023-11-06 + +### Changed + +- Bumped `cw-dex` to `0.5.0` + - This required adding the field `astroport_liquidity_manager: String` to `InstantiateMsg`. +- Bumped `cw-dex-router` to `0.3.0` +- Bumped `liquidity-helper` and `astroport-liquidity-helper` to `0.3.0` +- Bumped `cosmwasm-std` and `cosmwasm-schema` to `1.5.0` +- Bumped `cw-vault-standard` to `0.4.0` diff --git a/Cargo.lock b/Cargo.lock index b079c24..c343900 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,7 +34,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "423502406a307052f6877030f48b5fb4e9fb338fc5e7c8ca1064210def52876b" dependencies = [ - "astroport", + "astroport 2.9.0", "cosmwasm-std", "cw-storage-plus 1.1.0", "cw20 1.1.0", @@ -44,9 +44,9 @@ dependencies = [ [[package]] name = "apollo-cw-multi-test" -version = "0.16.2" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1c7e04dcaeab52c3390867822b3019f81e239b8bbd3146fb91a83b10fb1f27b" +checksum = "27b88d6037608a781a95ab1125941e2358c37272dcf0d4613de795b81b6ffbf3" dependencies = [ "anyhow", "cosmwasm-std", @@ -55,7 +55,7 @@ dependencies = [ "derivative", "itertools", "k256 0.11.6", - "osmosis-std 0.16.2", + "osmosis-std 0.19.2", "prost 0.9.0", "regex", "schemars", @@ -88,9 +88,9 @@ dependencies = [ [[package]] name = "astroport" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcea351626899d205aab091c891fc878fc9b3c930585fd3ef6222de028d8a7a" +checksum = "78b863a982595743e181f89540d7aaeda35c60b6b5cac9c36c9be30cf11a5ece" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -101,13 +101,42 @@ dependencies = [ "uint", ] +[[package]] +name = "astroport" +version = "3.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "195a7441515817c0d114ec3bebe9faa21393781f796c179c38c75e3cfb9fb4ec" +dependencies = [ + "astroport-circular-buffer", + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 0.15.1", + "cw-utils 1.0.1", + "cw20 0.15.1", + "cw3", + "itertools", + "uint", +] + +[[package]] +name = "astroport-circular-buffer" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dac37467245383e7a6baeaaabc22dfd85a7b70ff5d693f757ba63bbc6e39d2c3" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 0.15.1", + "thiserror", +] + [[package]] name = "astroport-factory" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ecf768e2d3153bebfbe0c502ffa4199a52598e9b6e89fca54339615b2de77eb" dependencies = [ - "astroport", + "astroport 2.9.0", "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 0.15.1", @@ -123,7 +152,7 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6144780ac014665b07616de0cfb35ca6a9411ed821e20c21e02f4f428c8ed51f" dependencies = [ - "astroport", + "astroport 2.9.0", "astroport-governance", "cosmwasm-schema", "cosmwasm-std", @@ -141,7 +170,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72806ace350e81c4e1cab7e275ef91f05bad830275d697d67ad1bd4acc6f016d" dependencies = [ - "astroport", + "astroport 2.9.0", "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 0.15.1", @@ -150,20 +179,38 @@ dependencies = [ [[package]] name = "astroport-liquidity-helper" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3217f55114759b6569fd724dca8f3c5b90286059003a3b5377373256e2c03973" +checksum = "1ecf1e5862475b78cfd3f3ee4ddd6899df2d5ebc77f4a71ecd2b9e0b1816d80c" dependencies = [ "apollo-cw-asset", "apollo-utils", "cosmwasm-schema", "cosmwasm-std", "cw-bigint", - "cw-dex 0.4.0-rc.2", + "cw-dex", "cw-storage-plus 1.1.0", "cw2 1.1.0", "cw20 1.1.0", - "liquidity-helper 0.2.0", + "liquidity-helper", + "thiserror", +] + +[[package]] +name = "astroport-liquidity-manager" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5673fe63b0284e30d1b456dea067cfaa82d2be6eafe5468cc0442917d49a04" +dependencies = [ + "astroport 3.6.1", + "astroport-factory", + "astroport-pair", + "astroport-pair-stable 3.3.0", + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 1.1.0", + "cw20 0.15.1", + "cw20-base", "thiserror", ] @@ -174,7 +221,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92403e5d00e3c77d13d9616661ea9d9308d493fff6bec5e6e5e7bd7b7e0ff6af" dependencies = [ "astro-satellite-package", - "astroport", + "astroport 2.9.0", "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 0.15.1", @@ -189,7 +236,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "648ed6827a8f11012c0377fb60329204e8511fe46c86db3220113e70bdc57826" dependencies = [ - "astroport", + "astroport 2.9.0", "cosmwasm-schema", "cosmwasm-std", "cosmwasm-storage", @@ -200,14 +247,15 @@ dependencies = [ [[package]] name = "astroport-pair" -version = "1.3.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b2287463c922ef2a73f03fe6b16b37123f3f26da5a76998e6ddf828856068f7" +checksum = "fd96bc64722440636ed6267a6945ccce076231a08467d6d46a4af4c4ff062c69" dependencies = [ - "astroport", + "astroport 3.6.1", "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 0.15.1", + "cw-utils 1.0.1", "cw2 0.15.1", "cw20 0.15.1", "integer-sqrt", @@ -215,13 +263,49 @@ dependencies = [ "thiserror", ] +[[package]] +name = "astroport-pair-concentrated" +version = "1.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04a90ce51403c81af3acf8e7028bb0eb095fce802365453b7e4a13bc0eb0d6d7" +dependencies = [ + "astroport 2.9.0", + "astroport-factory", + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 0.15.1", + "cw-utils 0.15.1", + "cw2 0.15.1", + "cw20 0.15.1", + "itertools", + "thiserror", +] + [[package]] name = "astroport-pair-stable" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3a262f2b6916e2a83808b246ff16cb2306a416e88b15a47ddbea5f8b666b1a4" dependencies = [ - "astroport", + "astroport 2.9.0", + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 0.15.1", + "cw-utils 1.0.1", + "cw2 0.15.1", + "cw20 0.15.1", + "itertools", + "thiserror", +] + +[[package]] +name = "astroport-pair-stable" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ac52657fa25194936d5218a258c2c041df00f0647e954a23f35e99b730f92b" +dependencies = [ + "astroport 3.6.1", + "astroport-circular-buffer", "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 0.15.1", @@ -238,7 +322,7 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e3bbb33c00370bd194cf3a166f1e3f4029a2add2bea01a5eb61e886aefbc85b" dependencies = [ - "astroport", + "astroport 2.9.0", "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 0.15.1", @@ -254,7 +338,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67adbc4240794e886ca1edbc7d46bc8a54c7aca7217d73ddcfbc90e1dbb030e7" dependencies = [ - "astroport", + "astroport 2.9.0", "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 0.15.1", @@ -270,7 +354,7 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3360383a2e585211da9a455ad57eb100578253b5d18a387f025cadd666604d99" dependencies = [ - "astroport", + "astroport 2.9.0", "cosmwasm-schema", "cosmwasm-std", "cw2 0.15.1", @@ -285,7 +369,7 @@ version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dffce7cf86bf4d4f177ef941145352499e802abc4b898032af7808d16cca6371" dependencies = [ - "astroport", + "astroport 2.9.0", "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 0.15.1", @@ -301,7 +385,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44156757bfab3d4bd208d9b86b890d1478f45d07c8f8d3d1c3e3da91081cb54d" dependencies = [ - "astroport", + "astroport 2.9.0", "cosmwasm-schema", "cosmwasm-std", "cw1-whitelist", @@ -367,6 +451,12 @@ version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + [[package]] name = "bindgen" version = "0.60.1" @@ -608,11 +698,12 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ca101fbf2f76723711a30ea3771ef312ec3ec254ad021b237871ed802f9f175" +checksum = "d8bb3c77c3b7ce472056968c745eb501c440fbc07be5004eba02782c35bfbbe3" dependencies = [ "digest 0.10.6", + "ecdsa 0.16.7", "ed25519-zebra", "k256 0.13.1", "rand_core 0.6.4", @@ -621,18 +712,18 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c73d2dd292f60e42849d2b07c03d809cf31e128a4299a805abd6d24553bcaaf5" +checksum = "fea73e9162e6efde00018d55ed0061e93a108b5d6ec4548b4f8ce3c706249687" dependencies = [ "syn 1.0.107", ] [[package]] name = "cosmwasm-schema" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce34a08020433989af5cc470104f6bd22134320fe0221bd8aeb919fd5ec92d5" +checksum = "0df41ea55f2946b6b43579659eec048cc2f66e8c8e2e3652fc5e5e476f673856" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -643,9 +734,9 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96694ec781a7dd6dea1f968a2529ade009c21ad999c88b5f53d6cc495b3b96f7" +checksum = "43609e92ce1b9368aa951b334dd354a2d0dd4d484931a5f83ae10e12a26c8ba9" dependencies = [ "proc-macro2", "quote", @@ -654,11 +745,12 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a44d3f9c25b2f864737c6605a98f2e4675d53fd8bbc7cf4d7c02475661a793d" +checksum = "04d6864742e3a7662d024b51a94ea81c9af21db6faea2f9a6d2232bb97c6e53e" dependencies = [ "base64 0.21.3", + "bech32", "bnum", "cosmwasm-crypto", "cosmwasm-derive", @@ -669,6 +761,7 @@ dependencies = [ "serde", "serde-json-wasm", "sha2 0.10.6", + "static_assertions", "thiserror", ] @@ -790,69 +883,34 @@ dependencies = [ [[package]] name = "cw-dex" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8948dc1d7efcbcf2331b26271f30bc22ca68713d273bb9d68d8acad3e05afda4" -dependencies = [ - "apollo-cw-asset", - "apollo-utils", - "cosmwasm-schema", - "cosmwasm-std", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw20 1.1.0", - "thiserror", -] - -[[package]] -name = "cw-dex" -version = "0.4.0-rc.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6754c95d50772679629d18644b5764c715c2adea10b21b4b8b31ccd197a7c66e" +checksum = "6b8d40af4c29539a1c01e71d7c20cc0d65500b49ab98655e5ee7b5e7972c8bb5" dependencies = [ "apollo-cw-asset", "apollo-utils", - "astroport", + "astroport 2.9.0", "cosmwasm-schema", "cosmwasm-std", - "cw-storage-plus 1.1.0", "cw-utils 1.0.1", - "cw20 1.1.0", - "osmosis-std 0.16.2", - "thiserror", - "uint", -] - -[[package]] -name = "cw-dex-router" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81c676d4d069b16a4d3dd397319d57fcdb9ae2f6db1e6a63329e547c48bffe34" -dependencies = [ - "apollo-cw-asset", - "apollo-utils", - "cosmwasm-schema", - "cosmwasm-std", - "cw-controllers", - "cw-dex 0.1.1", - "cw-storage-plus 1.1.0", "cw2 1.1.0", "cw20 1.1.0", + "osmosis-std 0.19.2", "thiserror", ] [[package]] name = "cw-dex-router" -version = "0.2.0-rc.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4dcc1413a73797fbc909eb606d889350ef0b345dddeda82f904fe7de34e96e6" +checksum = "c89c2003242dc9df0947524a7f8ee57d2fb9d5a73f7bda9b6454ba72535cf340" dependencies = [ "apollo-cw-asset", "apollo-utils", "cosmwasm-schema", "cosmwasm-std", "cw-controllers", - "cw-dex 0.4.0-rc.2", + "cw-dex", "cw-storage-plus 1.1.0", "cw2 1.1.0", "cw20 1.1.0", @@ -861,19 +919,21 @@ dependencies = [ [[package]] name = "cw-it" -version = "0.2.0-rc.4" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d773e4f40f344014825f05c735aff5ade2134324e1f59180df7c8a03bfaa65b" +checksum = "f452b759fc448ec05d20dc70f25dda8b83ba0a7c994049d27556fd1813a5ad0d" dependencies = [ "anyhow", "apollo-cw-multi-test", - "astroport", + "astroport 2.9.0", "astroport-factory", "astroport-generator", + "astroport-liquidity-manager", "astroport-maker", "astroport-native-coin-registry", "astroport-pair", - "astroport-pair-stable", + "astroport-pair-concentrated", + "astroport-pair-stable 2.1.2", "astroport-router", "astroport-staking", "astroport-token", @@ -884,7 +944,7 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw20 0.15.1", - "osmosis-std 0.19.1", + "osmosis-std 0.19.2", "osmosis-test-tube", "paste", "prost 0.11.9", @@ -986,9 +1046,22 @@ dependencies = [ [[package]] name = "cw-vault-standard" -version = "0.3.3-rc.1" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "908934004eb811c72acd4d2d4f6d936695a7e9236815c01c4b6ce3f47c29d272" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-utils 1.0.1", + "schemars", + "serde", +] + +[[package]] +name = "cw-vault-standard" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12a9e148a205aebfb2bf069a5c3756617411c0d8a250f29ec800fa5811090e91" +checksum = "9e70a60d4a86860d6b51908201339530c47ef7bfc4fb137f9f9f54468124d35d" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -999,14 +1072,14 @@ dependencies = [ [[package]] name = "cw-vault-standard-test-helpers" -version = "0.3.3-rc.4" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8ec267767fbf156d6150b071cdfae2a42d6389dbb2d214e9d2b52b3cf13018" +checksum = "e9e5f04b9bc896433854415371e33480082d7d3047a0e9a1d2c633317088f9cd" dependencies = [ "cosmwasm-std", "cw-it", "cw-utils 1.0.1", - "cw-vault-standard", + "cw-vault-standard 0.3.3", ] [[package]] @@ -1109,6 +1182,21 @@ dependencies = [ "thiserror", ] +[[package]] +name = "cw3" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "171af3d9127de6805a7dd819fb070c7d2f6c3ea85f4193f42cef259f0a7f33d5" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-utils 1.0.1", + "cw20 1.1.0", + "schemars", + "serde", + "thiserror", +] + [[package]] name = "der" version = "0.6.1" @@ -1832,24 +1920,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "liquidity-helper" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fcbaa0b50025e319bec34d39de1af4684252b22b0bdeff260bfb68b8c250d8f" -dependencies = [ - "apollo-cw-asset", - "apollo-utils", - "cosmwasm-schema", - "cosmwasm-std", - "cw20 1.1.0", - "schemars", - "serde", -] - -[[package]] -name = "liquidity-helper" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db586fec0aa5d95ae9fccba0ee30ea75474709e0dcdb312b5f75302cd25262e9" +checksum = "b846a5c7e176006c35dff84545f5c32da01f2ab38edb0ff0d13f0f718a5aa0ea" dependencies = [ "apollo-cw-asset", "apollo-utils", @@ -1860,25 +1933,25 @@ dependencies = [ [[package]] name = "locked-astroport-vault" -version = "0.1.0-rc.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3ebdb74ecc9d95e87fa7764380b42773b1fd6cfe672e1c199a6e115ecfbed0" +checksum = "90e5a3204732fe68d983349ebcb9518a5c847b772cf06ca375f32fd9edbfe700" dependencies = [ "apollo-cw-asset", "apollo-utils", "cosmwasm-schema", "cosmwasm-std", "cw-address-like", - "cw-dex 0.4.0-rc.2", - "cw-dex-router 0.2.0-rc.2", + "cw-dex", + "cw-dex-router", "cw-item-set", "cw-ownable", "cw-storage-plus 1.1.0", "cw-utils 1.0.1", - "cw-vault-standard", + "cw-vault-standard 0.3.3", "cw2 1.1.0", "cw20 1.1.0", - "liquidity-helper 0.1.0", + "liquidity-helper", "optional_struct", "osmosis-std 0.14.0", "schemars", @@ -1889,24 +1962,24 @@ dependencies = [ [[package]] name = "locked-astroport-vault-test-helpers" -version = "0.1.0-rc.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c655bdf3e9e5b99e78a14323f63df00f1674e0ee4da652a643329d9d00e6de10" +checksum = "7036cb51702be26d282b7fe18eba1a8fcea0bebe484563da23256fb9cdbf70bf" dependencies = [ "apollo-cw-asset", "astroport-liquidity-helper", "cosmwasm-schema", "cosmwasm-std", - "cw-dex 0.4.0-rc.2", - "cw-dex-router 0.2.0-rc.2", + "cw-dex", + "cw-dex-router", "cw-it", "cw-ownable", "cw-utils 1.0.1", - "cw-vault-standard", + "cw-vault-standard 0.3.3", "cw-vault-standard-test-helpers", "cw2 1.1.0", "cw20 1.1.0", - "liquidity-helper 0.1.0", + "liquidity-helper", "locked-astroport-vault", ] @@ -2084,41 +2157,9 @@ dependencies = [ [[package]] name = "osmosis-std" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75895e4db1a81ca29118e366365744f64314938327e4eedba8e6e462fb15e94f" -dependencies = [ - "chrono", - "cosmwasm-std", - "osmosis-std-derive 0.16.2", - "prost 0.11.9", - "prost-types", - "schemars", - "serde", - "serde-cw-value", -] - -[[package]] -name = "osmosis-std" -version = "0.17.0-rc0" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0b022b748710ecdf1adc6a124c3bef29f17ef05e7fa1260a08889d1d53f9cc5" -dependencies = [ - "chrono", - "cosmwasm-std", - "osmosis-std-derive 0.16.2", - "prost 0.11.9", - "prost-types", - "schemars", - "serde", - "serde-cw-value", -] - -[[package]] -name = "osmosis-std" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "088997c4da871db9edb9e090a4e164d1cb12498781491ccb8030246287400300" +checksum = "798fade51443a0e07eb25b59a11b320b9e8f03e6e8fbe14c520258f04742fe13" dependencies = [ "chrono", "cosmwasm-std", @@ -2157,15 +2198,15 @@ dependencies = [ [[package]] name = "osmosis-test-tube" -version = "17.0.0-rc0" +version = "19.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "977a2b4f088dd704a47e96b5914e28465cfcdb1cb1145a1f9b45c219a9b145c5" +checksum = "b0dde0a21f1323e7c78f46da4bd0b24149d26483785fb5b39f74016f3f524aad" dependencies = [ "base64 0.13.1", "bindgen", "cosmrs", "cosmwasm-std", - "osmosis-std 0.17.0-rc0", + "osmosis-std 0.19.2", "prost 0.11.9", "serde", "serde_json", @@ -3126,36 +3167,36 @@ dependencies = [ [[package]] name = "test-case" -version = "3.1.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a1d6e7bde536b0412f20765b76e921028059adfd1b90d8974d33fd3c91b25df" +checksum = "c8f1e820b7f1d95a0cdbf97a5df9de10e1be731983ab943e56703ac1b8e9d425" dependencies = [ "test-case-macros", ] [[package]] name = "test-case-core" -version = "3.1.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d10394d5d1e27794f772b6fc854c7e91a2dc26e2cbf807ad523370c2a59c0cee" +checksum = "54c25e2cb8f5fcd7318157634e8838aa6f7e4715c96637f969fabaccd1ef5462" dependencies = [ "cfg-if", "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.107", + "syn 2.0.31", ] [[package]] name = "test-case-macros" -version = "3.1.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeb9a44b1c6a54c1ba58b152797739dba2a83ca74e18168a68c980eb142f9404" +checksum = "37cfd7bbc88a0104e304229fba519bdc45501a30b760fb72240342f1289ad257" dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.107", + "syn 2.0.31", "test-case-core", ] @@ -3168,7 +3209,7 @@ dependencies = [ "base64 0.13.1", "cosmrs", "cosmwasm-std", - "osmosis-std 0.19.1", + "osmosis-std 0.19.2", "prost 0.11.9", "serde", "serde_json", @@ -3397,23 +3438,23 @@ checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" [[package]] name = "vault-zapper" -version = "0.1.0" +version = "0.2.0" dependencies = [ "apollo-cw-asset", "apollo-utils", "astroport-liquidity-helper", "cosmwasm-schema", "cosmwasm-std", - "cw-dex 0.4.0-rc.2", - "cw-dex-router 0.1.0", + "cw-dex", + "cw-dex-router", "cw-it", "cw-storage-plus 1.1.0", "cw-utils 1.0.1", - "cw-vault-standard", + "cw-vault-standard 0.4.0", "cw-vault-standard-test-helpers", "cw2 1.1.0", "cw20 1.1.0", - "liquidity-helper 0.1.0", + "liquidity-helper", "locked-astroport-vault", "locked-astroport-vault-test-helpers", "test-case", diff --git a/Cargo.toml b/Cargo.toml index 5f47963..ab677b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vault-zapper" -version = "0.1.0" +version = "0.2.0" authors = ["Sturdy "] edition = "2021" @@ -43,23 +43,23 @@ builds = [ [dependencies] apollo-utils = "0.1.1" -cosmwasm-schema = "1.4.0" -cosmwasm-std = "1.4.0" +cosmwasm-schema = "1.5.0" +cosmwasm-std = "1.5.0" cw-storage-plus = "1.1.0" cw2 = "1.1.0" cw20 = "1.1.0" thiserror = { version = "1.0.48" } -cw-vault-standard = { version = "0.3.3-rc.1", features = ["lockup"] } -cw-dex-router = { version = "0.1.0", features = ["library"] } +cw-vault-standard = { version = "0.4.0", features = ["lockup"] } +cw-dex-router = { version = "0.3.0", features = ["library"] } apollo-cw-asset = "0.1.2" -cw-dex = "0.4.0-rc.2" -liquidity-helper = "0.1.0" +cw-dex = "0.5.0" +liquidity-helper = "0.3.0" [dev-dependencies] -cw-it = { version = "0.2.0-rc.4", features = ["astroport-multi-test"] } -cw-vault-standard-test-helpers = "0.3.3-rc.4" -locked-astroport-vault-test-helpers = "0.1.0-rc.4" -locked-astroport-vault = "0.1.0-rc.2" -astroport-liquidity-helper = "0.2.0" -test-case = "3.1.0" +cw-it = { version = "0.2.3", features = ["astroport-multi-test"] } +cw-vault-standard-test-helpers = "0.3.3" +locked-astroport-vault-test-helpers = "0.2.0" +locked-astroport-vault = "0.2.0" +astroport-liquidity-helper = "0.3.0" +test-case = "3.2.1" cw-utils = "1.0.1" diff --git a/src/contract.rs b/src/contract.rs index 6104eed..3282850 100644 --- a/src/contract.rs +++ b/src/contract.rs @@ -2,7 +2,7 @@ use apollo_utils::submessages::{find_event, parse_attribute_value}; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, + to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, }; use cw2::set_contract_version; use cw_vault_standard::extensions::lockup::{ @@ -25,6 +25,9 @@ use crate::withdraw::{ execute_zap_base_tokens, }; +#[cfg(feature = "astroport")] +use crate::state::ASTROPORT_LIQUIDITY_MANAGER; + // version info for migration info const CONTRACT_NAME: &str = "crates.io:vault-zapper"; const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -41,6 +44,12 @@ pub fn instantiate( ROUTER.save(deps.storage, &msg.router.check(deps.api)?)?; LIQUIDITY_HELPER.save(deps.storage, &msg.liquidity_helper.check(deps.api)?)?; + #[cfg(feature = "astroport")] + ASTROPORT_LIQUIDITY_MANAGER.save( + deps.storage, + &deps.api.addr_validate(&msg.astroport_liquidity_manager)?, + )?; + Ok(Response::default()) } @@ -192,11 +201,11 @@ pub fn execute( #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { - QueryMsg::DepositableAssets { vault_address } => to_binary(&query_depositable_assets( + QueryMsg::DepositableAssets { vault_address } => to_json_binary(&query_depositable_assets( deps, deps.api.addr_validate(&vault_address)?, )?), - QueryMsg::ReceiveChoices { vault_address } => to_binary(&query_receive_choices( + QueryMsg::ReceiveChoices { vault_address } => to_json_binary(&query_receive_choices( deps, deps.api.addr_validate(&vault_address)?, )?), @@ -205,7 +214,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { owner, start_after_id, limit, - } => to_binary(&query_user_unlocking_positions_for_vault( + } => to_json_binary(&query_user_unlocking_positions_for_vault( deps, env, deps.api.addr_validate(&vault_address)?, @@ -218,7 +227,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { start_after_vault_addr, start_after_id, limit, - } => to_binary(&query_all_user_unlocking_positions( + } => to_json_binary(&query_all_user_unlocking_positions( deps, env, deps.api.addr_validate(&owner)?, diff --git a/src/deposit.rs b/src/deposit.rs index 4a657b8..0367cd2 100644 --- a/src/deposit.rs +++ b/src/deposit.rs @@ -1,7 +1,7 @@ use apollo_cw_asset::{Asset, AssetInfo, AssetList}; use apollo_utils::assets::receive_assets; use cosmwasm_std::{ - to_binary, Addr, Binary, Coin, DepsMut, Empty, Env, Event, MessageInfo, Response, Uint128, + to_json_binary, Addr, Binary, Coin, DepsMut, Empty, Env, Event, MessageInfo, Response, Uint128, }; use cw_dex::traits::Pool as PoolTrait; use cw_dex::Pool; @@ -9,7 +9,7 @@ use cw_vault_standard::VaultContract; use crate::helpers::VaultHelper; use crate::msg::CallbackMsg; -use crate::state::{LIQUIDITY_HELPER, ROUTER}; +use crate::state::{ASTROPORT_LIQUIDITY_MANAGER, LIQUIDITY_HELPER, ROUTER}; use crate::ContractError; pub fn execute_deposit( @@ -45,7 +45,7 @@ pub fn execute_deposit( .into_cosmos_msg(&env)?; let event = Event::new("apollo/vault-zapper/execute_deposit") - .add_attribute("assets", to_binary(&assets)?.to_string()) + .add_attribute("assets", to_json_binary(&assets)?.to_string()) .add_attribute("vault_address", &vault_address) .add_attribute("recipient", &recipient) .add_attribute("min_out", min_out); @@ -67,7 +67,13 @@ pub fn execute_deposit( } //Check if the depositable asset is an LP token - let pool = Pool::get_pool_for_lp_token(deps.as_ref(), &deposit_asset_info).ok(); + let astroport_liquidity_manager = ASTROPORT_LIQUIDITY_MANAGER.may_load(deps.storage)?; + let pool = Pool::get_pool_for_lp_token( + deps.as_ref(), + &deposit_asset_info, + astroport_liquidity_manager, + ) + .ok(); // Set the target of the basket liquidation, depending on if depositable asset // is an LP token or not @@ -156,9 +162,9 @@ pub fn callback_provide_liquidity( let pool: Binary = match pool { #[cfg(feature = "astroport")] - Pool::Astroport(pool) => to_binary(&pool)?, + Pool::Astroport(pool) => to_json_binary(&pool)?, #[cfg(feature = "osmosis")] - Pool::Osmosis(pool) => to_binary(&pool)?, + Pool::Osmosis(pool) => to_json_binary(&pool)?, _ => panic!("Unsupported pool type"), }; @@ -231,9 +237,12 @@ pub fn callback_enforce_min_out( let event = Event::new("apollo/vault-zapper/callback_enforce_min_out") .add_attribute("recipient", recipient) - .add_attribute("assets", to_binary(&assets)?.to_string()) - .add_attribute("min_out", to_binary(&min_out)?.to_string()) - .add_attribute("assets_received", to_binary(&assets_received)?.to_string()); + .add_attribute("assets", to_json_binary(&assets)?.to_string()) + .add_attribute("min_out", to_json_binary(&min_out)?.to_string()) + .add_attribute( + "assets_received", + to_json_binary(&assets_received)?.to_string(), + ); Ok(Response::new().add_event(event)) } diff --git a/src/helpers.rs b/src/helpers.rs index 50aa20d..fdd7691 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -2,7 +2,7 @@ use cosmwasm_schema::schemars::JsonSchema; use cosmwasm_schema::serde::Serialize; use apollo_cw_asset::AssetInfo; -use cosmwasm_std::{to_binary, CosmosMsg, StdResult, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, CosmosMsg, StdResult, Uint128, WasmMsg}; use cw_vault_standard::VaultContract; /// A trait to help with depositing an `Asset` into a vault. @@ -36,7 +36,7 @@ where // If CW20, first increase allowance msgs.push(CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: deposit_asset_info.to_string(), - msg: to_binary(&cw20::Cw20ExecuteMsg::IncreaseAllowance { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::IncreaseAllowance { spender: self.addr.to_string(), amount, expires: None, diff --git a/src/lockup.rs b/src/lockup.rs index e313d02..2db09c2 100644 --- a/src/lockup.rs +++ b/src/lockup.rs @@ -1,5 +1,5 @@ use cosmwasm_std::{ - to_binary, Addr, CosmosMsg, DepsMut, Empty, Env, MessageInfo, ReplyOn, Response, SubMsg, + to_json_binary, Addr, CosmosMsg, DepsMut, Empty, Env, MessageInfo, ReplyOn, Response, SubMsg, WasmMsg, }; use cw_vault_standard::extensions::lockup::LockupExecuteMsg; @@ -35,7 +35,7 @@ pub fn execute_unlock( let unlock_msg: CosmosMsg = CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: vault_address.to_string(), funds: vec![vault_token.clone()], - msg: to_binary( + msg: to_json_binary( &VaultStandardExecuteMsg::::VaultExtension( ExtensionExecuteMsg::Lockup(LockupExecuteMsg::Unlock { amount: vault_token.amount, diff --git a/src/msg.rs b/src/msg.rs index 14834c9..196c6b2 100644 --- a/src/msg.rs +++ b/src/msg.rs @@ -1,6 +1,6 @@ use apollo_cw_asset::{AssetInfo, AssetList, AssetListUnchecked, AssetUnchecked}; use cosmwasm_schema::{cw_serde, QueryResponses}; -use cosmwasm_std::{to_binary, Addr, CosmosMsg, Env, StdResult, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, CosmosMsg, Env, StdResult, Uint128, WasmMsg}; use cw_dex::Pool; use cw_dex_router::helpers::CwDexRouterUnchecked; use liquidity_helper::LiquidityHelperUnchecked; @@ -9,6 +9,10 @@ use liquidity_helper::LiquidityHelperUnchecked; pub struct InstantiateMsg { pub router: CwDexRouterUnchecked, pub liquidity_helper: LiquidityHelperUnchecked, + /// The address of the `astroport-liquidity-manager` contract. Only needed + /// if the `astroport` feature flag is enabled. + #[cfg(feature = "astroport")] + pub astroport_liquidity_manager: String, } #[cw_serde] @@ -126,7 +130,7 @@ impl CallbackMsg { pub fn into_cosmos_msg(&self, env: &Env) -> StdResult { Ok(CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: env.contract.address.to_string(), - msg: to_binary(&ExecuteMsg::Callback(self.clone()))?, + msg: to_json_binary(&ExecuteMsg::Callback(self.clone()))?, funds: vec![], })) } diff --git a/src/query.rs b/src/query.rs index 12c05f5..a270188 100644 --- a/src/query.rs +++ b/src/query.rs @@ -7,7 +7,7 @@ use cw_dex::Pool; use cw_storage_plus::Bound; use crate::msg::ReceiveChoice; -use crate::state::{self, DEFAULT_LIMIT, LOCKUP_IDS, ROUTER}; +use crate::state::{self, ASTROPORT_LIQUIDITY_MANAGER, DEFAULT_LIMIT, LOCKUP_IDS, ROUTER}; use cw_vault_standard::extensions::lockup::{LockupQueryMsg, UnlockingPosition}; use cw_vault_standard::{ExtensionQueryMsg, VaultContract, VaultStandardQueryMsg}; @@ -22,8 +22,10 @@ pub fn query_depositable_assets(deps: Deps, vault_address: Addr) -> StdResult AssetInfo::native(&vault.base_token), }; - // Check if deposit asset is an LP token - let pool = Pool::get_pool_for_lp_token(deps, &deposit_asset_info).ok(); + // Check if deposit asset is an LP token3 + let astroport_liquidity_manager = ASTROPORT_LIQUIDITY_MANAGER.may_load(deps.storage)?; + let pool = + Pool::get_pool_for_lp_token(deps, &deposit_asset_info, astroport_liquidity_manager).ok(); // If deposit asset is an LP token, the target of the basket liquidation is // the first asset in the pool. Otherwise it is just the deposit asset. @@ -70,7 +72,9 @@ pub fn query_receive_choices(deps: Deps, vault_address: Addr) -> StdResult = match pool { Some(pool) => { diff --git a/src/state.rs b/src/state.rs index 2b2d37b..f395e7a 100644 --- a/src/state.rs +++ b/src/state.rs @@ -8,6 +8,8 @@ use liquidity_helper::LiquidityHelper; pub const ROUTER: Item = Item::new("router"); pub const LIQUIDITY_HELPER: Item = Item::new("liquidity_helper"); +pub const ASTROPORT_LIQUIDITY_MANAGER: Item = Item::new("astroport_liquidity_manager"); + /// Stores the lockup ids for unlocking positions. The key is a tuple of /// (owner_address, vault_address, lockup_id). pub const LOCKUP_IDS: Map<(Addr, Addr, u64), ()> = Map::new("lockup_ids"); diff --git a/src/withdraw.rs b/src/withdraw.rs index 9104ebf..bf14bfe 100644 --- a/src/withdraw.rs +++ b/src/withdraw.rs @@ -2,7 +2,8 @@ use apollo_cw_asset::{Asset, AssetInfo, AssetList}; use apollo_utils::assets::receive_assets; use cosmwasm_schema::cw_serde; use cosmwasm_std::{ - to_binary, Addr, CosmosMsg, DepsMut, Empty, Env, Event, MessageInfo, Response, Uint128, WasmMsg, + to_json_binary, Addr, CosmosMsg, DepsMut, Empty, Env, Event, MessageInfo, Response, Uint128, + WasmMsg, }; use cw_dex::traits::Pool as PoolTrait; use cw_dex::Pool; @@ -11,7 +12,7 @@ use cw_vault_standard::msg::{ExtensionExecuteMsg, VaultStandardExecuteMsg as Vau use cw_vault_standard::VaultContract; use crate::msg::{CallbackMsg, ReceiveChoice}; -use crate::state::{LOCKUP_IDS, ROUTER}; +use crate::state::{ASTROPORT_LIQUIDITY_MANAGER, LOCKUP_IDS, ROUTER}; use crate::ContractError; #[cw_serde] @@ -111,7 +112,7 @@ pub fn withdraw( RedeemType::Lockup(lockup_id) => CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: vault_address.to_string(), funds: vec![], - msg: to_binary(&VaultExecuteMsg::::VaultExtension( + msg: to_json_binary(&VaultExecuteMsg::::VaultExtension( ExtensionExecuteMsg::Lockup(LockupExecuteMsg::WithdrawUnlocked { recipient: None, lockup_id, @@ -123,9 +124,12 @@ pub fn withdraw( let event = Event::new("apollo/vault-zapper/withdraw") .add_attribute("vault_address", &vault_address) .add_attribute("recipient", &recipient) - .add_attribute("receive_choice", to_binary(&receive_choice)?.to_string()) - .add_attribute("withdraw_type", to_binary(&withdraw_type)?.to_string()) - .add_attribute("min_out", to_binary(&min_out)?.to_string()); + .add_attribute( + "receive_choice", + to_json_binary(&receive_choice)?.to_string(), + ) + .add_attribute("withdraw_type", to_json_binary(&withdraw_type)?.to_string()) + .add_attribute("min_out", to_json_binary(&min_out)?.to_string()); Ok(Response::new() .add_message(withdraw_msg) @@ -156,10 +160,13 @@ pub fn execute_zap_base_tokens( let receive_assets_res = receive_assets(&info, &env, &vec![base_token.clone()].into())?; let event = Event::new("apollo/vault-zapper/execute_zap_base_tokens") - .add_attribute("base_token", to_binary(&base_token.info)?.to_string()) + .add_attribute("base_token", to_json_binary(&base_token.info)?.to_string()) .add_attribute("recipient", &recipient) - .add_attribute("receive_choice", to_binary(&receive_choice)?.to_string()) - .add_attribute("min_out", to_binary(&min_out)?.to_string()); + .add_attribute( + "receive_choice", + to_json_binary(&receive_choice)?.to_string(), + ) + .add_attribute("min_out", to_json_binary(&min_out)?.to_string()); Ok(receive_assets_res .add_message( @@ -187,7 +194,13 @@ pub fn callback_after_redeem( vault_base_token.query_balance(&deps.querier, &env.contract.address)?; let base_token = Asset::new(vault_base_token.clone(), base_token_balance); - let pool = Pool::get_pool_for_lp_token(deps.as_ref(), &vault_base_token).ok(); + let astroport_liquidity_manager = ASTROPORT_LIQUIDITY_MANAGER.may_load(deps.storage)?; + let pool = Pool::get_pool_for_lp_token( + deps.as_ref(), + &vault_base_token, + astroport_liquidity_manager, + ) + .ok(); // Check requested withdrawal assets let (res, withdrawal_assets) = match &receive_choice { diff --git a/tests/common/robot.rs b/tests/common/robot.rs index 7baaaf4..c6bdfe9 100644 --- a/tests/common/robot.rs +++ b/tests/common/robot.rs @@ -185,6 +185,12 @@ impl<'a> VaultZapperRobot<'a> { liquidity_helper: LiquidityHelperUnchecked::new( dependencies.liquidity_helper_addr.clone(), ), + #[cfg(feature = "astroport")] + astroport_liquidity_manager: dependencies + .astroport_contracts + .liquidity_manager + .address + .clone(), }; // Upload contract diff --git a/tests/test_artifacts/astroport-artifacts/VERSION.md b/tests/test_artifacts/astroport-artifacts/VERSION.md index d0899cf..9cb03fc 100644 --- a/tests/test_artifacts/astroport-artifacts/VERSION.md +++ b/tests/test_artifacts/astroport-artifacts/VERSION.md @@ -1 +1,3 @@ -These artifacts were downloaded from the Github repository `astroport-core` on the [releases page](https://github.com/astroport-fi/astroport-core/releases/tag/v2.8.0). The version of the artifacts is `v2.8.0`. +These artifacts, except for `astroport_liquidity_manager.wasm`, were downloaded from the Github repository `astroport-core` on the [v2.8.0 release page](https://github.com/astroport-fi/astroport-core/releases/tag/v2.8.0). + +`astroport_liquidity_manager.wasm` was downloaded from the Github repository `astroport-core` on the [v3.6.1 release page](https://github.com/astroport-fi/astroport-core/releases/tag/v3.6.1). diff --git a/tests/test_artifacts/astroport-artifacts/astroport_liquidity_manager.wasm b/tests/test_artifacts/astroport-artifacts/astroport_liquidity_manager.wasm new file mode 100644 index 0000000..48f078f Binary files /dev/null and b/tests/test_artifacts/astroport-artifacts/astroport_liquidity_manager.wasm differ diff --git a/tests/test_artifacts/astroport_liquidity_helper.wasm b/tests/test_artifacts/astroport_liquidity_helper.wasm index 13dbf7b..e8f977c 100644 Binary files a/tests/test_artifacts/astroport_liquidity_helper.wasm and b/tests/test_artifacts/astroport_liquidity_helper.wasm differ diff --git a/tests/test_artifacts/checksums.txt b/tests/test_artifacts/checksums.txt index 0373513..19953f1 100644 --- a/tests/test_artifacts/checksums.txt +++ b/tests/test_artifacts/checksums.txt @@ -1,3 +1,3 @@ -579219463d14bf0175889de23ada925b453c96ff806584e3b09b9481b3375ca1 cw_dex_router_astroport.wasm -00e80be98cacf5e289ee5019a0d4da65547dd92f0627bb5624e9243c8a2241ef astroport_liquidity_helper.wasm -d8be8a2311500aa1fc38d177c024eafc4d1f8185b752f5b654f2b367cfab6cc7 locked_astroport_vault.wasm +f69d9695d854f0f9a67640ca26a0bceec255a4252fca113915c80c1f9cc401d7 cw_dex_router_astroport.wasm +8ac6ac64f14c57d643d5c5b5638c829ae1163c37390c65b16a67c5493a47cd98 astroport_liquidity_helper.wasm +609cd0175fb2b5cefdc2bb24b8b3c91d783e88458edaa2d0d20f0232ecccfdf6 locked_astroport_vault.wasm diff --git a/tests/test_artifacts/cw_dex_router_astroport.wasm b/tests/test_artifacts/cw_dex_router_astroport.wasm index 422d675..881ae05 100644 Binary files a/tests/test_artifacts/cw_dex_router_astroport.wasm and b/tests/test_artifacts/cw_dex_router_astroport.wasm differ diff --git a/tests/test_artifacts/locked_astroport_vault.wasm b/tests/test_artifacts/locked_astroport_vault.wasm index 8019984..79d0085 100644 Binary files a/tests/test_artifacts/locked_astroport_vault.wasm and b/tests/test_artifacts/locked_astroport_vault.wasm differ diff --git a/tests/test_query.rs b/tests/test_query.rs index 589339c..f30b84e 100644 --- a/tests/test_query.rs +++ b/tests/test_query.rs @@ -213,6 +213,11 @@ fn query_unlocking_positions_for_two_vaults() { liquidity_helper: LiquidityHelperUnchecked::new( vault_dependencies.liquidity_helper_addr.clone(), ), + astroport_liquidity_manager: vault_dependencies + .astroport_contracts + .liquidity_manager + .address + .clone(), }; let astro_ntrn_vault_robot = LockedAstroportVaultRobot::new_with_instantiate_msg( &runner, @@ -366,59 +371,84 @@ fn query_unlocking_positions_for_two_vaults() { ); // Query with start_after_vault_addr + // Addresses are randomly generated, so we need to check which is + // lexigraphically smaller + let ( + first_vault, + second_vault, + first_vault_second_pos, + second_vault_first_pos, + second_vault_second_pos, + ) = if vault_1_addr < vault_2_addr { + ( + vault_1_addr.clone(), + vault_2_addr.clone(), + vault_1_unlocking_pos_1.clone(), + vault_2_unlocking_pos_0.clone(), + vault_2_unlocking_pos_1.clone(), + ) + } else { + ( + vault_2_addr.clone(), + vault_1_addr.clone(), + vault_2_unlocking_pos_1.clone(), + vault_1_unlocking_pos_0.clone(), + vault_1_unlocking_pos_1.clone(), + ) + }; let res = robot.zapper_query_user_unlocking_positions( &admin.address(), - Some(vault_1_addr.to_string()), + Some(first_vault.to_string()), None, None, ); assert_eq!(res.len(), 1); - let positions_for_vault_two = res.get(&vault_2_addr).unwrap(); + let positions_for_vault_two = res.get(&second_vault).unwrap(); assert_eq!(positions_for_vault_two.len(), 2); assert_eq!( positions_for_vault_two, &vec![ - vault_2_unlocking_pos_0.clone(), - vault_2_unlocking_pos_1.clone() + second_vault_first_pos.clone(), + second_vault_second_pos.clone() ] ); // Query with start_after_vault_addr and start_after_id let res = robot.zapper_query_user_unlocking_positions( &admin.address(), - Some(vault_1_addr.to_string()), + Some(first_vault.to_string()), Some(0), None, ); assert_eq!(res.len(), 2); - let positions_for_vault_one = res.get(&vault_1_addr).unwrap(); - let positions_for_vault_two = res.get(&vault_2_addr).unwrap(); + let positions_for_vault_one = res.get(&first_vault).unwrap(); + let positions_for_vault_two = res.get(&second_vault).unwrap(); assert_eq!(positions_for_vault_one.len(), 1); assert_eq!(positions_for_vault_two.len(), 2); assert_eq!( positions_for_vault_one, - &vec![vault_1_unlocking_pos_1.clone()] + &vec![first_vault_second_pos.clone()] ); assert_eq!( positions_for_vault_two, &vec![ - vault_2_unlocking_pos_0.clone(), - vault_2_unlocking_pos_1.clone() + second_vault_first_pos.clone(), + second_vault_second_pos.clone() ] ); // Query with start_after_vault_addr and start_after_id and limit let res = robot.zapper_query_user_unlocking_positions( &admin.address(), - Some(vault_1_addr.to_string()), + Some(first_vault.to_string()), Some(1), Some(1), ); assert_eq!(res.len(), 1); - let positions_for_vault_two = res.get(&vault_2_addr).unwrap(); + let positions_for_vault_two = res.get(&second_vault).unwrap(); assert_eq!(positions_for_vault_two.len(), 1); assert_eq!( positions_for_vault_two, - &vec![vault_2_unlocking_pos_0.clone()] + &vec![second_vault_first_pos.clone()] ); } diff --git a/tests/test_withdraw.rs b/tests/test_withdraw.rs index 9ec312a..5f009be 100644 --- a/tests/test_withdraw.rs +++ b/tests/test_withdraw.rs @@ -313,7 +313,7 @@ fn redeem_both_assets_of_pool(lock_duration: u64) { // Redeem both assets let receive_choice = ReceiveChoice::Underlying; - let max_rel_diff = "0.000000001"; // One unit lost due to rounding + let max_rel_diff = "0.000000001"; // One or two units lost due to rounding if lock_duration == 0 { robot .zapper_redeem_all( @@ -352,11 +352,11 @@ fn redeem_both_assets_of_pool(lock_duration: u64) { vec![ AssetUnchecked::new( asset1.clone().into(), - asset1_deposit_amount - Uint128::one(), + asset1_deposit_amount - Uint128::one() - Uint128::one(), ), AssetUnchecked::new( asset2.clone().into(), - asset2_deposit_amount - Uint128::one(), + asset2_deposit_amount - Uint128::one() - Uint128::one(), ), ], Unwrap::Ok, @@ -415,11 +415,11 @@ fn redeem_both_assets_of_pool(lock_duration: u64) { vec![ AssetUnchecked::new( asset1.clone().into(), - asset1_deposit_amount - Uint128::one(), + asset1_deposit_amount - Uint128::one() - Uint128::one(), ), AssetUnchecked::new( asset2.clone().into(), - asset2_deposit_amount - Uint128::one(), + asset2_deposit_amount - Uint128::one() - Uint128::one(), ), ], Unwrap::Ok, diff --git a/tests/test_zap_base_token.rs b/tests/test_zap_base_token.rs index 1511154..b82c5c8 100644 --- a/tests/test_zap_base_token.rs +++ b/tests/test_zap_base_token.rs @@ -253,7 +253,7 @@ fn zap_base_tokens_to_both_assets_of_pool() { let base_tokens_received = base_token_balance_after_redeem - base_token_balance_before_redeem; let receive_choice = ReceiveChoice::Underlying; - let max_rel_diff = "0.000000001"; // One unit lost due to rounding + let max_rel_diff = "0.000000001"; // One or two units lost due to rounding robot .zap_base_tokens( @@ -296,11 +296,11 @@ fn zap_base_tokens_to_both_assets_of_pool() { vec![ AssetUnchecked::new( asset1.clone().into(), - asset1_deposit_amount - Uint128::one(), + asset1_deposit_amount - Uint128::one() - Uint128::one(), ), AssetUnchecked::new( asset2.clone().into(), - asset2_deposit_amount - Uint128::one(), + asset2_deposit_amount - Uint128::one() - Uint128::one(), ), ], Unwrap::Ok,