diff --git a/Cargo.lock b/Cargo.lock index 14f5a68f4..4f9cc4309 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ "getrandom", "once_cell", @@ -30,9 +30,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.5" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -68,18 +68,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.34", + "syn 2.0.39", ] [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.34", + "syn 2.0.39", ] [[package]] @@ -178,13 +178,19 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + [[package]] name = "bindgen" version = "0.68.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "cexpr", "clang-sys", "lazy_static", @@ -197,7 +203,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.34", + "syn 2.0.39", "which", ] @@ -214,7 +220,7 @@ dependencies = [ "pbkdf2", "rand_core 0.6.4", "ripemd", - "sha2 0.10.7", + "sha2 0.10.8", "subtle", "zeroize", ] @@ -227,9 +233,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "block-buffer" @@ -263,8 +269,8 @@ dependencies = [ "cosm-orc", "cosmwasm-std", "cw-admin-factory", - "cw-utils 1.0.1", - "cw20 1.1.0", + "cw-utils 1.0.2", + "cw20 1.1.1", "cw20-stake 2.3.0", "dao-dao-core", "dao-interface", @@ -295,9 +301,9 @@ checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[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" @@ -504,31 +510,32 @@ 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.7", + "ecdsa 0.16.9", "ed25519-zebra", - "k256 0.13.1", + "k256 0.13.2", "rand_core 0.6.4", "thiserror", ] [[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.109", ] [[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", @@ -539,9 +546,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", @@ -550,11 +557,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.5", + "bech32", "bnum", "cosmwasm-crypto", "cosmwasm-derive", @@ -564,15 +572,16 @@ dependencies = [ "schemars", "serde", "serde-json-wasm", - "sha2 0.10.7", + "sha2 0.10.8", + "static_assertions", "thiserror", ] [[package]] name = "cosmwasm-storage" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab544dfcad7c9e971933d522d99ec75cc8ddfa338854bb992b092e11bcd7e818" +checksum = "bd2b4ae72a03e8f56c85df59d172d51d2d7dc9cec6e2bc811e3fb60c588032a4" dependencies = [ "cosmwasm-std", "serde", @@ -580,9 +589,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -601,9 +610,9 @@ dependencies = [ [[package]] name = "crypto-bigint" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", "rand_core 0.6.4", @@ -660,10 +669,10 @@ dependencies = [ "cosmwasm-std", "cosmwasm-storage", "cw-multi-test", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20-base 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20-base 1.1.1", "dao-dao-core", "dao-interface", "thiserror", @@ -699,14 +708,14 @@ dependencies = [ [[package]] name = "cw-controllers" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d8edce4b78785f36413f67387e4be7d0cb7d032b5d4164bcc024f9c3f3f2ea" +checksum = "23b129ca74fa41111fd2e1727426532556dc63973420343b659f5c072b85d789" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", "schemars", "serde", "thiserror", @@ -786,8 +795,8 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-multi-test", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw20 1.1.1", + "cw20-base 1.1.1", "thiserror", ] @@ -799,11 +808,11 @@ dependencies = [ "cosmwasm-std", "cw-multi-test", "cw-paginate-storage 2.3.0", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", "cw20-stake 2.3.0", "dao-dao-core", "dao-interface", @@ -817,26 +826,26 @@ version = "2.3.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-storage-plus 1.1.0", + "cw-storage-plus 1.2.0", "thiserror", ] [[package]] name = "cw-multi-test" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d818f5323c80ed4890db7f89d65eda3f0261fe21878e628c27ea2d8de4b7ba4" +checksum = "579e2c2f2c0877b839c5cad85e67811074e854a50c1ff3085eb8290b1c27809c" dependencies = [ "anyhow", "cosmwasm-std", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", "derivative", "itertools 0.11.0", - "prost 0.12.1", + "prost 0.12.2", "schemars", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "thiserror", ] @@ -850,8 +859,8 @@ dependencies = [ "cosmwasm-std", "cw-address-like", "cw-ownable-derive", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", "thiserror", ] @@ -885,7 +894,7 @@ dependencies = [ "cosmwasm-std", "cosmwasm-storage", "cw-multi-test", - "cw-storage-plus 1.1.0", + "cw-storage-plus 1.2.0", "serde", ] @@ -898,12 +907,12 @@ dependencies = [ "cw-denom", "cw-multi-test", "cw-ownable", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", "cw-vesting", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", "thiserror", "wynd-utils", ] @@ -977,9 +986,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", @@ -993,11 +1002,11 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-multi-test", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", "thiserror", ] @@ -1010,8 +1019,8 @@ dependencies = [ "cosmwasm-storage", "cw-multi-test", "cw-ownable", - "cw-storage-plus 1.1.0", - "cw2 1.1.0", + "cw-storage-plus 1.2.0", + "cw2 1.1.1", "osmosis-std", "osmosis-test-tube", "prost 0.11.9", @@ -1063,13 +1072,13 @@ dependencies = [ [[package]] name = "cw-utils" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c80e93d1deccb8588db03945016a292c3c631e6325d349ebb35d2db6f4f946f7" +checksum = "1b9f351a4e4d81ef7c890e44d903f8c0bdcdc00f094fd3a181eaf70c0eec7a3a" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw2 1.1.0", + "cw2 1.1.1", "schemars", "semver", "serde", @@ -1088,12 +1097,12 @@ dependencies = [ "cw-ownable", "cw-paginate-storage 2.3.0", "cw-stake-tracker", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", "cw-wormhole", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", "dao-testing", "serde", "thiserror", @@ -1106,7 +1115,7 @@ version = "2.3.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-storage-plus 1.1.0", + "cw-storage-plus 1.2.0", "serde", ] @@ -1149,13 +1158,13 @@ dependencies = [ [[package]] name = "cw2" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29ac2dc7a55ad64173ca1e0a46697c31b7a5c51342f55a1e84a724da4eb99908" +checksum = "9431d14f64f49e41c6ef5561ed11a5391c417d0cb16455dea8cdcb9037a8d197" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-storage-plus 1.1.0", + "cw-storage-plus 1.2.0", "schemars", "serde", "thiserror", @@ -1187,13 +1196,13 @@ dependencies = [ [[package]] name = "cw20" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "011c45920f8200bd5d32d4fe52502506f64f2f75651ab408054d4cfc75ca3a9b" +checksum = "786e9da5e937f473cecd2463e81384c1af65d0f6398bbd851be7655487c55492" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "schemars", "serde", ] @@ -1232,16 +1241,16 @@ dependencies = [ [[package]] name = "cw20-base" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b3ad456059901a36cfa68b596d85d579c3df2b797dae9950dc34c27e14e995f" +checksum = "09558f87fd3d5e4a479761051b3f98ee2fa723d9e484b5679b6058ad0eadf8f1" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20 1.1.1", "schemars", "semver", "serde", @@ -1275,17 +1284,17 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cosmwasm-storage", - "cw-controllers 1.1.0", + "cw-controllers 1.1.1", "cw-hooks", "cw-multi-test", "cw-ownable", "cw-paginate-storage 2.3.0", - "cw-storage-plus 1.1.0", + "cw-storage-plus 1.2.0", "cw-utils 0.13.4", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", "cw20-stake 0.2.6", "dao-hooks", "dao-voting 2.3.0", @@ -1300,15 +1309,15 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cosmwasm-storage", - "cw-controllers 1.1.0", + "cw-controllers 1.1.1", "cw-multi-test", "cw-ownable", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 0.13.4", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw20 1.1.1", + "cw20-base 1.1.1", "cw20-stake 2.3.0", "dao-hooks", "stake-cw20-external-rewards", @@ -1323,11 +1332,11 @@ dependencies = [ "cosmwasm-std", "cw-multi-test", "cw-ownable", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", "cw20-stake 2.3.0", "stake-cw20-reward-distributor", "thiserror", @@ -1368,14 +1377,14 @@ dependencies = [ [[package]] name = "cw3" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "171af3d9127de6805a7dd819fb070c7d2f6c3ea85f4193f42cef259f0a7f33d5" +checksum = "1d056ec33ec146554aa1d16c9535763341db75589a47743c006c377e62b54034" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-utils 1.0.1", - "cw20 1.1.0", + "cw-utils 1.0.2", + "cw20 1.1.1", "schemars", "serde", "thiserror", @@ -1395,13 +1404,13 @@ dependencies = [ [[package]] name = "cw4" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a398696307efadaaa2d0850076f865fa706c959d493cb4203314f72be6b77a64" +checksum = "4d9fce5c21c0623762a78c658a01cd5053dc98705b71453685359554b423d8a6" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-storage-plus 1.1.0", + "cw-storage-plus 1.2.0", "schemars", "serde", ] @@ -1425,17 +1434,17 @@ dependencies = [ [[package]] name = "cw4-group" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58db332c4039bec8ade6aaa1f5fff24b94b111f21134db172cd27fb2e7f0ceb6" +checksum = "ad498a23264ee2f24e7e15b56295b23a82e7167e6fbf2564d8c818f6e75ae9e7" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-controllers 1.1.0", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw4 1.1.0", + "cw-controllers 1.1.1", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw4 1.1.1", "schemars", "serde", "thiserror", @@ -1493,7 +1502,7 @@ checksum = "e3c4d286625ccadc957fe480dd3bdc54ada19e0e6b5b9325379db3130569e914" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "schemars", "serde", ] @@ -1524,9 +1533,9 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-ownable", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw721 0.18.0", "cw721-base 0.16.0", "schemars", @@ -1540,8 +1549,8 @@ version = "2.3.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", "thiserror", ] @@ -1551,13 +1560,13 @@ version = "2.3.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-controllers 1.1.0", + "cw-controllers 1.1.1", "cw-multi-test", "cw-ownable", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw4 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw4 1.1.1", "cw721 0.18.0", "cw721-base 0.18.0", "dao-cw721-extensions", @@ -1573,8 +1582,8 @@ version = "2.3.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-controllers 1.1.0", - "cw4 1.1.0", + "cw-controllers 1.1.1", + "cw4 1.1.1", ] [[package]] @@ -1586,11 +1595,11 @@ dependencies = [ "cw-core", "cw-multi-test", "cw-paginate-storage 2.3.0", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", "cw721 0.18.0", "cw721-base 0.18.0", "dao-dao-macros", @@ -1621,7 +1630,7 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-hooks", - "cw4 1.1.0", + "cw4 1.1.1", "dao-voting 2.3.0", ] @@ -1632,9 +1641,9 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-hooks", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20 1.1.1", "cw721 0.18.0", "osmosis-std", ] @@ -1650,13 +1659,13 @@ dependencies = [ "cw-core-interface 0.1.0 (git+https://github.com/DA0-DA0/dao-contracts.git?tag=v1.0.0)", "cw-multi-test", "cw-proposal-single", - "cw-storage-plus 1.1.0", + "cw-storage-plus 1.2.0", "cw-utils 0.13.4", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 0.13.4", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw20 1.1.1", + "cw20-base 1.1.1", "cw20-stake 0.2.6", "cw20-stake 2.3.0", "cw20-staked-balance-voting", @@ -1682,12 +1691,12 @@ dependencies = [ "cw-denom", "cw-multi-test", "cw-paginate-storage 2.3.0", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", - "cw4-group 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", + "cw4-group 1.1.1", "dao-dao-core", "dao-hooks", "dao-interface", @@ -1708,12 +1717,12 @@ dependencies = [ "cosmwasm-std", "cw-denom", "cw-multi-test", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", - "cw4-group 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", + "cw4-group 1.1.1", "dao-dao-core", "dao-hooks", "dao-interface", @@ -1735,9 +1744,9 @@ dependencies = [ "cw-denom", "cw-hooks", "cw-multi-test", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "dao-hooks", "dao-interface", "dao-voting 2.3.0", @@ -1753,11 +1762,11 @@ dependencies = [ "cosmwasm-std", "cw-denom", "cw-multi-test", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", - "cw4-group 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", + "cw4-group 1.1.1", "dao-dao-core", "dao-hooks", "dao-interface", @@ -1778,11 +1787,11 @@ dependencies = [ "cw-denom", "cw-hooks", "cw-multi-test", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", - "cw4-group 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", + "cw4-group 1.1.1", "dao-dao-core", "dao-hooks", "dao-interface", @@ -1802,11 +1811,11 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-multi-test", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw4 1.1.0", - "cw4-group 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw4 1.1.1", + "cw4-group 1.1.1", "dao-dao-core", "dao-dao-macros", "dao-interface", @@ -1824,11 +1833,11 @@ dependencies = [ "cosmwasm-std", "cw-hooks", "cw-multi-test", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", "dao-dao-core", "dao-hooks", "dao-interface", @@ -1848,15 +1857,15 @@ dependencies = [ "cw-denom", "cw-hooks", "cw-multi-test", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", "cw20-stake 2.3.0", - "cw3 1.1.0", - "cw4 1.1.0", - "cw4-group 1.1.0", + "cw3 1.1.1", + "cw4 1.1.1", + "cw4-group 1.1.1", "cw721-base 0.18.0", "dao-dao-macros", "dao-hooks", @@ -1887,16 +1896,16 @@ dependencies = [ "cw-hooks", "cw-multi-test", "cw-proposal-single", - "cw-storage-plus 1.1.0", + "cw-storage-plus 1.2.0", "cw-utils 0.13.4", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", "cw20-stake 2.3.0", - "cw3 1.1.0", - "cw4 1.1.0", - "cw4-group 1.1.0", + "cw3 1.1.1", + "cw4 1.1.1", + "cw4-group 1.1.1", "cw721-base 0.18.0", "dao-dao-core", "dao-dao-macros", @@ -1923,8 +1932,8 @@ dependencies = [ "cosmwasm-std", "cosmwasm-storage", "cw-multi-test", - "cw-storage-plus 1.1.0", - "cw2 1.1.0", + "cw-storage-plus 1.2.0", + "cw2 1.1.1", "dao-dao-macros", "dao-interface", "thiserror", @@ -1939,10 +1948,10 @@ dependencies = [ "cosmwasm-storage", "cw-multi-test", "cw-ownable", - "cw-storage-plus 1.1.0", + "cw-storage-plus 1.2.0", "cw-tokenfactory-issuer", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw721 0.18.0", "cw721-base 0.18.0", "dao-dao-macros", @@ -1962,14 +1971,14 @@ dependencies = [ "cw-multi-test", "cw-proposal-single", "cw-tokenfactory-issuer", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "cw-vesting", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", "cw20-stake 2.3.0", - "cw4 1.1.0", - "cw4-group 1.1.0", + "cw4 1.1.1", + "cw4-group 1.1.1", "cw721-base 0.18.0", "cw721-roles", "dao-dao-core", @@ -2015,9 +2024,9 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-denom", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw20 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw20 1.1.1", "dao-dao-macros", "dao-interface", "thiserror", @@ -2030,11 +2039,11 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-multi-test", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", "dao-dao-macros", "dao-interface", "thiserror", @@ -2048,11 +2057,11 @@ dependencies = [ "cosmwasm-std", "cosmwasm-storage", "cw-multi-test", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw20 1.1.1", + "cw20-base 1.1.1", "cw20-stake 2.3.0", "dao-dao-macros", "dao-interface", @@ -2068,11 +2077,11 @@ dependencies = [ "cosmwasm-std", "cosmwasm-storage", "cw-multi-test", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw4 1.1.0", - "cw4-group 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw4 1.1.1", + "cw4-group 1.1.1", "dao-dao-macros", "dao-interface", "thiserror", @@ -2088,10 +2097,10 @@ dependencies = [ "cw-multi-test", "cw-ownable", "cw-paginate-storage 2.3.0", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", - "cw4 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", + "cw4 1.1.1", "cw721 0.18.0", "cw721-base 0.18.0", "cw721-controllers", @@ -2110,13 +2119,13 @@ dependencies = [ "anyhow", "cosmwasm-schema", "cosmwasm-std", - "cw-controllers 1.1.0", + "cw-controllers 1.1.1", "cw-hooks", "cw-multi-test", "cw-paginate-storage 2.3.0", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw721 0.18.0", "cw721-base 0.18.0", "cw721-controllers", @@ -2142,15 +2151,15 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cosmwasm-storage", - "cw-controllers 1.1.0", + "cw-controllers 1.1.1", "cw-hooks", "cw-multi-test", "cw-ownable", "cw-paginate-storage 2.3.0", - "cw-storage-plus 1.1.0", + "cw-storage-plus 1.2.0", "cw-tokenfactory-issuer", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "dao-dao-macros", "dao-hooks", "dao-interface", @@ -2225,9 +2234,9 @@ checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" [[package]] name = "dyn-clone" -version = "1.0.13" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbfc4744c1b8f2a09adc0e55242f60b1af195d88596bd8700be74418c056c555" +checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" [[package]] name = "ecdsa" @@ -2243,15 +2252,15 @@ dependencies = [ [[package]] name = "ecdsa" -version = "0.16.8" +version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der 0.7.8", "digest 0.10.7", - "elliptic-curve 0.13.5", + "elliptic-curve 0.13.8", "rfc6979 0.4.0", - "signature 2.1.0", + "signature 2.2.0", "spki 0.7.2", ] @@ -2319,12 +2328,12 @@ dependencies = [ [[package]] name = "elliptic-curve" -version = "0.13.5" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct 0.2.0", - "crypto-bigint 0.5.3", + "crypto-bigint 0.5.5", "digest 0.10.7", "ff 0.13.0", "generic-array", @@ -2338,9 +2347,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" dependencies = [ "humantime", "is-terminal", @@ -2366,30 +2375,19 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.3" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" dependencies = [ - "errno-dragonfly", "libc", "windows-sys", ] -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "eyre" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" +checksum = "80f656be11ddf91bd709454d15d5bd896fbaf4cc3314e69349e4d1569f5b46cd" dependencies = [ "indenter", "once_cell", @@ -2448,9 +2446,9 @@ checksum = "c8cbd1169bd7b4a0a20d92b9af7a7e0422888bd38a6f5ec29c1fd8c1558a272e" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -2463,9 +2461,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -2473,15 +2471,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -2490,38 +2488,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.34", + "syn 2.0.39", ] [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-channel", "futures-core", @@ -2548,9 +2546,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "js-sys", @@ -2595,9 +2593,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" dependencies = [ "bytes", "fnv", @@ -2605,7 +2603,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 1.9.3", + "indexmap 2.1.0", "slab", "tokio", "tokio-util", @@ -2623,9 +2621,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" [[package]] name = "headers" @@ -2653,9 +2651,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -2683,9 +2681,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes", "fnv", @@ -2738,7 +2736,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.9", + "socket2 0.4.10", "tokio", "tower-service", "tracing", @@ -2835,12 +2833,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.2", ] [[package]] @@ -2853,10 +2851,10 @@ dependencies = [ "cosm-tome", "cosmos-sdk-proto 0.19.0", "cosmwasm-std", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "cw-vesting", - "cw20 1.1.0", - "cw20-base 1.1.0", + "cw20 1.1.1", + "cw20-base 1.1.1", "cw20-stake 2.3.0", "cw721 0.18.0", "cw721-base 0.18.0", @@ -2914,9 +2912,9 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" dependencies = [ "wasm-bindgen", ] @@ -2941,22 +2939,22 @@ dependencies = [ "cfg-if", "ecdsa 0.14.8", "elliptic-curve 0.12.3", - "sha2 0.10.7", + "sha2 0.10.8", "sha3", ] [[package]] name = "k256" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" +checksum = "3f01b677d82ef7a676aa37e099defd83a28e15687112cafdd112d60236b6115b" dependencies = [ "cfg-if", - "ecdsa 0.16.8", - "elliptic-curve 0.13.5", + "ecdsa 0.16.9", + "elliptic-curve 0.13.8", "once_cell", - "sha2 0.10.7", - "signature 2.1.0", + "sha2 0.10.8", + "signature 2.2.0", ] [[package]] @@ -2982,9 +2980,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.148" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libloading" @@ -3004,9 +3002,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.4.7" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" +checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" [[package]] name = "log" @@ -3016,15 +3014,15 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "matchit" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed1202b2a6f884ae56f04cff409ab315c5ce26b5e58d7412e484f01fd52f52ef" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "memchr" -version = "2.6.3" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "mime" @@ -3049,9 +3047,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "wasi", @@ -3081,9 +3079,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] @@ -3175,9 +3173,9 @@ dependencies = [ [[package]] name = "osmosis-test-tube" -version = "20.1.1" +version = "20.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea66b0b24c413a09ea9881145b0559edf31993c42d3c5b91f03087c289fe40b9" +checksum = "2c1534a419d9e2c27b0b4869e68496b92abca93464b82efbdd1f1b43467f2938" dependencies = [ "base64 0.21.5", "bindgen", @@ -3253,9 +3251,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.3" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a4d085fd991ac8d5b05a147b437791b4260b76326baf0fc60cf7c9c27ecd33" +checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" dependencies = [ "memchr", "thiserror", @@ -3264,9 +3262,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.3" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bee7be22ce7918f641a33f08e3f43388c7656772244e2bbb2477f44cc9021a" +checksum = "81d78524685f5ef2a3b3bd1cafbc9fcabb036253d9b1463e726a91cd16e2dfc2" dependencies = [ "pest", "pest_generator", @@ -3274,26 +3272,26 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.3" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1511785c5e98d79a05e8a6bc34b4ac2168a0e3e92161862030ad84daa223141" +checksum = "68bd1206e71118b5356dae5ddc61c8b11e28b09ef6a31acbd15ea48a28e0c227" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.34", + "syn 2.0.39", ] [[package]] name = "pest_meta" -version = "2.7.3" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42f0394d3123e33353ca5e1e89092e533d2cc490389f2bd6131c43c634ebc5f" +checksum = "7c747191d4ad9e4a4ab9c8798f1e82a39affe7ef9648390b7e5548d18e099de6" dependencies = [ "once_cell", "pest", - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] @@ -3313,7 +3311,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.34", + "syn 2.0.39", ] [[package]] @@ -3361,14 +3359,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", - "syn 2.0.34", + "syn 2.0.39", ] [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -3397,12 +3395,12 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fdd22f3b9c31b53c060df4a0613a1c7f062d4115a2b984dd15b1858f7e340d" +checksum = "5a5a410fc7882af66deb8d01d01737353cf3ad6204c408177ba494291a626312" dependencies = [ "bytes", - "prost-derive 0.12.1", + "prost-derive 0.12.2", ] [[package]] @@ -3420,15 +3418,15 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32" +checksum = "065717a5dfaca4a83d2fe57db3487b311365200000551d7a364e715dbf4346bc" dependencies = [ "anyhow", "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.34", + "syn 2.0.39", ] [[package]] @@ -3487,9 +3485,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.5" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", @@ -3499,9 +3497,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.8" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", @@ -3510,9 +3508,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "rfc6979" @@ -3605,11 +3603,11 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.38.13" +version = "0.38.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662" +checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", @@ -3673,9 +3671,9 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.13" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763f8cd0d4c71ed8389c90cb8100cba87e763bd01a8e614d4f0af97bcd50a161" +checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29" dependencies = [ "dyn-clone", "schemars_derive", @@ -3685,9 +3683,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.13" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0f696e21e10fa546b7ffb1c9672c6de8fbc7a81acf59524386d8639bf12737" +checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967" dependencies = [ "proc-macro2", "quote", @@ -3758,15 +3756,15 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] @@ -3800,13 +3798,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.34", + "syn 2.0.39", ] [[package]] @@ -3822,9 +3820,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -3833,22 +3831,22 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" +checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" dependencies = [ "proc-macro2", "quote", - "syn 2.0.34", + "syn 2.0.39", ] [[package]] name = "serde_yaml" -version = "0.9.25" +version = "0.9.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574" +checksum = "3cc7a1570e38322cfe4154732e5110f887ea57e22b76f4bfd32b5bdd3368666c" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.1.0", "itoa", "ryu", "serde", @@ -3857,9 +3855,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -3881,9 +3879,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -3918,9 +3916,9 @@ dependencies = [ [[package]] name = "signature" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest 0.10.7", "rand_core 0.6.4", @@ -3937,9 +3935,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", @@ -3947,9 +3945,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys", @@ -4039,6 +4037,12 @@ dependencies = [ "thiserror", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "subtle" version = "2.5.0" @@ -4067,9 +4071,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.34" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ec6cdb6a4c16306eccf52ccd8d492e4ab64705a15a5016acb205251001bf72" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -4295,9 +4299,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.2.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" dependencies = [ "winapi-util", ] @@ -4341,22 +4345,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.48" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.48" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.34", + "syn 2.0.39", ] [[package]] @@ -4405,9 +4409,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.32.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes", @@ -4415,7 +4419,7 @@ dependencies = [ "mio", "num_cpus", "pin-project-lite", - "socket2 0.5.4", + "socket2 0.5.5", "tokio-macros", "windows-sys", ] @@ -4432,13 +4436,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.34", + "syn 2.0.39", ] [[package]] @@ -4465,9 +4469,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", @@ -4580,11 +4584,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4592,20 +4595,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.34", + "syn 2.0.39", ] [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", ] @@ -4733,9 +4736,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4743,24 +4746,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.34", + "syn 2.0.39", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4768,28 +4771,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", - "syn 2.0.34", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" dependencies = [ "js-sys", "wasm-bindgen", @@ -4844,9 +4847,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -4946,9 +4949,9 @@ dependencies = [ [[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" dependencies = [ "zeroize_derive", ] @@ -4961,5 +4964,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.34", + "syn 2.0.39", ] diff --git a/Cargo.toml b/Cargo.toml index f74a52980..f711aa48f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,16 +1,16 @@ [workspace] +exclude = ["ci/configs/", "wasmvm/libwasmvm"] members = [ - "contracts/dao-dao-core", - "contracts/external/*", - "contracts/proposal/*", - "contracts/pre-propose/*", - "contracts/staking/*", - "contracts/test/*", - "contracts/voting/*", - "packages/*", - "ci/*", + "contracts/dao-dao-core", + "contracts/external/*", + "contracts/proposal/*", + "contracts/pre-propose/*", + "contracts/staking/*", + "contracts/test/*", + "contracts/voting/*", + "packages/*", + "ci/*", ] -exclude = ["ci/configs/", "wasmvm/libwasmvm"] [workspace.package] edition = "2021" @@ -20,29 +20,29 @@ version = "2.3.0" [profile.release] codegen-units = 1 -opt-level = 3 debug = false -rpath = false -lto = true debug-assertions = false -panic = 'abort' incremental = false +lto = true +opt-level = 3 +panic = 'abort' +rpath = false # Please do not disable these. Doing so will cause overflow checks in # all workspace members to stop working. Overflows should be errors. overflow-checks = true [workspace.dependencies] -anyhow = { version = "1.0" } +anyhow = {version = "1.0"} assert_matches = "1.5" -cosm-orc = { version = "4.0" } +cosm-orc = {version = "4.0"} cosm-tome = "0.2" cosmos-sdk-proto = "0.19" -cosmwasm-schema = { version = "1.2" } -cosmwasm-std = { version = "1.2", features = ["ibc3"] } -cosmwasm-storage = { version = "1.2" } +cosmwasm-schema = {version = "1.2"} +cosmwasm-std = {version = "1.5.0", features = ["ibc3"]} +cosmwasm-storage = {version = "1.2"} cw-controllers = "1.1" -cw-multi-test = "0.17" -cw-storage-plus = { version = "1.1" } +cw-multi-test = "0.18" +cw-storage-plus = {version = "1.1"} cw-utils = "1.0" cw2 = "1.1" cw20 = "1.1" @@ -61,16 +61,16 @@ prost = "0.11" quote = "1.0" rand = "0.8" schemars = "0.8" -serde = { version = "1.0", default-features = false, features = ["derive"] } +serde = {version = "1.0", default-features = false, features = ["derive"]} serde_json = "1.0" serde_yaml = "0.9" +sg-multi-test = "3.1.0" sg-std = "3.1.0" sg721 = "3.1.0" sg721-base = "3.1.0" -sg-multi-test = "3.1.0" -syn = { version = "1.0", features = ["derive"] } +syn = {version = "1.0", features = ["derive"]} test-context = "0.1" -thiserror = { version = "1.0" } +thiserror = {version = "1.0"} token-bindings = "0.11.0" wynd-utils = "0.4" @@ -78,51 +78,51 @@ wynd-utils = "0.4" # optional owner. cw-ownable = "0.5" -cw-admin-factory = { path = "./contracts/external/cw-admin-factory", version = "2.3.0" } -cw-denom = { path = "./packages/cw-denom", version = "2.3.0" } -cw-hooks = { path = "./packages/cw-hooks", version = "2.3.0" } -cw-wormhole = { path = "./packages/cw-wormhole", version = "2.3.0" } -cw-paginate-storage = { path = "./packages/cw-paginate-storage", version = "2.3.0" } -cw-payroll-factory = { path = "./contracts/external/cw-payroll-factory", version = "2.3.0" } -cw-tokenfactory-issuer = { path = "./contracts/external/cw-tokenfactory-issuer", version = "2.3.0" } -cw-vesting = { path = "./contracts/external/cw-vesting", version = "2.3.0" } -cw20-stake = { path = "./contracts/staking/cw20-stake", version = "2.3.0" } -cw-stake-tracker = { path = "./packages/cw-stake-tracker", version = "2.3.0" } -cw721-controllers = { path = "./packages/cw721-controllers", version = "2.3.0" } -cw721-roles = { path = "./contracts/external/cw721-roles", version = "2.3.0" } -dao-cw721-extensions = { path = "./packages/dao-cw721-extensions", version = "2.3.0" } -dao-dao-core = { path = "./contracts/dao-dao-core", version = "2.3.0" } -dao-dao-macros = { path = "./packages/dao-dao-macros", version = "2.3.0" } -dao-hooks = { path = "./packages/dao-hooks", version = "2.3.0" } -dao-interface = { path = "./packages/dao-interface", version = "2.3.0" } -dao-pre-propose-approval-single = { path = "./contracts/pre-propose/dao-pre-propose-approval-single", version = "2.3.0" } -dao-pre-propose-approver = { path = "./contracts/pre-propose/dao-pre-propose-approver", version = "2.3.0" } -dao-pre-propose-base = { path = "./packages/dao-pre-propose-base", version = "2.3.0" } -dao-pre-propose-multiple = { path = "./contracts/pre-propose/dao-pre-propose-multiple", version = "2.3.0" } -dao-pre-propose-single = { path = "./contracts/pre-propose/dao-pre-propose-single", version = "2.3.0" } -dao-proposal-condorcet = { path = "./contracts/proposal/dao-proposal-condorcet", version = "2.3.0" } -dao-proposal-multiple = { path = "./contracts/proposal/dao-proposal-multiple", version = "2.3.0" } -dao-proposal-single = { path = "./contracts/proposal/dao-proposal-single", version = "2.3.0" } -dao-proposal-sudo = { path = "./contracts/test/dao-proposal-sudo", version = "2.3.0" } -dao-proposal-hook-counter = { path = "./contracts/test/dao-proposal-hook-counter", version = "2.3.0" } -dao-test-custom-factory = { path = "./contracts/test/dao-test-custom-factory", version = "2.3.0" } -dao-testing = { path = "./packages/dao-testing", version = "2.3.0" } -dao-voting = { path = "./packages/dao-voting", version = "2.3.0" } -dao-voting-cw20-balance = { path = "./contracts/test/dao-voting-cw20-balance", version = "2.3.0" } -dao-voting-cw20-staked = { path = "./contracts/voting/dao-voting-cw20-staked", version = "2.3.0" } -dao-voting-cw4 = { path = "./contracts/voting/dao-voting-cw4", version = "2.3.0" } -dao-voting-cw721-roles = { path = "./contracts/voting/dao-voting-cw721-roles", version = "2.3.0" } -dao-voting-cw721-staked = { path = "./contracts/voting/dao-voting-cw721-staked", version = "2.3.0" } -dao-voting-token-staked = { path = "./contracts/voting/dao-voting-token-staked", version = "2.3.0" } +cw-admin-factory = {path = "./contracts/external/cw-admin-factory", version = "2.3.0"} +cw-denom = {path = "./packages/cw-denom", version = "2.3.0"} +cw-hooks = {path = "./packages/cw-hooks", version = "2.3.0"} +cw-paginate-storage = {path = "./packages/cw-paginate-storage", version = "2.3.0"} +cw-payroll-factory = {path = "./contracts/external/cw-payroll-factory", version = "2.3.0"} +cw-stake-tracker = {path = "./packages/cw-stake-tracker", version = "2.3.0"} +cw-tokenfactory-issuer = {path = "./contracts/external/cw-tokenfactory-issuer", version = "2.3.0"} +cw-vesting = {path = "./contracts/external/cw-vesting", version = "2.3.0"} +cw-wormhole = {path = "./packages/cw-wormhole", version = "2.3.0"} +cw20-stake = {path = "./contracts/staking/cw20-stake", version = "2.3.0"} +cw721-controllers = {path = "./packages/cw721-controllers", version = "2.3.0"} +cw721-roles = {path = "./contracts/external/cw721-roles", version = "2.3.0"} +dao-cw721-extensions = {path = "./packages/dao-cw721-extensions", version = "2.3.0"} +dao-dao-core = {path = "./contracts/dao-dao-core", version = "2.3.0"} +dao-dao-macros = {path = "./packages/dao-dao-macros", version = "2.3.0"} +dao-hooks = {path = "./packages/dao-hooks", version = "2.3.0"} +dao-interface = {path = "./packages/dao-interface", version = "2.3.0"} +dao-pre-propose-approval-single = {path = "./contracts/pre-propose/dao-pre-propose-approval-single", version = "2.3.0"} +dao-pre-propose-approver = {path = "./contracts/pre-propose/dao-pre-propose-approver", version = "2.3.0"} +dao-pre-propose-base = {path = "./packages/dao-pre-propose-base", version = "2.3.0"} +dao-pre-propose-multiple = {path = "./contracts/pre-propose/dao-pre-propose-multiple", version = "2.3.0"} +dao-pre-propose-single = {path = "./contracts/pre-propose/dao-pre-propose-single", version = "2.3.0"} +dao-proposal-condorcet = {path = "./contracts/proposal/dao-proposal-condorcet", version = "2.3.0"} +dao-proposal-hook-counter = {path = "./contracts/test/dao-proposal-hook-counter", version = "2.3.0"} +dao-proposal-multiple = {path = "./contracts/proposal/dao-proposal-multiple", version = "2.3.0"} +dao-proposal-single = {path = "./contracts/proposal/dao-proposal-single", version = "2.3.0"} +dao-proposal-sudo = {path = "./contracts/test/dao-proposal-sudo", version = "2.3.0"} +dao-test-custom-factory = {path = "./contracts/test/dao-test-custom-factory", version = "2.3.0"} +dao-testing = {path = "./packages/dao-testing", version = "2.3.0"} +dao-voting = {path = "./packages/dao-voting", version = "2.3.0"} +dao-voting-cw20-balance = {path = "./contracts/test/dao-voting-cw20-balance", version = "2.3.0"} +dao-voting-cw20-staked = {path = "./contracts/voting/dao-voting-cw20-staked", version = "2.3.0"} +dao-voting-cw4 = {path = "./contracts/voting/dao-voting-cw4", version = "2.3.0"} +dao-voting-cw721-roles = {path = "./contracts/voting/dao-voting-cw721-roles", version = "2.3.0"} +dao-voting-cw721-staked = {path = "./contracts/voting/dao-voting-cw721-staked", version = "2.3.0"} +dao-voting-token-staked = {path = "./contracts/voting/dao-voting-token-staked", version = "2.3.0"} # v1 dependencies. used for state migrations. -cw-core-v1 = { package = "cw-core", version = "0.1.0" } -cw-proposal-single-v1 = { package = "cw-proposal-single", version = "0.1.0" } -cw-utils-v1 = { package = "cw-utils", version = "0.13" } -cw20-stake-external-rewards-v1 = { package = "stake-cw20-external-rewards", version = "0.2.6" } -cw20-stake-reward-distributor-v1 = { package = "stake-cw20-reward-distributor", version = "0.1.0" } -cw20-stake-v1 = { package = "cw20-stake", version = "0.2.6" } -cw20-staked-balance-voting-v1 = { package = "cw20-staked-balance-voting", version = "0.1.0" } -cw4-voting-v1 = { package = "cw4-voting", version = "0.1.0" } -voting-v1 = { package = "dao-voting", version = "0.1.0" } -stake-cw20-v03 = { package = "stake-cw20", version = "0.2.6" } +cw-core-v1 = {package = "cw-core", version = "0.1.0"} +cw-proposal-single-v1 = {package = "cw-proposal-single", version = "0.1.0"} +cw-utils-v1 = {package = "cw-utils", version = "0.13"} +cw20-stake-external-rewards-v1 = {package = "stake-cw20-external-rewards", version = "0.2.6"} +cw20-stake-reward-distributor-v1 = {package = "stake-cw20-reward-distributor", version = "0.1.0"} +cw20-stake-v1 = {package = "cw20-stake", version = "0.2.6"} +cw20-staked-balance-voting-v1 = {package = "cw20-staked-balance-voting", version = "0.1.0"} +cw4-voting-v1 = {package = "cw4-voting", version = "0.1.0"} +stake-cw20-v03 = {package = "stake-cw20", version = "0.2.6"} +voting-v1 = {package = "dao-voting", version = "0.1.0"} diff --git a/ci/bootstrap-env/src/main.rs b/ci/bootstrap-env/src/main.rs index 85fd119a5..d8117c8f5 100644 --- a/ci/bootstrap-env/src/main.rs +++ b/ci/bootstrap-env/src/main.rs @@ -1,7 +1,7 @@ use anyhow::Result; use cosm_orc::orchestrator::{Coin, Key, SigningKey}; use cosm_orc::{config::cfg::Config, orchestrator::cosm_orc::CosmOrc}; -use cosmwasm_std::{to_binary, Decimal, Empty, Uint128}; +use cosmwasm_std::{to_json_binary, Decimal, Empty, Uint128}; use cw20::Cw20Coin; use dao_interface::state::{Admin, ModuleInstantiateInfo}; use dao_voting::{ @@ -55,7 +55,7 @@ fn main() -> Result<()> { automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: orc.contract_map.code_id("dao_voting_cw20_staked")?, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: orc.contract_map.code_id("cw20_base")?, label: "DAO DAO Gov token".to_string(), @@ -79,7 +79,7 @@ fn main() -> Result<()> { }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: orc.contract_map.code_id("dao_proposal_single")?, - msg: to_binary(&dao_proposal_single::msg::InstantiateMsg { + msg: to_json_binary(&dao_proposal_single::msg::InstantiateMsg { min_voting_period: None, threshold: Threshold::ThresholdQuorum { threshold: PercentageThreshold::Majority {}, @@ -91,7 +91,7 @@ fn main() -> Result<()> { pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: orc.contract_map.code_id("dao_pre_propose_single")?, - msg: to_binary(&dao_pre_propose_single::InstantiateMsg { + msg: to_json_binary(&dao_pre_propose_single::InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: DepositToken::VotingModuleToken {}, amount: Uint128::new(1000000000), diff --git a/ci/integration-tests/src/helpers/helper.rs b/ci/integration-tests/src/helpers/helper.rs index bcfd0e26d..e4f4678cf 100644 --- a/ci/integration-tests/src/helpers/helper.rs +++ b/ci/integration-tests/src/helpers/helper.rs @@ -1,7 +1,7 @@ use super::chain::Chain; use anyhow::Result; use cosm_orc::orchestrator::SigningKey; -use cosmwasm_std::{to_binary, CosmosMsg, Decimal, Empty, Uint128}; +use cosmwasm_std::{to_json_binary, CosmosMsg, Decimal, Empty, Uint128}; use cw20::Cw20Coin; use cw_utils::Duration; use dao_interface::query::DumpStateResponse; @@ -39,7 +39,7 @@ pub fn create_dao( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: chain.orc.contract_map.code_id("dao_voting_cw20_staked")?, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: chain.orc.contract_map.code_id("cw20_base")?, label: "DAO DAO Gov token".to_string(), @@ -63,7 +63,7 @@ pub fn create_dao( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: chain.orc.contract_map.code_id("dao_proposal_single")?, - msg: to_binary(&dao_proposal_single::msg::InstantiateMsg { + msg: to_json_binary(&dao_proposal_single::msg::InstantiateMsg { min_voting_period: None, threshold: Threshold::ThresholdQuorum { threshold: PercentageThreshold::Majority {}, @@ -76,7 +76,7 @@ pub fn create_dao( pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: chain.orc.contract_map.code_id("dao_pre_propose_single")?, - msg: to_binary(&dao_pre_propose_single::InstantiateMsg { + msg: to_json_binary(&dao_pre_propose_single::InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: DepositToken::VotingModuleToken {}, amount: DEPOSIT_AMOUNT, @@ -187,7 +187,7 @@ pub fn stake_tokens(chain: &mut Chain, how_many: u128, key: &SigningKey) { &cw20::Cw20ExecuteMsg::Send { contract: chain.orc.contract_map.address("cw20_stake").unwrap(), amount: Uint128::new(how_many), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, key, vec![], diff --git a/ci/integration-tests/src/tests/cw20_stake_test.rs b/ci/integration-tests/src/tests/cw20_stake_test.rs index 13cb0d226..4250441d5 100644 --- a/ci/integration-tests/src/tests/cw20_stake_test.rs +++ b/ci/integration-tests/src/tests/cw20_stake_test.rs @@ -1,5 +1,5 @@ use crate::helpers::{chain::Chain, helper::create_dao}; -use cosmwasm_std::{to_binary, Uint128}; +use cosmwasm_std::{to_json_binary, Uint128}; use cw20_stake::{msg::StakedValueResponse, state::Config}; use dao_interface::voting::VotingPowerAtHeightResponse; use std::time::Duration; @@ -79,7 +79,7 @@ fn execute_stake_tokens(chain: &mut Chain) { &cw20_base::msg::ExecuteMsg::Send { contract: staking_addr, amount: Uint128::new(100), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &user_key, vec![], diff --git a/ci/integration-tests/src/tests/cw_core_test.rs b/ci/integration-tests/src/tests/cw_core_test.rs index 348ac3925..904003d4e 100644 --- a/ci/integration-tests/src/tests/cw_core_test.rs +++ b/ci/integration-tests/src/tests/cw_core_test.rs @@ -3,7 +3,7 @@ use crate::helpers::helper::create_dao; use assert_matches::assert_matches; use cosm_orc::orchestrator::error::CosmwasmError::TxError; use cosm_orc::orchestrator::error::ProcessError; -use cosmwasm_std::{to_binary, Addr, CosmosMsg, Decimal, Uint128}; +use cosmwasm_std::{to_json_binary, Addr, CosmosMsg, Decimal, Uint128}; use cw20_stake::msg::{StakedValueResponse, TotalValueResponse}; use cw_utils::Duration; @@ -40,7 +40,7 @@ fn execute_execute_admin_msgs(chain: &mut Chain) { &dao_interface::msg::ExecuteMsg::ExecuteAdminMsgs { msgs: vec![CosmosMsg::Wasm(cosmwasm_std::WasmMsg::Execute { contract_addr: dao.addr, - msg: to_binary(&dao_interface::msg::ExecuteMsg::Pause { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::Pause { duration: Duration::Time(100), }) .unwrap(), @@ -79,7 +79,7 @@ fn execute_execute_admin_msgs(chain: &mut Chain) { &dao_interface::msg::ExecuteMsg::ExecuteAdminMsgs { msgs: vec![CosmosMsg::Wasm(cosmwasm_std::WasmMsg::Execute { contract_addr: dao.addr, - msg: to_binary(&dao_interface::msg::ExecuteMsg::Pause { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::Pause { duration: Duration::Height(100), }) .unwrap(), @@ -139,7 +139,7 @@ fn execute_items(chain: &mut Chain) { &dao_interface::msg::ExecuteMsg::ExecuteAdminMsgs { msgs: vec![CosmosMsg::Wasm(cosmwasm_std::WasmMsg::Execute { contract_addr: dao.addr.clone(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::SetItem { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::SetItem { key: "meme".to_string(), value: "foobar".to_string(), }) @@ -174,7 +174,7 @@ fn execute_items(chain: &mut Chain) { &dao_interface::msg::ExecuteMsg::ExecuteAdminMsgs { msgs: vec![CosmosMsg::Wasm(cosmwasm_std::WasmMsg::Execute { contract_addr: dao.addr, - msg: to_binary(&dao_interface::msg::ExecuteMsg::RemoveItem { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::RemoveItem { key: "meme".to_string(), }) .unwrap(), diff --git a/ci/integration-tests/src/tests/proposal_gas_test.rs b/ci/integration-tests/src/tests/proposal_gas_test.rs index e6fa015a9..3c19c559a 100644 --- a/ci/integration-tests/src/tests/proposal_gas_test.rs +++ b/ci/integration-tests/src/tests/proposal_gas_test.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, CosmosMsg, Empty, WasmMsg}; +use cosmwasm_std::{to_json_binary, CosmosMsg, Empty, WasmMsg}; use dao_proposal_single::query::ProposalResponse; use dao_voting::voting::Vote; use test_context::test_context; @@ -15,7 +15,7 @@ fn mint_mint_mint_mint(cw721: &str, owner: &str, mints: u64) -> Vec { .map(|mint| { WasmMsg::Execute { contract_addr: cw721.to_string(), - msg: to_binary(&cw721_base::msg::ExecuteMsg::Mint::{ + msg: to_json_binary(&cw721_base::msg::ExecuteMsg::Mint::{ token_id: mint.to_string(), owner: owner.to_string(), token_uri: Some("https://bafkreibufednctf2f2bpduiibgkvpqcw5rtdmhqh2htqx3qbdnji4h55hy.ipfs.nftstorage.link".to_string()), diff --git a/contracts/dao-dao-core/src/contract.rs b/contracts/dao-dao-core/src/contract.rs index 21e38784e..56cd5c526 100644 --- a/contracts/dao-dao-core/src/contract.rs +++ b/contracts/dao-dao-core/src/contract.rs @@ -1,8 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_binary, to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Order, - Reply, Response, StdError, StdResult, SubMsg, WasmMsg, + from_json, to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, + Order, Reply, Response, StdError, StdResult, SubMsg, WasmMsg, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; use cw_paginate_storage::{paginate_map, paginate_map_keys, paginate_map_values}; @@ -579,22 +579,22 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { pub fn query_admin(deps: Deps) -> StdResult { let admin = ADMIN.load(deps.storage)?; - to_binary(&admin) + to_json_binary(&admin) } pub fn query_admin_nomination(deps: Deps) -> StdResult { let nomination = NOMINATED_ADMIN.may_load(deps.storage)?; - to_binary(&AdminNominationResponse { nomination }) + to_json_binary(&AdminNominationResponse { nomination }) } pub fn query_config(deps: Deps) -> StdResult { let config = CONFIG.load(deps.storage)?; - to_binary(&config) + to_json_binary(&config) } pub fn query_voting_module(deps: Deps) -> StdResult { let voting_module = VOTING_MODULE.load(deps.storage)?; - to_binary(&voting_module) + to_json_binary(&voting_module) } pub fn query_proposal_modules( @@ -615,7 +615,7 @@ pub fn query_proposal_modules( // // Even if this does lock up one can determine the existing // proposal modules by looking at past transactions on chain. - to_binary(&paginate_map_values( + to_json_binary(&paginate_map_values( deps, &PROPOSAL_MODULES, start_after @@ -645,7 +645,7 @@ pub fn query_active_proposal_modules( let limit = limit.unwrap_or(values.len() as u32); - to_binary::>( + to_json_binary::>( &values .into_iter() .filter(|module: &ProposalModule| module.status == ProposalModuleStatus::Enabled) @@ -668,7 +668,7 @@ fn get_pause_info(deps: Deps, env: Env) -> StdResult { } pub fn query_paused(deps: Deps, env: Env) -> StdResult { - to_binary(&get_pause_info(deps, env)?) + to_json_binary(&get_pause_info(deps, env)?) } pub fn query_dump_state(deps: Deps, env: Env) -> StdResult { @@ -683,7 +683,7 @@ pub fn query_dump_state(deps: Deps, env: Env) -> StdResult { let version = get_contract_version(deps.storage)?; let active_proposal_module_count = ACTIVE_PROPOSAL_MODULE_COUNT.load(deps.storage)?; let total_proposal_module_count = TOTAL_PROPOSAL_MODULE_COUNT.load(deps.storage)?; - to_binary(&DumpStateResponse { + to_json_binary(&DumpStateResponse { admin, config, version, @@ -705,7 +705,7 @@ pub fn query_voting_power_at_height( voting_module, &voting::Query::VotingPowerAtHeight { height, address }, )?; - to_binary(&voting_power) + to_json_binary(&voting_power) } pub fn query_total_power_at_height(deps: Deps, height: Option) -> StdResult { @@ -713,17 +713,17 @@ pub fn query_total_power_at_height(deps: Deps, height: Option) -> StdResult let total_power: voting::TotalPowerAtHeightResponse = deps .querier .query_wasm_smart(voting_module, &voting::Query::TotalPowerAtHeight { height })?; - to_binary(&total_power) + to_json_binary(&total_power) } pub fn query_get_item(deps: Deps, item: String) -> StdResult { let item = ITEMS.may_load(deps.storage, item)?; - to_binary(&GetItemResponse { item }) + to_json_binary(&GetItemResponse { item }) } pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } pub fn query_list_items( @@ -731,7 +731,7 @@ pub fn query_list_items( start_after: Option, limit: Option, ) -> StdResult { - to_binary(&paginate_map( + to_json_binary(&paginate_map( deps, &ITEMS, start_after, @@ -745,7 +745,7 @@ pub fn query_cw20_list( start_after: Option, limit: Option, ) -> StdResult { - to_binary(&paginate_map_keys( + to_json_binary(&paginate_map_keys( deps, &CW20_LIST, start_after @@ -761,7 +761,7 @@ pub fn query_cw721_list( start_after: Option, limit: Option, ) -> StdResult { - to_binary(&paginate_map_keys( + to_json_binary(&paginate_map_keys( deps, &CW721_LIST, start_after @@ -802,7 +802,7 @@ pub fn query_cw20_balances( }) }) .collect::>>()?; - to_binary(&balances) + to_json_binary(&balances) } pub fn query_list_sub_daos( @@ -830,18 +830,18 @@ pub fn query_list_sub_daos( }) .collect(); - to_binary(&subdaos) + to_json_binary(&subdaos) } pub fn query_dao_uri(deps: Deps) -> StdResult { let config = CONFIG.load(deps.storage)?; - to_binary(&DaoURIResponse { + to_json_binary(&DaoURIResponse { dao_uri: config.dao_uri, }) } pub fn query_proposal_module_count(deps: Deps) -> StdResult { - to_binary(&ProposalModuleCountResponse { + to_json_binary(&ProposalModuleCountResponse { active_proposal_module_count: ACTIVE_PROPOSAL_MODULE_COUNT.load(deps.storage)?, total_proposal_module_count: TOTAL_PROPOSAL_MODULE_COUNT.load(deps.storage)?, }) @@ -904,10 +904,10 @@ pub fn migrate(deps: DepsMut, env: Env, msg: MigrateMsg) -> Result Result from_binary::(&data) + Some(data) => from_json::(&data) .map(|m| m.msgs) .unwrap_or_else(|_| vec![]), None => vec![], @@ -978,7 +978,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result from_binary::(&data) + Some(data) => from_json::(&data) .map(|m| m.msgs) .unwrap_or_else(|_| vec![]), None => vec![], diff --git a/contracts/dao-dao-core/src/tests.rs b/contracts/dao-dao-core/src/tests.rs index 577552e85..88574113c 100644 --- a/contracts/dao-dao-core/src/tests.rs +++ b/contracts/dao-dao-core/src/tests.rs @@ -1,8 +1,8 @@ use cosmwasm_schema::cw_serde; use cosmwasm_std::{ - from_slice, + from_json, testing::{mock_dependencies, mock_env}, - to_binary, Addr, CosmosMsg, Empty, Storage, Uint128, WasmMsg, + to_json_binary, Addr, CosmosMsg, Empty, Storage, Uint128, WasmMsg, }; use cw2::{set_contract_version, ContractVersion}; use cw_multi_test::{App, Contract, ContractWrapper, Executor}; @@ -117,7 +117,7 @@ fn test_instantiate_with_n_gov_modules(n: usize) { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: cw20_id, - msg: to_binary(&cw20_instantiate).unwrap(), + msg: to_json_binary(&cw20_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), @@ -125,7 +125,7 @@ fn test_instantiate_with_n_gov_modules(n: usize) { proposal_modules_instantiate_info: (0..n) .map(|n| ModuleInstantiateInfo { code_id: cw20_id, - msg: to_binary(&cw20_instantiate).unwrap(), + msg: to_json_binary(&cw20_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: format!("governance module {n}"), @@ -191,7 +191,7 @@ fn test_instantiate_with_submessage_failure() { let mut governance_modules = (0..3) .map(|n| ModuleInstantiateInfo { code_id: cw20_id, - msg: to_binary(&cw20_instantiate).unwrap(), + msg: to_json_binary(&cw20_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: format!("governance module {n}"), @@ -199,14 +199,14 @@ fn test_instantiate_with_submessage_failure() { .collect::>(); governance_modules.push(ModuleInstantiateInfo { code_id: cw20_id, - msg: to_binary("bad").unwrap(), + msg: to_json_binary("bad").unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "I have a bad instantiate message".to_string(), }); governance_modules.push(ModuleInstantiateInfo { code_id: cw20_id, - msg: to_binary(&cw20_instantiate).unwrap(), + msg: to_json_binary(&cw20_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "Everybody knowing @@ -225,7 +225,7 @@ makes wickedness." automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: cw20_id, - msg: to_binary(&cw20_instantiate).unwrap(), + msg: to_json_binary(&cw20_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), @@ -256,14 +256,14 @@ fn test_update_config() { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), @@ -311,7 +311,7 @@ fn test_update_config() { msgs: vec![WasmMsg::Execute { contract_addr: gov_addr.to_string(), funds: vec![], - msg: to_binary(&ExecuteMsg::UpdateConfig { + msg: to_json_binary(&ExecuteMsg::UpdateConfig { config: expected_config.clone(), }) .unwrap(), @@ -355,14 +355,14 @@ fn test_swap_governance(swaps: Vec<(u32, u32)>) { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: propmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: propmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -426,7 +426,7 @@ fn test_swap_governance(swaps: Vec<(u32, u32)>) { let to_add: Vec<_> = (0..add) .map(|n| ModuleInstantiateInfo { code_id: propmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: format!("governance module {n}"), @@ -447,7 +447,7 @@ fn test_swap_governance(swaps: Vec<(u32, u32)>) { msgs: vec![WasmMsg::Execute { contract_addr: gov_addr.to_string(), funds: vec![], - msg: to_binary(&ExecuteMsg::UpdateProposalModules { to_add, to_disable }) + msg: to_json_binary(&ExecuteMsg::UpdateProposalModules { to_add, to_disable }) .unwrap(), } .into()], @@ -534,14 +534,14 @@ fn test_removed_modules_can_not_execute() { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -577,7 +577,7 @@ fn test_removed_modules_can_not_execute() { let to_add = vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "new governance module".to_string(), @@ -593,7 +593,8 @@ fn test_removed_modules_can_not_execute() { msgs: vec![WasmMsg::Execute { contract_addr: gov_addr.to_string(), funds: vec![], - msg: to_binary(&ExecuteMsg::UpdateProposalModules { to_add, to_disable }).unwrap(), + msg: to_json_binary(&ExecuteMsg::UpdateProposalModules { to_add, to_disable }) + .unwrap(), } .into()], }, @@ -609,7 +610,7 @@ fn test_removed_modules_can_not_execute() { // earlier. This should fail as we have been removed. let to_add = vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "new governance module".to_string(), @@ -624,7 +625,7 @@ fn test_removed_modules_can_not_execute() { msgs: vec![WasmMsg::Execute { contract_addr: gov_addr.to_string(), funds: vec![], - msg: to_binary(&ExecuteMsg::UpdateProposalModules { + msg: to_json_binary(&ExecuteMsg::UpdateProposalModules { to_add: to_add.clone(), to_disable: to_disable.clone(), }) @@ -666,7 +667,8 @@ fn test_removed_modules_can_not_execute() { msgs: vec![WasmMsg::Execute { contract_addr: gov_addr.to_string(), funds: vec![], - msg: to_binary(&ExecuteMsg::UpdateProposalModules { to_add, to_disable }).unwrap(), + msg: to_json_binary(&ExecuteMsg::UpdateProposalModules { to_add, to_disable }) + .unwrap(), } .into()], }, @@ -695,14 +697,14 @@ fn test_module_already_disabled() { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -749,10 +751,10 @@ fn test_module_already_disabled() { msgs: vec![WasmMsg::Execute { contract_addr: gov_addr.to_string(), funds: vec![], - msg: to_binary(&ExecuteMsg::UpdateProposalModules { + msg: to_json_binary(&ExecuteMsg::UpdateProposalModules { to_add: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -797,14 +799,14 @@ fn test_swap_voting_module() { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -848,10 +850,10 @@ fn test_swap_voting_module() { msgs: vec![WasmMsg::Execute { contract_addr: gov_addr.to_string(), funds: vec![], - msg: to_binary(&ExecuteMsg::UpdateVotingModule { + msg: to_json_binary(&ExecuteMsg::UpdateVotingModule { module: ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), @@ -901,14 +903,14 @@ fn test_permissions() { image_url: None, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -935,7 +937,7 @@ fn test_permissions() { ExecuteMsg::UpdateVotingModule { module: ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), @@ -1003,14 +1005,14 @@ fn do_standard_instantiate(auto_add: bool, admin: Option) -> (Addr, App) automatically_add_cw721s: auto_add, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: voting_id, - msg: to_binary(&voting_instantiate).unwrap(), + msg: to_json_binary(&voting_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -1058,7 +1060,7 @@ fn test_admin_permissions() { &ExecuteMsg::ExecuteAdminMsgs { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -1077,7 +1079,7 @@ fn test_admin_permissions() { &ExecuteMsg::ExecuteAdminMsgs { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -1108,7 +1110,7 @@ fn test_admin_permissions() { &ExecuteMsg::ExecuteProposalHook { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::NominateAdmin { + msg: to_json_binary(&ExecuteMsg::NominateAdmin { admin: Some("meow".to_string()), }) .unwrap(), @@ -1131,7 +1133,7 @@ fn test_admin_permissions() { &ExecuteMsg::ExecuteAdminMsgs { msgs: vec![WasmMsg::Execute { contract_addr: core_with_admin_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -1150,7 +1152,7 @@ fn test_admin_permissions() { &ExecuteMsg::ExecuteAdminMsgs { msgs: vec![WasmMsg::Execute { contract_addr: core_with_admin_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -1395,7 +1397,7 @@ fn test_admin_nomination() { &ExecuteMsg::ExecuteAdminMsgs { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -1416,7 +1418,7 @@ fn test_admin_nomination() { &ExecuteMsg::ExecuteAdminMsgs { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -1637,14 +1639,14 @@ fn test_list_items() { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: voting_id, - msg: to_binary(&voting_instantiate).unwrap(), + msg: to_json_binary(&voting_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -1771,14 +1773,14 @@ fn test_instantiate_with_items() { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: voting_id, - msg: to_binary(&voting_instantiate).unwrap(), + msg: to_json_binary(&voting_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -1893,7 +1895,7 @@ fn test_cw20_receive_auto_add() { &cw20::Cw20ExecuteMsg::Send { contract: gov_addr.to_string(), amount: Uint128::new(1), - msg: to_binary(&"").unwrap(), + msg: to_json_binary(&"").unwrap(), }, &[], ) @@ -2028,7 +2030,7 @@ fn test_cw20_receive_no_auto_add() { &cw20::Cw20ExecuteMsg::Send { contract: gov_addr.to_string(), amount: Uint128::new(1), - msg: to_binary(&"").unwrap(), + msg: to_json_binary(&"").unwrap(), }, &[], ) @@ -2125,7 +2127,7 @@ fn test_cw721_receive() { &cw721_base::msg::ExecuteMsg::, Empty>::SendNft { contract: gov_addr.to_string(), token_id: "ekez".to_string(), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -2255,7 +2257,7 @@ fn test_cw721_receive_no_auto_add() { &cw721_base::msg::ExecuteMsg::, Empty>::SendNft { contract: gov_addr.to_string(), token_id: "ekez".to_string(), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -2380,7 +2382,7 @@ fn test_pause() { &ExecuteMsg::ExecuteProposalHook { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -2442,7 +2444,7 @@ fn test_pause() { &ExecuteMsg::ExecuteProposalHook { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -2468,7 +2470,7 @@ fn test_pause() { &ExecuteMsg::ExecuteProposalHook { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -2504,7 +2506,7 @@ fn test_pause() { &ExecuteMsg::ExecuteProposalHook { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -2604,14 +2606,14 @@ fn test_migrate_from_compatible() { automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: voting_id, - msg: to_binary(&voting_instantiate).unwrap(), + msg: to_json_binary(&voting_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -2640,7 +2642,7 @@ fn test_migrate_from_compatible() { CosmosMsg::Wasm(WasmMsg::Migrate { contract_addr: core_addr.to_string(), new_code_id: gov_id, - msg: to_binary(&MigrateMsg::FromCompatible {}).unwrap(), + msg: to_json_binary(&MigrateMsg::FromCompatible {}).unwrap(), }), ) .unwrap(); @@ -2692,20 +2694,20 @@ fn test_migrate_from_beta() { automatically_add_cw721s: false, voting_module_instantiate_info: v1::msg::ModuleInstantiateInfo { code_id: voting_id, - msg: to_binary(&voting_instantiate).unwrap(), + msg: to_json_binary(&voting_instantiate).unwrap(), admin: v1::msg::Admin::CoreContract {}, label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ v1::msg::ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&proposal_instantiate).unwrap(), + msg: to_json_binary(&proposal_instantiate).unwrap(), admin: v1::msg::Admin::CoreContract {}, label: "governance module 1".to_string(), }, v1::msg::ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&proposal_instantiate).unwrap(), + msg: to_json_binary(&proposal_instantiate).unwrap(), admin: v1::msg::Admin::CoreContract {}, label: "governance module 2".to_string(), }, @@ -2729,7 +2731,7 @@ fn test_migrate_from_beta() { CosmosMsg::Wasm(WasmMsg::Migrate { contract_addr: core_addr.to_string(), new_code_id: core_id, - msg: to_binary(&MigrateMsg::FromV1 { + msg: to_json_binary(&MigrateMsg::FromV1 { dao_uri: None, params: None, }) @@ -2758,7 +2760,7 @@ fn test_migrate_from_beta() { CosmosMsg::Wasm(WasmMsg::Migrate { contract_addr: core_addr.to_string(), new_code_id: core_id, - msg: to_binary(&MigrateMsg::FromV1 { + msg: to_json_binary(&MigrateMsg::FromV1 { dao_uri: None, params: None, }) @@ -2788,7 +2790,7 @@ fn test_migrate_mock() { let proposal_modules_key = Addr::unchecked("addr"); let old_map: Map = Map::new("proposal_modules"); let path = old_map.key(proposal_modules_key.clone()); - deps.storage.set(&path, &to_binary(&Empty {}).unwrap()); + deps.storage.set(&path, &to_json_binary(&Empty {}).unwrap()); // Write to storage in old config format #[cw_serde] @@ -2816,7 +2818,7 @@ fn test_migrate_mock() { let new_path = PROPOSAL_MODULES.key(proposal_modules_key); let prop_module_bytes = deps.storage.get(&new_path).unwrap(); - let module: ProposalModule = from_slice(&prop_module_bytes).unwrap(); + let module: ProposalModule = from_json(prop_module_bytes).unwrap(); assert_eq!(module.address, Addr::unchecked("addr")); assert_eq!(module.prefix, derive_proposal_module_prefix(0).unwrap()); assert_eq!(module.status, ProposalModuleStatus::Enabled {}); @@ -2860,7 +2862,7 @@ fn test_execute_stargate_msg() { &ExecuteMsg::ExecuteProposalHook { msgs: vec![CosmosMsg::Stargate { type_url: "foo_type".to_string(), - value: to_binary("foo_bin").unwrap(), + value: to_json_binary("foo_bin").unwrap(), }], }, &[], @@ -2889,7 +2891,7 @@ fn test_module_prefixes() { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), @@ -2897,21 +2899,21 @@ fn test_module_prefixes() { proposal_modules_instantiate_info: vec![ ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "proposal module 1".to_string(), }, ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "proposal module 2".to_string(), }, ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "proposal module 2".to_string(), diff --git a/contracts/external/cw-admin-factory/src/tests.rs b/contracts/external/cw-admin-factory/src/tests.rs index 27221cb31..3bee180ee 100644 --- a/contracts/external/cw-admin-factory/src/tests.rs +++ b/contracts/external/cw-admin-factory/src/tests.rs @@ -2,7 +2,7 @@ use std::vec; use cosmwasm_std::{ testing::{mock_dependencies, mock_env, mock_info}, - to_binary, Addr, Binary, Empty, Reply, SubMsg, SubMsgResponse, SubMsgResult, WasmMsg, + to_json_binary, Addr, Binary, Empty, Reply, SubMsg, SubMsgResponse, SubMsgResult, WasmMsg, }; use cw_multi_test::{App, AppResponse, Contract, ContractWrapper, Executor}; @@ -82,7 +82,7 @@ pub fn test_set_admin() { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: cw20_code_id, - msg: to_binary(&cw20_instantiate).unwrap(), + msg: to_json_binary(&cw20_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), @@ -90,14 +90,14 @@ pub fn test_set_admin() { proposal_modules_instantiate_info: vec![ ModuleInstantiateInfo { code_id: cw20_code_id, - msg: to_binary(&cw20_instantiate).unwrap(), + msg: to_json_binary(&cw20_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "prop module".to_string(), }, ModuleInstantiateInfo { code_id: cw20_code_id, - msg: to_binary(&cw20_instantiate).unwrap(), + msg: to_json_binary(&cw20_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "prop module 2".to_string(), @@ -111,7 +111,7 @@ pub fn test_set_admin() { Addr::unchecked("CREATOR"), factory_addr, &ExecuteMsg::InstantiateContractWithSelfAdmin { - instantiate_msg: to_binary(&instantiate_core).unwrap(), + instantiate_msg: to_json_binary(&instantiate_core).unwrap(), code_id: cw_core_code_id, label: "my contract".to_string(), }, diff --git a/contracts/external/cw-fund-distributor/src/contract.rs b/contracts/external/cw-fund-distributor/src/contract.rs index 2e5d4b2d1..c5539d1ef 100644 --- a/contracts/external/cw-fund-distributor/src/contract.rs +++ b/contracts/external/cw-fund-distributor/src/contract.rs @@ -10,8 +10,8 @@ use crate::state::{ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, BankMsg, Binary, Coin, Decimal, Deps, DepsMut, Env, Fraction, MessageInfo, - Order, Response, StdError, StdResult, Uint128, WasmMsg, + to_json_binary, Addr, BankMsg, Binary, Coin, Decimal, Deps, DepsMut, Env, Fraction, + MessageInfo, Order, Response, StdError, StdResult, Uint128, WasmMsg, }; use cw2::set_contract_version; use cw_paginate_storage::paginate_map; @@ -247,7 +247,7 @@ fn get_cw20_claim_wasm_messages( messages.push(WasmMsg::Execute { contract_addr: addr, - msg: to_binary(&cw20::Cw20ExecuteMsg::Transfer { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::Transfer { recipient: sender.to_string(), amount: entitlement, })?, @@ -406,7 +406,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { pub fn query_voting_contract(deps: Deps) -> StdResult { let contract = VOTING_CONTRACT.load(deps.storage)?; let distribution_height = DISTRIBUTION_HEIGHT.load(deps.storage)?; - to_binary(&VotingContractResponse { + to_json_binary(&VotingContractResponse { contract, distribution_height, }) @@ -414,7 +414,7 @@ pub fn query_voting_contract(deps: Deps) -> StdResult { pub fn query_total_power(deps: Deps) -> StdResult { let total_power: Uint128 = TOTAL_POWER.may_load(deps.storage)?.unwrap_or_default(); - to_binary(&TotalPowerResponse { total_power }) + to_json_binary(&TotalPowerResponse { total_power }) } pub fn query_native_denoms(deps: Deps) -> StdResult { @@ -429,7 +429,7 @@ pub fn query_native_denoms(deps: Deps) -> StdResult { }); } - to_binary(&denom_responses) + to_json_binary(&denom_responses) } pub fn query_cw20_tokens(deps: Deps) -> StdResult { @@ -444,7 +444,7 @@ pub fn query_cw20_tokens(deps: Deps) -> StdResult { }); } - to_binary(&cw20_responses) + to_json_binary(&cw20_responses) } pub fn query_native_entitlement(deps: Deps, sender: Addr, denom: String) -> StdResult { @@ -461,7 +461,7 @@ pub fn query_native_entitlement(deps: Deps, sender: Addr, denom: String) -> StdR total_bal.multiply_ratio(relative_share.numerator(), relative_share.denominator()); let entitlement = total_share.checked_sub(prev_claim)?; - to_binary(&NativeEntitlementResponse { + to_json_binary(&NativeEntitlementResponse { amount: entitlement, denom, }) @@ -483,7 +483,7 @@ pub fn query_cw20_entitlement(deps: Deps, sender: Addr, token: String) -> StdRes total_bal.multiply_ratio(relative_share.numerator(), relative_share.denominator()); let entitlement = total_share.checked_sub(prev_claim)?; - to_binary(&CW20EntitlementResponse { + to_json_binary(&CW20EntitlementResponse { amount: entitlement, token_contract: token, }) @@ -514,7 +514,7 @@ pub fn query_native_entitlements( }); } - to_binary(&entitlements) + to_json_binary(&entitlements) } pub fn query_cw20_entitlements( @@ -544,7 +544,7 @@ pub fn query_cw20_entitlements( }); } - to_binary(&entitlements) + to_json_binary(&entitlements) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/external/cw-fund-distributor/src/testing/adversarial_tests.rs b/contracts/external/cw-fund-distributor/src/testing/adversarial_tests.rs index ff07edbff..8df033529 100644 --- a/contracts/external/cw-fund-distributor/src/testing/adversarial_tests.rs +++ b/contracts/external/cw-fund-distributor/src/testing/adversarial_tests.rs @@ -1,6 +1,6 @@ use crate::msg::ExecuteMsg::ClaimAll; use crate::msg::{ExecuteMsg, InstantiateMsg}; -use cosmwasm_std::{to_binary, Addr, Binary, Coin, Empty, Uint128}; +use cosmwasm_std::{to_json_binary, Addr, Binary, Coin, Empty, Uint128}; use cw20::{BalanceResponse, Cw20Coin}; use cw_multi_test::{next_block, App, BankSudo, Contract, ContractWrapper, Executor, SudoMsg}; use cw_utils::Duration; @@ -127,7 +127,7 @@ fn setup_test(initial_balances: Vec) -> BaseTest { &cw20_base::msg::ExecuteMsg::Send { contract: staking_contract.to_string(), amount, - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) diff --git a/contracts/external/cw-fund-distributor/src/testing/tests.rs b/contracts/external/cw-fund-distributor/src/testing/tests.rs index 6c3f2a254..544856b81 100644 --- a/contracts/external/cw-fund-distributor/src/testing/tests.rs +++ b/contracts/external/cw-fund-distributor/src/testing/tests.rs @@ -3,7 +3,7 @@ use crate::msg::{ NativeEntitlementResponse, QueryMsg, TotalPowerResponse, VotingContractResponse, }; use crate::ContractError; -use cosmwasm_std::{to_binary, Addr, Binary, Coin, Empty, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, Binary, Coin, Empty, Uint128, WasmMsg}; use cw20::Cw20Coin; use cw_multi_test::{next_block, App, BankSudo, Contract, ContractWrapper, Executor, SudoMsg}; @@ -114,7 +114,7 @@ fn setup_test(initial_balances: Vec) -> BaseTest { &cw20_base::msg::ExecuteMsg::Send { contract: staking_contract.to_string(), amount, - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -1044,7 +1044,7 @@ pub fn test_redistribute_unclaimed_funds() { WasmMsg::Migrate { contract_addr: distributor_address.to_string(), new_code_id: distributor_id, - msg: to_binary(migrate_msg).unwrap(), + msg: to_json_binary(migrate_msg).unwrap(), } .into(), ) @@ -1121,7 +1121,7 @@ pub fn test_unauthorized_redistribute_unclaimed_funds() { WasmMsg::Migrate { contract_addr: distributor_address.to_string(), new_code_id: distributor_id, - msg: to_binary(migrate_msg).unwrap(), + msg: to_json_binary(migrate_msg).unwrap(), } .into(), ) diff --git a/contracts/external/cw-payroll-factory/src/contract.rs b/contracts/external/cw-payroll-factory/src/contract.rs index f4fd42427..ff033174d 100644 --- a/contracts/external/cw-payroll-factory/src/contract.rs +++ b/contracts/external/cw-payroll-factory/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_binary, to_binary, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Order, Reply, + from_json, to_json_binary, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Order, Reply, Response, StdResult, SubMsg, WasmMsg, }; use cosmwasm_std::{Addr, Coin}; @@ -72,7 +72,7 @@ pub fn execute_receive_cw20( // Only accepts cw20 tokens nonpayable(&info)?; - let msg: ReceiveMsg = from_binary(&receive_msg.msg)?; + let msg: ReceiveMsg = from_json(&receive_msg.msg)?; if TMP_INSTANTIATOR_INFO.may_load(deps.storage)?.is_some() { return Err(ContractError::Reentrancy); @@ -137,7 +137,7 @@ pub fn instantiate_contract( let instantiate = WasmMsg::Instantiate { admin: instantiate_msg.owner.clone(), code_id, - msg: to_binary(&instantiate_msg)?, + msg: to_json_binary(&instantiate_msg)?, funds: funds.unwrap_or_default(), label, }; @@ -184,7 +184,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { .flat_map(|vc| Ok::(vc?.1)) .collect(); - Ok(to_binary(&res)?) + Ok(to_json_binary(&res)?) } QueryMsg::ListVestingContractsReverse { start_before, @@ -199,7 +199,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { .flat_map(|vc| Ok::(vc?.1)) .collect(); - Ok(to_binary(&res)?) + Ok(to_json_binary(&res)?) } QueryMsg::ListVestingContractsByInstantiator { instantiator, @@ -221,7 +221,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { .flat_map(|vc| Ok::(vc?.1)) .collect(); - Ok(to_binary(&res)?) + Ok(to_json_binary(&res)?) } QueryMsg::ListVestingContractsByInstantiatorReverse { instantiator, @@ -243,7 +243,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { .flat_map(|vc| Ok::(vc?.1)) .collect(); - Ok(to_binary(&res)?) + Ok(to_json_binary(&res)?) } QueryMsg::ListVestingContractsByRecipient { recipient, @@ -265,7 +265,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { .flat_map(|vc| Ok::(vc?.1)) .collect(); - Ok(to_binary(&res)?) + Ok(to_json_binary(&res)?) } QueryMsg::ListVestingContractsByRecipientReverse { recipient, @@ -287,10 +287,10 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { .flat_map(|vc| Ok::(vc?.1)) .collect(); - Ok(to_binary(&res)?) + Ok(to_json_binary(&res)?) } - QueryMsg::Ownership {} => to_binary(&cw_ownable::get_ownership(deps.storage)?), - QueryMsg::CodeId {} => to_binary(&VESTING_CODE_ID.load(deps.storage)?), + QueryMsg::Ownership {} => to_json_binary(&cw_ownable::get_ownership(deps.storage)?), + QueryMsg::CodeId {} => to_json_binary(&VESTING_CODE_ID.load(deps.storage)?), } } @@ -329,10 +329,10 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result StdResult { let counterparty_one = COUNTERPARTY_ONE.load(deps.storage)?; let counterparty_two = COUNTERPARTY_TWO.load(deps.storage)?; - to_binary(&StatusResponse { + to_json_binary(&StatusResponse { counterparty_one, counterparty_two, }) diff --git a/contracts/external/cw-token-swap/src/state.rs b/contracts/external/cw-token-swap/src/state.rs index 7ea5cd1a5..5a7071567 100644 --- a/contracts/external/cw-token-swap/src/state.rs +++ b/contracts/external/cw-token-swap/src/state.rs @@ -1,5 +1,7 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{to_binary, Addr, BankMsg, Coin, CosmosMsg, Deps, StdError, Uint128, WasmMsg}; +use cosmwasm_std::{ + to_json_binary, Addr, BankMsg, Coin, CosmosMsg, Deps, StdError, Uint128, WasmMsg, +}; use cw_storage_plus::Item; use crate::{ @@ -85,7 +87,7 @@ impl CheckedTokenInfo { amount, } => WasmMsg::Execute { contract_addr: contract_addr.into_string(), - msg: to_binary(&cw20::Cw20ExecuteMsg::Transfer { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::Transfer { recipient: recipient.to_string(), amount, })?, @@ -133,7 +135,7 @@ mod tests { CosmosMsg::Wasm(WasmMsg::Execute { funds: vec![], contract_addr: "ekez_token".to_string(), - msg: to_binary(&cw20::Cw20ExecuteMsg::Transfer { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::Transfer { recipient: "ekez".to_string(), amount: Uint128::new(100) }) diff --git a/contracts/external/cw-token-swap/src/tests.rs b/contracts/external/cw-token-swap/src/tests.rs index 7e6073f20..e2d2a9913 100644 --- a/contracts/external/cw-token-swap/src/tests.rs +++ b/contracts/external/cw-token-swap/src/tests.rs @@ -1,6 +1,6 @@ use cosmwasm_std::{ testing::{mock_dependencies, mock_env}, - to_binary, Addr, Coin, Empty, Uint128, + to_json_binary, Addr, Coin, Empty, Uint128, }; use cw20::Cw20Coin; use cw_multi_test::{App, BankSudo, Contract, ContractWrapper, Executor, SudoMsg}; @@ -95,7 +95,7 @@ fn test_simple_escrow() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.to_string(), amount: Uint128::new(100), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -209,7 +209,7 @@ fn test_withdraw() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.to_string(), amount: Uint128::new(100), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -380,7 +380,7 @@ fn test_withdraw_post_completion() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.to_string(), amount: Uint128::new(100), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -618,7 +618,7 @@ fn test_fund_non_counterparty() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.to_string(), amount: Uint128::new(100), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -714,7 +714,7 @@ fn test_fund_twice() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.to_string(), amount: Uint128::new(100), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -763,7 +763,7 @@ fn test_fund_twice() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.into_string(), amount: Uint128::new(100), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -835,7 +835,7 @@ fn test_fund_invalid_amount() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.to_string(), amount: Uint128::new(10), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -1022,7 +1022,7 @@ fn test_fund_invalid_cw20() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.to_string(), amount: Uint128::new(100), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -1041,7 +1041,7 @@ fn test_fund_invalid_cw20() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.to_string(), amount: Uint128::new(100), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) diff --git a/contracts/external/cw-tokenfactory-issuer/src/contract.rs b/contracts/external/cw-tokenfactory-issuer/src/contract.rs index 2883087c6..1879a52a6 100644 --- a/contracts/external/cw-tokenfactory-issuer/src/contract.rs +++ b/contracts/external/cw-tokenfactory-issuer/src/contract.rs @@ -3,7 +3,7 @@ use std::convert::TryInto; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, SubMsg, + to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, SubMsg, }; use cosmwasm_std::{CosmosMsg, Reply}; use cw2::{get_contract_version, set_contract_version, ContractVersion}; @@ -133,30 +133,32 @@ pub fn sudo(deps: DepsMut, _env: Env, msg: SudoMsg) -> Result StdResult { match msg { QueryMsg::Allowlist { start_after, limit } => { - to_binary(&queries::query_allowlist(deps, start_after, limit)?) + to_json_binary(&queries::query_allowlist(deps, start_after, limit)?) } QueryMsg::BeforeSendHookInfo {} => { - to_binary(&queries::query_before_send_hook_features(deps)?) + to_json_binary(&queries::query_before_send_hook_features(deps)?) } QueryMsg::BurnAllowance { address } => { - to_binary(&queries::query_burn_allowance(deps, address)?) + to_json_binary(&queries::query_burn_allowance(deps, address)?) } QueryMsg::BurnAllowances { start_after, limit } => { - to_binary(&queries::query_burn_allowances(deps, start_after, limit)?) + to_json_binary(&queries::query_burn_allowances(deps, start_after, limit)?) } - QueryMsg::Denom {} => to_binary(&queries::query_denom(deps)?), + QueryMsg::Denom {} => to_json_binary(&queries::query_denom(deps)?), QueryMsg::Denylist { start_after, limit } => { - to_binary(&queries::query_denylist(deps, start_after, limit)?) + to_json_binary(&queries::query_denylist(deps, start_after, limit)?) } - QueryMsg::IsAllowed { address } => to_binary(&queries::query_is_allowed(deps, address)?), - QueryMsg::IsDenied { address } => to_binary(&queries::query_is_denied(deps, address)?), - QueryMsg::IsFrozen {} => to_binary(&queries::query_is_frozen(deps)?), - QueryMsg::Ownership {} => to_binary(&queries::query_owner(deps)?), + QueryMsg::IsAllowed { address } => { + to_json_binary(&queries::query_is_allowed(deps, address)?) + } + QueryMsg::IsDenied { address } => to_json_binary(&queries::query_is_denied(deps, address)?), + QueryMsg::IsFrozen {} => to_json_binary(&queries::query_is_frozen(deps)?), + QueryMsg::Ownership {} => to_json_binary(&queries::query_owner(deps)?), QueryMsg::MintAllowance { address } => { - to_binary(&queries::query_mint_allowance(deps, address)?) + to_json_binary(&queries::query_mint_allowance(deps, address)?) } QueryMsg::MintAllowances { start_after, limit } => { - to_binary(&queries::query_mint_allowances(deps, start_after, limit)?) + to_json_binary(&queries::query_mint_allowances(deps, start_after, limit)?) } } } diff --git a/contracts/external/cw-vesting/src/contract.rs b/contracts/external/cw-vesting/src/contract.rs index 70c0cea96..264a062e0 100644 --- a/contracts/external/cw-vesting/src/contract.rs +++ b/contracts/external/cw-vesting/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_binary, to_binary, Binary, Coin, CosmosMsg, DelegationResponse, Deps, DepsMut, + from_json, to_json_binary, Binary, Coin, CosmosMsg, DelegationResponse, Deps, DepsMut, DistributionMsg, Env, MessageInfo, Response, StakingMsg, StakingQuery, StdResult, Timestamp, Uint128, }; @@ -137,7 +137,7 @@ pub fn execute_receive_cw20( // Only accepts cw20 tokens nonpayable(&info)?; - let msg: ReceiveMsg = from_binary(&receive_msg.msg)?; + let msg: ReceiveMsg = from_json(&receive_msg.msg)?; match msg { ReceiveMsg::Fund {} => { @@ -446,20 +446,20 @@ pub fn execute_register_slash( #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { - QueryMsg::Ownership {} => to_binary(&cw_ownable::get_ownership(deps.storage)?), - QueryMsg::Info {} => to_binary(&PAYMENT.get_vest(deps.storage)?), - QueryMsg::Distributable { t } => to_binary(&PAYMENT.distributable( + QueryMsg::Ownership {} => to_json_binary(&cw_ownable::get_ownership(deps.storage)?), + QueryMsg::Info {} => to_json_binary(&PAYMENT.get_vest(deps.storage)?), + QueryMsg::Distributable { t } => to_json_binary(&PAYMENT.distributable( deps.storage, &PAYMENT.get_vest(deps.storage)?, t.unwrap_or(env.block.time), )?), QueryMsg::Stake(q) => PAYMENT.query_stake(deps.storage, q), - QueryMsg::Vested { t } => to_binary( + QueryMsg::Vested { t } => to_json_binary( &PAYMENT .get_vest(deps.storage)? .vested(t.unwrap_or(env.block.time)), ), - QueryMsg::TotalToVest {} => to_binary(&PAYMENT.get_vest(deps.storage)?.total()), - QueryMsg::VestDuration {} => to_binary(&PAYMENT.duration(deps.storage)?), + QueryMsg::TotalToVest {} => to_json_binary(&PAYMENT.get_vest(deps.storage)?.total()), + QueryMsg::VestDuration {} => to_json_binary(&PAYMENT.duration(deps.storage)?), } } diff --git a/contracts/external/cw-vesting/src/tests.rs b/contracts/external/cw-vesting/src/tests.rs index c9f78099c..9a55807b5 100644 --- a/contracts/external/cw-vesting/src/tests.rs +++ b/contracts/external/cw-vesting/src/tests.rs @@ -1,5 +1,5 @@ use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info}; -use cosmwasm_std::{coins, to_binary, Addr, Coin, Decimal, Empty, Uint128, Validator}; +use cosmwasm_std::{coins, to_json_binary, Addr, Coin, Decimal, Empty, Uint128, Validator}; use cw20::{Cw20Coin, Cw20ExecuteMsg, Cw20ReceiveMsg}; use cw_denom::{CheckedDenom, UncheckedDenom}; use cw_multi_test::{ @@ -170,7 +170,7 @@ fn setup_test_case(app: &mut App, msg: InstantiateMsg, funds: &[Coin]) -> TestCa let msg = Cw20ExecuteMsg::Send { contract: cw_vesting_addr.to_string(), amount: msg.total, - msg: to_binary(&ReceiveMsg::Fund {}).unwrap(), + msg: to_json_binary(&ReceiveMsg::Fund {}).unwrap(), }; app.execute_contract( Addr::unchecked(OWNER), @@ -344,7 +344,7 @@ fn test_staking_rewards_go_to_receiver() { StakingInfo { bonded_denom: NATIVE_DENOM.to_string(), unbonding_time: 60, - /// Interest rate per year (60 * 60 * 24 * 365 seconds) + // Interest rate per year (60 * 60 * 24 * 365 seconds) apr: Decimal::percent(10), }, ) @@ -509,7 +509,7 @@ fn test_catch_imposter_cw20() { let msg = Cw20ExecuteMsg::Send { contract: cw_vesting_addr.to_string(), amount: Uint128::new(TOTAL_VEST), - msg: to_binary(&ReceiveMsg::Fund {}).unwrap(), + msg: to_json_binary(&ReceiveMsg::Fund {}).unwrap(), }; // Errors that cw20 does not match what was expected @@ -595,7 +595,7 @@ fn test_execution_rejection_recv() { Cw20ReceiveMsg { sender: "random".to_string(), amount: Uint128::new(100), - msg: to_binary(&ReceiveMsg::Fund {}).unwrap(), + msg: to_json_binary(&ReceiveMsg::Fund {}).unwrap(), }, ) .unwrap_err(); @@ -608,7 +608,7 @@ fn test_execution_rejection_recv() { Cw20ReceiveMsg { sender: "random".to_string(), amount: Uint128::new(101), - msg: to_binary(&ReceiveMsg::Fund {}).unwrap(), + msg: to_json_binary(&ReceiveMsg::Fund {}).unwrap(), }, ) .unwrap_err(); diff --git a/contracts/external/cw721-roles/src/contract.rs b/contracts/external/cw721-roles/src/contract.rs index 2fc13bc37..833007e46 100644 --- a/contracts/external/cw721-roles/src/contract.rs +++ b/contracts/external/cw721-roles/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_binary, to_binary, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Order, Response, + from_json, to_json_binary, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Order, Response, StdResult, SubMsg, Uint64, }; use cw4::{ @@ -154,7 +154,7 @@ pub fn execute_burn( token_id: String, ) -> Result { // Lookup the owner of the NFT - let owner: OwnerOfResponse = from_binary(&Cw721Roles::default().query( + let owner: OwnerOfResponse = from_json(Cw721Roles::default().query( deps.as_ref(), env.clone(), QueryMsg::OwnerOf { @@ -164,7 +164,7 @@ pub fn execute_burn( )?)?; // Get the weight of the token - let nft_info: NftInfoResponse = from_binary(&Cw721Roles::default().query( + let nft_info: NftInfoResponse = from_json(Cw721Roles::default().query( deps.as_ref(), env.clone(), QueryMsg::NftInfo { @@ -438,14 +438,16 @@ pub fn execute_update_token_weight( pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { QueryMsg::Extension { msg } => match msg { - QueryExt::Hooks {} => to_binary(&HOOKS.query_hooks(deps)?), + QueryExt::Hooks {} => to_json_binary(&HOOKS.query_hooks(deps)?), QueryExt::ListMembers { start_after, limit } => { - to_binary(&query_list_members(deps, start_after, limit)?) + to_json_binary(&query_list_members(deps, start_after, limit)?) } QueryExt::Member { addr, at_height } => { - to_binary(&query_member(deps, addr, at_height)?) + to_json_binary(&query_member(deps, addr, at_height)?) + } + QueryExt::TotalWeight { at_height } => { + to_json_binary(&query_total_weight(deps, at_height)?) } - QueryExt::TotalWeight { at_height } => to_binary(&query_total_weight(deps, at_height)?), }, _ => Cw721Roles::default().query(deps, env, msg), } diff --git a/contracts/external/cw721-roles/src/tests.rs b/contracts/external/cw721-roles/src/tests.rs index 0783af57a..005c2e61f 100644 --- a/contracts/external/cw721-roles/src/tests.rs +++ b/contracts/external/cw721-roles/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, Addr, Binary}; +use cosmwasm_std::{to_json_binary, Addr, Binary}; use cw4::{HooksResponse, Member, MemberListResponse, MemberResponse, TotalWeightResponse}; use cw721::{NftInfoResponse, OwnerOfResponse}; use cw_multi_test::{App, Executor}; @@ -276,7 +276,7 @@ fn test_send_permissions() { let msg = ExecuteMsg::SendNft { contract: cw721_staked_addr.to_string(), token_id: "1".to_string(), - msg: to_binary(&Binary::default()).unwrap(), + msg: to_json_binary(&Binary::default()).unwrap(), }; app.execute_contract(Addr::unchecked(ALICE), cw721_addr.clone(), &msg, &[]) .unwrap_err(); diff --git a/contracts/external/dao-migrator/src/contract.rs b/contracts/external/dao-migrator/src/contract.rs index ae91152d5..3610ab9be 100644 --- a/contracts/external/dao-migrator/src/contract.rs +++ b/contracts/external/dao-migrator/src/contract.rs @@ -3,7 +3,7 @@ use std::{collections::HashSet, env}; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, + to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, SubMsg, WasmMsg, }; use cw2::set_contract_version; @@ -42,10 +42,10 @@ pub fn instantiate( CORE_ADDR.save(deps.storage, &info.sender)?; Ok( - Response::default().set_data(to_binary(&ModuleInstantiateCallback { + Response::default().set_data(to_json_binary(&ModuleInstantiateCallback { msgs: vec![WasmMsg::Execute { contract_addr: env.contract.address.to_string(), - msg: to_binary(&MigrateV1ToV2 { + msg: to_json_binary(&MigrateV1ToV2 { sub_daos: msg.sub_daos, migration_params: msg.migration_params, v1_code_ids: msg.v1_code_ids, @@ -168,7 +168,7 @@ fn execute_migration_v1_v2( WasmMsg::Migrate { contract_addr: voting_module.to_string(), new_code_id: voting_pair.v2_code_id, - msg: to_binary(&voting_pair.migrate_msg).unwrap(), + msg: to_json_binary(&voting_pair.migrate_msg).unwrap(), } .into(), ); @@ -212,7 +212,7 @@ fn execute_migration_v1_v2( WasmMsg::Migrate { contract_addr: cw20_staked_addr.to_string(), new_code_id: staking_pair.v2_code_id, - msg: to_binary(&staking_pair.migrate_msg).unwrap(), + msg: to_json_binary(&staking_pair.migrate_msg).unwrap(), } .into(), ); @@ -276,7 +276,7 @@ fn execute_migration_v1_v2( WasmMsg::Migrate { contract_addr: module.address.to_string(), new_code_id: proposal_pair.v2_code_id, - msg: to_binary(&proposal_pair.migrate_msg).unwrap(), + msg: to_json_binary(&proposal_pair.migrate_msg).unwrap(), } .into(), ); @@ -305,7 +305,7 @@ fn execute_migration_v1_v2( msgs.push( WasmMsg::Execute { contract_addr: info.sender.to_string(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::UpdateSubDaos { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::UpdateSubDaos { to_add: sub_daos, to_remove: vec![], })?, @@ -318,7 +318,7 @@ fn execute_migration_v1_v2( let proposal_hook_msg = SubMsg::reply_on_success( WasmMsg::Execute { contract_addr: info.sender.to_string(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { msgs })?, + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { msgs })?, funds: vec![], }, V1_V2_REPLY_ID, @@ -345,13 +345,15 @@ pub fn reply(deps: DepsMut, env: Env, reply: Reply) -> Result (Addr, V let (voting_code_id, msg) = match voting_type { VotingType::Cw4 => ( code_ids.cw4_voting, - to_binary(&get_cw4_init_msg(code_ids.clone())).unwrap(), + to_json_binary(&get_cw4_init_msg(code_ids.clone())).unwrap(), ), VotingType::Cw20 => ( code_ids.cw20_voting, - to_binary(&get_cw20_init_msg(code_ids.clone())).unwrap(), + to_json_binary(&get_cw20_init_msg(code_ids.clone())).unwrap(), ), VotingType::Cw20V03 => { // The simple change we need to do is to swap the cw20_stake with the one in v0.3.0 @@ -35,7 +35,7 @@ pub fn init_v1(app: &mut App, sender: Addr, voting_type: VotingType) -> (Addr, V ( code_ids.cw20_voting, - to_binary(&get_cw20_init_msg(code_ids.clone())).unwrap(), + to_json_binary(&get_cw20_init_msg(code_ids.clone())).unwrap(), ) } }; @@ -59,7 +59,7 @@ pub fn init_v1(app: &mut App, sender: Addr, voting_type: VotingType) -> (Addr, V }, proposal_modules_instantiate_info: vec![cw_core_v1::msg::ModuleInstantiateInfo { code_id: code_ids.proposal_single, - msg: to_binary(&cw_proposal_single_v1::msg::InstantiateMsg { + msg: to_json_binary(&cw_proposal_single_v1::msg::InstantiateMsg { threshold: voting_v1::Threshold::AbsolutePercentage { percentage: voting_v1::PercentageThreshold::Majority {}, }, @@ -109,11 +109,11 @@ pub fn init_v1_with_multiple_proposals( let (voting_code_id, msg) = match voting_type { VotingType::Cw4 => ( code_ids.cw4_voting, - to_binary(&get_cw4_init_msg(code_ids.clone())).unwrap(), + to_json_binary(&get_cw4_init_msg(code_ids.clone())).unwrap(), ), VotingType::Cw20 => ( code_ids.cw20_voting, - to_binary(&get_cw20_init_msg(code_ids.clone())).unwrap(), + to_json_binary(&get_cw20_init_msg(code_ids.clone())).unwrap(), ), VotingType::Cw20V03 => { let v03_cw20_stake = app.store_code(stake_cw20_v03_contract()); @@ -122,7 +122,7 @@ pub fn init_v1_with_multiple_proposals( ( code_ids.cw20_voting, - to_binary(&get_cw20_init_msg(code_ids.clone())).unwrap(), + to_json_binary(&get_cw20_init_msg(code_ids.clone())).unwrap(), ) } }; @@ -147,7 +147,7 @@ pub fn init_v1_with_multiple_proposals( proposal_modules_instantiate_info: vec![ cw_core_v1::msg::ModuleInstantiateInfo { code_id: code_ids.proposal_single, - msg: to_binary(&cw_proposal_single_v1::msg::InstantiateMsg { + msg: to_json_binary(&cw_proposal_single_v1::msg::InstantiateMsg { threshold: voting_v1::Threshold::AbsolutePercentage { percentage: voting_v1::PercentageThreshold::Majority {}, }, @@ -163,7 +163,7 @@ pub fn init_v1_with_multiple_proposals( }, cw_core_v1::msg::ModuleInstantiateInfo { code_id: code_ids.proposal_single, - msg: to_binary(&cw_proposal_single_v1::msg::InstantiateMsg { + msg: to_json_binary(&cw_proposal_single_v1::msg::InstantiateMsg { threshold: voting_v1::Threshold::AbsolutePercentage { percentage: voting_v1::PercentageThreshold::Majority {}, }, @@ -291,7 +291,7 @@ pub fn execute_migration( WasmMsg::Migrate { contract_addr: module_addrs.core.to_string(), new_code_id: new_code_ids.core, - msg: to_binary(&dao_interface::msg::MigrateMsg::FromV1 { + msg: to_json_binary(&dao_interface::msg::MigrateMsg::FromV1 { dao_uri: None, params: None, }) @@ -300,10 +300,10 @@ pub fn execute_migration( .into(), WasmMsg::Execute { contract_addr: module_addrs.core.to_string(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::UpdateProposalModules { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::UpdateProposalModules { to_add: vec![ModuleInstantiateInfo { code_id: migrator_code_id, - msg: to_binary(&crate::msg::InstantiateMsg { + msg: to_json_binary(&crate::msg::InstantiateMsg { sub_daos: params.sub_daos.unwrap(), migration_params: MigrationParams { migrate_stake_cw20_manager: params.migrate_cw20, @@ -398,7 +398,7 @@ pub fn execute_migration_from_core( msgs: vec![WasmMsg::Migrate { contract_addr: module_addrs.core.to_string(), new_code_id: new_code_ids.core, - msg: to_binary(&dao_interface::msg::MigrateMsg::FromV1 { + msg: to_json_binary(&dao_interface::msg::MigrateMsg::FromV1 { dao_uri: None, params: Some(dao_interface::migrate_msg::MigrateParams { migrator_code_id, diff --git a/contracts/pre-propose/dao-pre-propose-approval-single/src/contract.rs b/contracts/pre-propose/dao-pre-propose-approval-single/src/contract.rs index 77fc70180..215335d83 100644 --- a/contracts/pre-propose/dao-pre-propose-approval-single/src/contract.rs +++ b/contracts/pre-propose/dao-pre-propose-approval-single/src/contract.rs @@ -1,8 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Order, Response, StdResult, SubMsg, - WasmMsg, + to_json_binary, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Order, Response, StdResult, + SubMsg, WasmMsg, }; use cw2::set_contract_version; use cw_paginate_storage::paginate_map_values; @@ -110,7 +110,7 @@ pub fn execute_propose( .prepare_hooks(deps.storage, |a| { let execute_msg = WasmMsg::Execute { contract_addr: a.into_string(), - msg: to_binary(&ExecuteBase::::Propose { + msg: to_json_binary(&ExecuteBase::::Propose { msg: ApproverProposeMessage::Propose { title: propose_msg_internal.title.clone(), description: propose_msg_internal.description.clone(), @@ -173,7 +173,7 @@ pub fn execute_approve( let propose_messsage = WasmMsg::Execute { contract_addr: proposal_module.into_string(), - msg: to_binary(&ProposeMessageInternal::Propose(proposal.msg.clone()))?, + msg: to_json_binary(&ProposeMessageInternal::Propose(proposal.msg.clone()))?, funds: vec![], }; @@ -255,7 +255,7 @@ pub fn execute_reject( Ok(Response::default() .add_attribute("method", "proposal_rejected") .add_attribute("proposal", id.to_string()) - .add_attribute("deposit_info", to_binary(&deposit)?.to_string()) + .add_attribute("deposit_info", to_json_binary(&deposit)?.to_string()) .add_messages(messages)) } @@ -330,7 +330,7 @@ pub fn execute_remove_approver_hook( pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { QueryMsg::QueryExtension { msg } => match msg { - QueryExt::Approver {} => to_binary(&APPROVER.load(deps.storage)?), + QueryExt::Approver {} => to_json_binary(&APPROVER.load(deps.storage)?), QueryExt::IsPending { id } => { let pending = PENDING_PROPOSALS.may_load(deps.storage, id)?.is_some(); // Force load completed proposal if not pending, throwing error @@ -339,31 +339,33 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { COMPLETED_PROPOSALS.load(deps.storage, id)?; } - to_binary(&pending) + to_json_binary(&pending) } QueryExt::Proposal { id } => { if let Some(pending) = PENDING_PROPOSALS.may_load(deps.storage, id)? { - to_binary(&pending) + to_json_binary(&pending) } else { // Force load completed proposal if not pending, throwing // error if not found. - to_binary(&COMPLETED_PROPOSALS.load(deps.storage, id)?) + to_json_binary(&COMPLETED_PROPOSALS.load(deps.storage, id)?) } } QueryExt::PendingProposal { id } => { - to_binary(&PENDING_PROPOSALS.load(deps.storage, id)?) + to_json_binary(&PENDING_PROPOSALS.load(deps.storage, id)?) + } + QueryExt::PendingProposals { start_after, limit } => { + to_json_binary(&paginate_map_values( + deps, + &PENDING_PROPOSALS, + start_after, + limit, + Order::Ascending, + )?) } - QueryExt::PendingProposals { start_after, limit } => to_binary(&paginate_map_values( - deps, - &PENDING_PROPOSALS, - start_after, - limit, - Order::Ascending, - )?), QueryExt::ReversePendingProposals { start_before, limit, - } => to_binary(&paginate_map_values( + } => to_json_binary(&paginate_map_values( deps, &PENDING_PROPOSALS, start_before, @@ -371,19 +373,21 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { Order::Descending, )?), QueryExt::CompletedProposal { id } => { - to_binary(&COMPLETED_PROPOSALS.load(deps.storage, id)?) + to_json_binary(&COMPLETED_PROPOSALS.load(deps.storage, id)?) + } + QueryExt::CompletedProposals { start_after, limit } => { + to_json_binary(&paginate_map_values( + deps, + &COMPLETED_PROPOSALS, + start_after, + limit, + Order::Ascending, + )?) } - QueryExt::CompletedProposals { start_after, limit } => to_binary(&paginate_map_values( - deps, - &COMPLETED_PROPOSALS, - start_after, - limit, - Order::Ascending, - )?), QueryExt::ReverseCompletedProposals { start_before, limit, - } => to_binary(&paginate_map_values( + } => to_json_binary(&paginate_map_values( deps, &COMPLETED_PROPOSALS, start_before, @@ -391,7 +395,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { Order::Descending, )?), QueryExt::CompletedProposalIdForCreatedProposalId { id } => { - to_binary(&CREATED_PROPOSAL_TO_COMPLETED_PROPOSAL.may_load(deps.storage, id)?) + to_json_binary(&CREATED_PROPOSAL_TO_COMPLETED_PROPOSAL.may_load(deps.storage, id)?) } }, _ => PrePropose::default().query(deps, env, msg), diff --git a/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs b/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs index 49e1501ad..2dbbce897 100644 --- a/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{coins, from_slice, to_binary, Addr, Coin, Empty, Uint128}; +use cosmwasm_std::{coins, from_json, to_json_binary, Addr, Coin, Empty, Uint128}; use cw2::ContractVersion; use cw20::Cw20Coin; use cw_denom::UncheckedDenom; @@ -63,7 +63,7 @@ fn get_default_proposal_module_instantiate( pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info, open_proposal_submission, extension: InstantiateExt { @@ -123,7 +123,7 @@ fn setup_default_test( let core_addr = instantiate_with_cw4_groups_governance( app, dao_proposal_single_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), @@ -1093,8 +1093,8 @@ fn test_set_version() { false, ); - let info: ContractVersion = from_slice( - &app.wrap() + let info: ContractVersion = from_json( + app.wrap() .query_wasm_raw(pre_propose, "contract_info".as_bytes()) .unwrap() .unwrap(), @@ -1342,7 +1342,7 @@ fn test_instantiate_with_zero_native_deposit() { pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: DepositToken::Token { denom: UncheckedDenom::Native("ujuno".to_string()), @@ -1369,7 +1369,7 @@ fn test_instantiate_with_zero_native_deposit() { instantiate_with_cw4_groups_governance( &mut app, dao_proposal_single_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), @@ -1406,7 +1406,7 @@ fn test_instantiate_with_zero_cw20_deposit() { pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: DepositToken::Token { denom: UncheckedDenom::Cw20(cw20_addr.into_string()), @@ -1433,7 +1433,7 @@ fn test_instantiate_with_zero_cw20_deposit() { instantiate_with_cw4_groups_governance( &mut app, dao_proposal_single_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), diff --git a/contracts/pre-propose/dao-pre-propose-approver/src/contract.rs b/contracts/pre-propose/dao-pre-propose-approver/src/contract.rs index 7aa645ae6..4dddbb545 100644 --- a/contracts/pre-propose/dao-pre-propose-approver/src/contract.rs +++ b/contracts/pre-propose/dao-pre-propose-approver/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Response, StdResult, + to_json_binary, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Response, StdResult, WasmMsg, }; use cw2::set_contract_version; @@ -52,18 +52,18 @@ pub fn instantiate( let addr = deps.api.addr_validate(&msg.pre_propose_approval_contract)?; PRE_PROPOSE_APPROVAL_CONTRACT.save(deps.storage, &addr)?; - Ok(resp.set_data(to_binary(&ModuleInstantiateCallback { + Ok(resp.set_data(to_json_binary(&ModuleInstantiateCallback { msgs: vec![ CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: addr.to_string(), - msg: to_binary(&PreProposeApprovalExecuteMsg::AddProposalSubmittedHook { + msg: to_json_binary(&PreProposeApprovalExecuteMsg::AddProposalSubmittedHook { address: env.contract.address.to_string(), })?, funds: vec![], }), CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: addr.to_string(), - msg: to_binary(&PreProposeApprovalExecuteMsg::Extension { + msg: to_json_binary(&PreProposeApprovalExecuteMsg::Extension { msg: ApprovalExt::UpdateApprover { address: env.contract.address.to_string(), }, @@ -131,7 +131,7 @@ pub fn execute_propose( let propose_messsage = WasmMsg::Execute { contract_addr: proposal_module.into_string(), - msg: to_binary(&sanitized_msg)?, + msg: to_json_binary(&sanitized_msg)?, funds: vec![], }; Ok(Response::default().add_message(propose_messsage)) @@ -159,14 +159,14 @@ pub fn execute_proposal_completed( let msg = match new_status { Status::Closed => Some(WasmMsg::Execute { contract_addr: approval_contract.into_string(), - msg: to_binary(&PreProposeApprovalExecuteMsg::Extension { + msg: to_json_binary(&PreProposeApprovalExecuteMsg::Extension { msg: ApprovalExt::Reject { id: pre_propose_id }, })?, funds: vec![], }), Status::Executed => Some(WasmMsg::Execute { contract_addr: approval_contract.into_string(), - msg: to_binary(&PreProposeApprovalExecuteMsg::Extension { + msg: to_json_binary(&PreProposeApprovalExecuteMsg::Extension { msg: ApprovalExt::Approve { id: pre_propose_id }, })?, funds: vec![], @@ -189,13 +189,13 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { QueryMsg::QueryExtension { msg } => match msg { QueryExt::PreProposeApprovalContract {} => { - to_binary(&PRE_PROPOSE_APPROVAL_CONTRACT.load(deps.storage)?) + to_json_binary(&PRE_PROPOSE_APPROVAL_CONTRACT.load(deps.storage)?) } QueryExt::PreProposeApprovalIdForApproverProposalId { id } => { - to_binary(&PROPOSAL_ID_TO_PRE_PROPOSE_ID.may_load(deps.storage, id)?) + to_json_binary(&PROPOSAL_ID_TO_PRE_PROPOSE_ID.may_load(deps.storage, id)?) } QueryExt::ApproverProposalIdForPreProposeApprovalId { id } => { - to_binary(&PRE_PROPOSE_ID_TO_PROPOSAL_ID.may_load(deps.storage, id)?) + to_json_binary(&PRE_PROPOSE_ID_TO_PROPOSAL_ID.may_load(deps.storage, id)?) } }, _ => PrePropose::default().query(deps, env, msg), diff --git a/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs b/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs index d205fdb67..709f3fd28 100644 --- a/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{coins, from_slice, to_binary, Addr, Coin, Empty, Uint128}; +use cosmwasm_std::{coins, from_json, to_json_binary, Addr, Coin, Empty, Uint128}; use cw2::ContractVersion; use cw20::Cw20Coin; use cw_denom::UncheckedDenom; @@ -87,7 +87,7 @@ fn get_proposal_module_approval_single_instantiate( pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info, open_proposal_submission, extension: InstantiateExt { @@ -123,7 +123,7 @@ fn get_proposal_module_approver_instantiate( pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&ApproverInstantiateMsg { + msg: to_json_binary(&ApproverInstantiateMsg { pre_propose_approval_contract, }) .unwrap(), @@ -185,7 +185,7 @@ fn setup_default_test( let core_addr = instantiate_with_cw4_groups_governance( app, dps_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), @@ -239,7 +239,7 @@ fn setup_default_test( let _approver_core_addr = instantiate_with_cw4_groups_governance( app, dps_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), @@ -1078,8 +1078,8 @@ fn test_set_version() { false, ); - let info: ContractVersion = from_slice( - &app.wrap() + let info: ContractVersion = from_json( + app.wrap() .query_wasm_raw(pre_propose_approver, "contract_info".as_bytes()) .unwrap() .unwrap(), diff --git a/contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs b/contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs index 2de6ee79c..241bb039f 100644 --- a/contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{coins, from_slice, to_binary, Addr, Coin, Decimal, Empty, Uint128}; +use cosmwasm_std::{coins, from_json, to_json_binary, Addr, Coin, Decimal, Empty, Uint128}; use cpm::query::ProposalResponse; use cw2::ContractVersion; use cw20::Cw20Coin; @@ -65,7 +65,7 @@ fn get_default_proposal_module_instantiate( pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info, open_proposal_submission, extension: Empty::default(), @@ -122,7 +122,7 @@ fn setup_default_test( let core_addr = instantiate_with_cw4_groups_governance( app, cpm_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), @@ -800,8 +800,8 @@ fn test_set_version() { false, ); - let info: ContractVersion = from_slice( - &app.wrap() + let info: ContractVersion = from_json( + app.wrap() .query_wasm_raw(pre_propose, "contract_info".as_bytes()) .unwrap() .unwrap(), @@ -1047,7 +1047,7 @@ fn test_instantiate_with_zero_native_deposit() { pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: DepositToken::Token { denom: UncheckedDenom::Native("ujuno".to_string()), @@ -1072,7 +1072,7 @@ fn test_instantiate_with_zero_native_deposit() { instantiate_with_cw4_groups_governance( &mut app, cpm_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), @@ -1109,7 +1109,7 @@ fn test_instantiate_with_zero_cw20_deposit() { pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: DepositToken::Token { denom: UncheckedDenom::Cw20(cw20_addr.into_string()), @@ -1134,7 +1134,7 @@ fn test_instantiate_with_zero_cw20_deposit() { instantiate_with_cw4_groups_governance( &mut app, cpm_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), diff --git a/contracts/pre-propose/dao-pre-propose-single/src/tests.rs b/contracts/pre-propose/dao-pre-propose-single/src/tests.rs index fefc69fc3..0cd459811 100644 --- a/contracts/pre-propose/dao-pre-propose-single/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-single/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{coins, from_slice, to_binary, Addr, Coin, Empty, Uint128}; +use cosmwasm_std::{coins, from_json, to_json_binary, Addr, Coin, Empty, Uint128}; use cw2::ContractVersion; use cw20::Cw20Coin; use cw_denom::UncheckedDenom; @@ -63,7 +63,7 @@ fn get_default_proposal_module_instantiate( pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info, open_proposal_submission, extension: Empty::default(), @@ -120,7 +120,7 @@ fn setup_default_test( let core_addr = instantiate_with_cw4_groups_governance( app, dps_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), @@ -766,8 +766,8 @@ fn test_set_version() { false, ); - let info: ContractVersion = from_slice( - &app.wrap() + let info: ContractVersion = from_json( + app.wrap() .query_wasm_raw(pre_propose, "contract_info".as_bytes()) .unwrap() .unwrap(), @@ -983,7 +983,7 @@ fn test_instantiate_with_zero_native_deposit() { pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: DepositToken::Token { denom: UncheckedDenom::Native("ujuno".to_string()), @@ -1008,7 +1008,7 @@ fn test_instantiate_with_zero_native_deposit() { instantiate_with_cw4_groups_governance( &mut app, dps_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), @@ -1045,7 +1045,7 @@ fn test_instantiate_with_zero_cw20_deposit() { pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: DepositToken::Token { denom: UncheckedDenom::Cw20(cw20_addr.into_string()), @@ -1070,7 +1070,7 @@ fn test_instantiate_with_zero_cw20_deposit() { instantiate_with_cw4_groups_governance( &mut app, dps_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), diff --git a/contracts/proposal/dao-proposal-condorcet/src/contract.rs b/contracts/proposal/dao-proposal-condorcet/src/contract.rs index a29603609..f6b5406f3 100644 --- a/contracts/proposal/dao-proposal-condorcet/src/contract.rs +++ b/contracts/proposal/dao-proposal-condorcet/src/contract.rs @@ -1,7 +1,7 @@ #[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; @@ -252,12 +252,12 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { let mut proposal = PROPOSAL.load(deps.storage, id)?; let tally = TALLY.load(deps.storage, id)?; proposal.update_status(&env.block, &tally); - to_binary(&ProposalResponse { proposal, tally }) + to_json_binary(&ProposalResponse { proposal, tally }) } - QueryMsg::Config {} => to_binary(&CONFIG.load(deps.storage)?), - QueryMsg::NextProposalId {} => to_binary(&next_proposal_id(deps.storage)?), - QueryMsg::Dao {} => to_binary(&DAO.load(deps.storage)?), - QueryMsg::Info {} => to_binary(&dao_interface::voting::InfoResponse { + QueryMsg::Config {} => to_json_binary(&CONFIG.load(deps.storage)?), + QueryMsg::NextProposalId {} => to_json_binary(&next_proposal_id(deps.storage)?), + QueryMsg::Dao {} => to_json_binary(&DAO.load(deps.storage)?), + QueryMsg::Info {} => to_json_binary(&dao_interface::voting::InfoResponse { info: cw2::get_contract_version(deps.storage)?, }), } diff --git a/contracts/proposal/dao-proposal-condorcet/src/proposal.rs b/contracts/proposal/dao-proposal-condorcet/src/proposal.rs index 155b90cc2..bd2f82486 100644 --- a/contracts/proposal/dao-proposal-condorcet/src/proposal.rs +++ b/contracts/proposal/dao-proposal-condorcet/src/proposal.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{to_binary, Addr, BlockInfo, StdResult, SubMsg, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, BlockInfo, StdResult, SubMsg, Uint128, WasmMsg}; use cw_utils::Expiration; use dao_voting::{ reply::mask_proposal_execution_proposal_id, threshold::PercentageThreshold, @@ -161,7 +161,7 @@ impl Proposal { let msgs = self.choices[winner as usize].msgs.clone(); let core_exec = WasmMsg::Execute { contract_addr: dao.into_string(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { msgs })?, + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { msgs })?, funds: vec![], }; Ok(if self.close_on_execution_failure { diff --git a/contracts/proposal/dao-proposal-condorcet/src/testing/proposals.rs b/contracts/proposal/dao-proposal-condorcet/src/testing/proposals.rs index 151790ef8..6c39f4b6e 100644 --- a/contracts/proposal/dao-proposal-condorcet/src/testing/proposals.rs +++ b/contracts/proposal/dao-proposal-condorcet/src/testing/proposals.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, WasmMsg}; +use cosmwasm_std::{to_json_binary, WasmMsg}; use cw_utils::Duration; use crate::{ @@ -171,7 +171,7 @@ fn test_proposal_set_config() { suite.sender(), vec![vec![WasmMsg::Execute { contract_addr: suite.condorcet.to_string(), - msg: to_binary(&ExecuteMsg::SetConfig(UncheckedConfig { + msg: to_json_binary(&ExecuteMsg::SetConfig(UncheckedConfig { quorum: config.quorum, voting_period: config.voting_period, min_voting_period: None, @@ -194,7 +194,7 @@ fn test_proposal_set_config() { suite.sender(), vec![vec![WasmMsg::Execute { contract_addr: suite.condorcet.to_string(), - msg: to_binary(&ExecuteMsg::SetConfig(UncheckedConfig { + msg: to_json_binary(&ExecuteMsg::SetConfig(UncheckedConfig { quorum: config.quorum, voting_period: config.voting_period, min_voting_period: Some(Duration::Height(10)), diff --git a/contracts/proposal/dao-proposal-condorcet/src/testing/suite.rs b/contracts/proposal/dao-proposal-condorcet/src/testing/suite.rs index 9f9f945be..79d18154f 100644 --- a/contracts/proposal/dao-proposal-condorcet/src/testing/suite.rs +++ b/contracts/proposal/dao-proposal-condorcet/src/testing/suite.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{coins, to_binary, Addr, BankMsg, CosmosMsg, Decimal}; +use cosmwasm_std::{coins, to_json_binary, Addr, BankMsg, CosmosMsg, Decimal}; use cw_multi_test::{next_block, App, Executor}; use cw_utils::Duration; use dao_interface::{ @@ -88,7 +88,7 @@ impl SuiteBuilder { automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: cw4_voting_id, - msg: to_binary(&dao_voting_cw4::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw4::msg::InstantiateMsg { group_contract: GroupContract::New { cw4_group_code_id: cw4_id, initial_members, @@ -101,7 +101,7 @@ impl SuiteBuilder { }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: condorcet_id, - msg: to_binary(&self.instantiate).unwrap(), + msg: to_json_binary(&self.instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "condorcet module".to_string(), diff --git a/contracts/proposal/dao-proposal-multiple/src/contract.rs b/contracts/proposal/dao-proposal-multiple/src/contract.rs index 2308858d3..c1af47ced 100644 --- a/contracts/proposal/dao-proposal-multiple/src/contract.rs +++ b/contracts/proposal/dao-proposal-multiple/src/contract.rs @@ -1,8 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, StdResult, - Storage, SubMsg, WasmMsg, + to_json_binary, Addr, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, + StdResult, Storage, SubMsg, WasmMsg, }; use cw2::set_contract_version; @@ -239,7 +239,7 @@ pub fn execute_propose( // // `to_vec` is the method used by cosmwasm to convert a struct // into it's byte representation in storage. - let proposal_size = cosmwasm_std::to_vec(&proposal)?.len() as u64; + let proposal_size = cosmwasm_std::to_json_vec(&proposal)?.len() as u64; if proposal_size > MAX_PROPOSAL_SIZE { return Err(ContractError::ProposalTooLarge { size: proposal_size, @@ -400,7 +400,7 @@ pub fn execute_execute( let response = if !winning_choice.msgs.is_empty() { let execute_message = WasmMsg::Execute { contract_addr: config.dao.to_string(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { msgs: winning_choice.msgs, })?, funds: vec![], @@ -432,7 +432,7 @@ pub fn execute_execute( let hooks = match proposal_creation_policy { ProposalCreationPolicy::Anyone {} => hooks, ProposalCreationPolicy::Module { addr } => { - let msg = to_binary(&PreProposeMsg::ProposalCompletedHook { + let msg = to_json_binary(&PreProposeMsg::ProposalCompletedHook { proposal_id, new_status: prop.status, })?; @@ -491,7 +491,7 @@ pub fn execute_close( let hooks = match proposal_creation_policy { ProposalCreationPolicy::Anyone {} => hooks, ProposalCreationPolicy::Module { addr } => { - let msg = to_binary(&PreProposeMsg::ProposalCompletedHook { + let msg = to_json_binary(&PreProposeMsg::ProposalCompletedHook { proposal_id, new_status: prop.status, })?; @@ -746,30 +746,30 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { limit, } => query_reverse_proposals(deps, env, start_before, limit), QueryMsg::ProposalCreationPolicy {} => query_creation_policy(deps), - QueryMsg::ProposalHooks {} => to_binary(&PROPOSAL_HOOKS.query_hooks(deps)?), - QueryMsg::VoteHooks {} => to_binary(&VOTE_HOOKS.query_hooks(deps)?), + QueryMsg::ProposalHooks {} => to_json_binary(&PROPOSAL_HOOKS.query_hooks(deps)?), + QueryMsg::VoteHooks {} => to_json_binary(&VOTE_HOOKS.query_hooks(deps)?), QueryMsg::Dao {} => query_dao(deps), } } pub fn query_config(deps: Deps) -> StdResult { let config = CONFIG.load(deps.storage)?; - to_binary(&config) + to_json_binary(&config) } pub fn query_dao(deps: Deps) -> StdResult { let config = CONFIG.load(deps.storage)?; - to_binary(&config.dao) + to_json_binary(&config.dao) } pub fn query_proposal(deps: Deps, env: Env, id: u64) -> StdResult { let proposal = PROPOSALS.load(deps.storage, id)?; - to_binary(&proposal.into_response(&env.block, id)?) + to_json_binary(&proposal.into_response(&env.block, id)?) } pub fn query_creation_policy(deps: Deps) -> StdResult { let policy = CREATION_POLICY.load(deps.storage)?; - to_binary(&policy) + to_json_binary(&policy) } pub fn query_list_proposals( @@ -788,7 +788,7 @@ pub fn query_list_proposals( .map(|(id, proposal)| proposal.into_response(&env.block, id)) .collect::>>()?; - to_binary(&ProposalListResponse { proposals: props }) + to_json_binary(&ProposalListResponse { proposals: props }) } pub fn query_reverse_proposals( @@ -807,16 +807,16 @@ pub fn query_reverse_proposals( .map(|(id, proposal)| proposal.into_response(&env.block, id)) .collect::>>()?; - to_binary(&ProposalListResponse { proposals: props }) + to_json_binary(&ProposalListResponse { proposals: props }) } pub fn query_next_proposal_id(deps: Deps) -> StdResult { - to_binary(&next_proposal_id(deps.storage)?) + to_json_binary(&next_proposal_id(deps.storage)?) } pub fn query_proposal_count(deps: Deps) -> StdResult { let proposal_count = PROPOSAL_COUNT.load(deps.storage)?; - to_binary(&proposal_count) + to_json_binary(&proposal_count) } pub fn query_vote(deps: Deps, proposal_id: u64, voter: String) -> StdResult { @@ -828,7 +828,7 @@ pub fn query_vote(deps: Deps, proposal_id: u64, voter: String) -> StdResult>>()?; - to_binary(&VoteListResponse { votes }) + to_json_binary(&VoteListResponse { votes }) } pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/proposal/dao-proposal-multiple/src/testing/adversarial_tests.rs b/contracts/proposal/dao-proposal-multiple/src/testing/adversarial_tests.rs index fe09e69d1..11f052cd6 100644 --- a/contracts/proposal/dao-proposal-multiple/src/testing/adversarial_tests.rs +++ b/contracts/proposal/dao-proposal-multiple/src/testing/adversarial_tests.rs @@ -9,7 +9,7 @@ use crate::testing::queries::{ }; use crate::testing::tests::{get_pre_propose_info, ALTERNATIVE_ADDR, CREATOR_ADDR}; use crate::ContractError; -use cosmwasm_std::{to_binary, Addr, CosmosMsg, Decimal, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, CosmosMsg, Decimal, Uint128, WasmMsg}; use cw20::Cw20Coin; use cw_multi_test::{next_block, App, Executor}; use cw_utils::Duration; @@ -307,7 +307,7 @@ pub fn test_allow_voting_after_proposal_execution_pre_expiration_cw20() { recipient: CREATOR_ADDR.to_string(), amount: Uint128::new(100_000_000), }; - let binary_msg = to_binary(&msg).unwrap(); + let binary_msg = to_json_binary(&msg).unwrap(); let options = vec![ MultipleChoiceOption { diff --git a/contracts/proposal/dao-proposal-multiple/src/testing/instantiate.rs b/contracts/proposal/dao-proposal-multiple/src/testing/instantiate.rs index f6188a6f0..3a0dc89e2 100644 --- a/contracts/proposal/dao-proposal-multiple/src/testing/instantiate.rs +++ b/contracts/proposal/dao-proposal-multiple/src/testing/instantiate.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, Addr, Coin, Empty, Uint128}; +use cosmwasm_std::{to_json_binary, Addr, Coin, Empty, Uint128}; use cw20::Cw20Coin; use cw_multi_test::{next_block, App, BankSudo, ContractWrapper, Executor, SudoMsg}; use cw_utils::Duration; @@ -32,7 +32,7 @@ fn get_pre_propose_info( PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_contract, - msg: to_binary(&cppm::InstantiateMsg { + msg: to_json_binary(&cppm::InstantiateMsg { deposit_info, open_proposal_submission, extension: Empty::default(), @@ -148,7 +148,7 @@ pub fn _instantiate_with_staked_cw721_governance( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: cw721_stake_id, - msg: to_binary(&dao_voting_cw721_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw721_staked::msg::InstantiateMsg { unstaking_duration: None, nft_contract: dao_voting_cw721_staked::msg::NftContract::Existing { address: nft_address.to_string(), @@ -162,7 +162,7 @@ pub fn _instantiate_with_staked_cw721_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -211,7 +211,7 @@ pub fn _instantiate_with_staked_cw721_governance( &cw721_base::msg::ExecuteMsg::, Empty>::SendNft { contract: staking_addr.to_string(), token_id: format!("{address}_{i}"), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -267,7 +267,7 @@ pub fn _instantiate_with_native_staked_balances_governance( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: native_stake_id, - msg: to_binary(&dao_voting_token_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_token_staked::msg::InstantiateMsg { token_info: dao_voting_token_staked::msg::TokenInfo::Existing { denom: "ujuno".to_string(), }, @@ -281,7 +281,7 @@ pub fn _instantiate_with_native_staked_balances_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -379,7 +379,7 @@ pub fn instantiate_with_cw20_balances_governance( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw20_balance::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_balance::msg::InstantiateMsg { token_info: dao_voting_cw20_balance::msg::TokenInfo::New { code_id: cw20_id, label: "DAO DAO governance token".to_string(), @@ -397,7 +397,7 @@ pub fn instantiate_with_cw20_balances_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -461,7 +461,7 @@ pub fn instantiate_with_staked_balances_governance( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: staked_balances_voting_id, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { active_threshold: None, token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: cw20_id, @@ -483,7 +483,7 @@ pub fn instantiate_with_staked_balances_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -535,7 +535,7 @@ pub fn instantiate_with_staked_balances_governance( &cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount, - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -598,7 +598,7 @@ pub fn instantiate_with_multiple_staked_balances_governance( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: staked_balances_voting_id, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { active_threshold: Some(AbsoluteCount { count: Uint128::one(), }), @@ -622,7 +622,7 @@ pub fn instantiate_with_multiple_staked_balances_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -674,7 +674,7 @@ pub fn instantiate_with_multiple_staked_balances_governance( &cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount, - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -715,7 +715,7 @@ pub fn instantiate_with_staking_active_threshold( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: cw20_id, label: "DAO DAO governance token".to_string(), @@ -737,7 +737,7 @@ pub fn instantiate_with_staking_active_threshold( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module".to_string(), @@ -803,7 +803,7 @@ pub fn _instantiate_with_cw4_groups_governance( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw4::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw4::msg::InstantiateMsg { group_contract: GroupContract::New { cw4_group_code_id: cw4_id, initial_members: initial_weights, @@ -816,7 +816,7 @@ pub fn _instantiate_with_cw4_groups_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module".to_string(), diff --git a/contracts/proposal/dao-proposal-multiple/src/testing/tests.rs b/contracts/proposal/dao-proposal-multiple/src/testing/tests.rs index 9f1749423..e1b8dddde 100644 --- a/contracts/proposal/dao-proposal-multiple/src/testing/tests.rs +++ b/contracts/proposal/dao-proposal-multiple/src/testing/tests.rs @@ -1,4 +1,6 @@ -use cosmwasm_std::{to_binary, Addr, Coin, CosmosMsg, Decimal, Empty, Timestamp, Uint128, WasmMsg}; +use cosmwasm_std::{ + to_json_binary, Addr, Coin, CosmosMsg, Decimal, Empty, Timestamp, Uint128, WasmMsg, +}; use cw20::Cw20Coin; use cw_denom::{CheckedDenom, UncheckedDenom}; use cw_hooks::HooksResponse; @@ -89,7 +91,7 @@ pub fn get_pre_propose_info( PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_contract, - msg: to_binary(&cppm::InstantiateMsg { + msg: to_json_binary(&cppm::InstantiateMsg { deposit_info, open_proposal_submission, extension: Empty::default(), @@ -443,7 +445,7 @@ fn test_propose_with_messages() { let wasm_msg = WasmMsg::Execute { contract_addr: govmod.to_string(), - msg: to_binary(&config_msg).unwrap(), + msg: to_json_binary(&config_msg).unwrap(), funds: vec![], }; @@ -1728,7 +1730,7 @@ fn test_cant_execute_not_member_when_proposal_created() { &cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(10), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -2682,7 +2684,7 @@ fn test_active_threshold_absolute() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(100), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract(Addr::unchecked(CREATOR_ADDR), token_contract, &msg, &[]) .unwrap(); @@ -2810,7 +2812,7 @@ fn test_active_threshold_percent() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(20000000), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract(Addr::unchecked(CREATOR_ADDR), token_contract, &msg, &[]) .unwrap(); @@ -2901,7 +2903,7 @@ fn test_active_threshold_none() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(2000), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract(Addr::unchecked(CREATOR_ADDR), token_contract, &msg, &[]) .unwrap(); @@ -3578,7 +3580,7 @@ fn test_close_failed_proposal() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(2000), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract( Addr::unchecked(CREATOR_ADDR), @@ -3592,7 +3594,7 @@ fn test_close_failed_proposal() { let msg = cw20::Cw20ExecuteMsg::Burn { amount: Uint128::new(2000), }; - let binary_msg = to_binary(&msg).unwrap(); + let binary_msg = to_json_binary(&msg).unwrap(); let options = vec![ MultipleChoiceOption { @@ -3674,7 +3676,7 @@ fn test_close_failed_proposal() { description: "Disable closing failed proposals".to_string(), msgs: vec![WasmMsg::Execute { contract_addr: govmod.to_string(), - msg: to_binary(&ExecuteMsg::UpdateConfig { + msg: to_json_binary(&ExecuteMsg::UpdateConfig { voting_strategy: VotingStrategy::SingleChoice { quorum }, max_voting_period: original.max_voting_period, min_voting_period: original.min_voting_period, @@ -3836,7 +3838,7 @@ fn test_no_double_refund_on_execute_fail_and_close() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(1), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract( Addr::unchecked(CREATOR_ADDR), @@ -3864,7 +3866,7 @@ fn test_no_double_refund_on_execute_fail_and_close() { let msg = cw20::Cw20ExecuteMsg::Burn { amount: Uint128::new(2000), }; - let binary_msg = to_binary(&msg).unwrap(); + let binary_msg = to_json_binary(&msg).unwrap(); // Increase allowance to pay the proposal deposit. app.execute_contract( diff --git a/contracts/proposal/dao-proposal-single/src/contract.rs b/contracts/proposal/dao-proposal-single/src/contract.rs index cf3ecf33d..93e73eb76 100644 --- a/contracts/proposal/dao-proposal-single/src/contract.rs +++ b/contracts/proposal/dao-proposal-single/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Order, Reply, + to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Order, Reply, Response, StdResult, Storage, SubMsg, WasmMsg, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; @@ -235,7 +235,7 @@ pub fn execute_propose( // // `to_vec` is the method used by cosmwasm to convert a struct // into it's byte representation in storage. - let proposal_size = cosmwasm_std::to_vec(&proposal)?.len() as u64; + let proposal_size = cosmwasm_std::to_json_vec(&proposal)?.len() as u64; if proposal_size > MAX_PROPOSAL_SIZE { return Err(ContractError::ProposalTooLarge { size: proposal_size, @@ -295,7 +295,7 @@ pub fn execute_execute( if !prop.msgs.is_empty() { let execute_message = WasmMsg::Execute { contract_addr: config.dao.to_string(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { msgs: prop.msgs, })?, funds: vec![], @@ -326,7 +326,7 @@ pub fn execute_execute( let hooks = match proposal_creation_policy { ProposalCreationPolicy::Anyone {} => hooks, ProposalCreationPolicy::Module { addr } => { - let msg = to_binary(&PreProposeHookMsg::ProposalCompletedHook { + let msg = to_json_binary(&PreProposeHookMsg::ProposalCompletedHook { proposal_id, new_status: prop.status, })?; @@ -515,7 +515,7 @@ pub fn execute_close( let hooks = match proposal_creation_policy { ProposalCreationPolicy::Anyone {} => hooks, ProposalCreationPolicy::Module { addr } => { - let msg = to_binary(&PreProposeHookMsg::ProposalCompletedHook { + let msg = to_json_binary(&PreProposeHookMsg::ProposalCompletedHook { proposal_id, new_status: prop.status, })?; @@ -730,29 +730,29 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { limit, } => query_reverse_proposals(deps, env, start_before, limit), QueryMsg::ProposalCreationPolicy {} => query_creation_policy(deps), - QueryMsg::ProposalHooks {} => to_binary(&PROPOSAL_HOOKS.query_hooks(deps)?), - QueryMsg::VoteHooks {} => to_binary(&VOTE_HOOKS.query_hooks(deps)?), + QueryMsg::ProposalHooks {} => to_json_binary(&PROPOSAL_HOOKS.query_hooks(deps)?), + QueryMsg::VoteHooks {} => to_json_binary(&VOTE_HOOKS.query_hooks(deps)?), } } pub fn query_config(deps: Deps) -> StdResult { let config = CONFIG.load(deps.storage)?; - to_binary(&config) + to_json_binary(&config) } pub fn query_dao(deps: Deps) -> StdResult { let config = CONFIG.load(deps.storage)?; - to_binary(&config.dao) + to_json_binary(&config.dao) } pub fn query_proposal(deps: Deps, env: Env, id: u64) -> StdResult { let proposal = PROPOSALS.load(deps.storage, id)?; - to_binary(&proposal.into_response(&env.block, id)) + to_json_binary(&proposal.into_response(&env.block, id)) } pub fn query_creation_policy(deps: Deps) -> StdResult { let policy = CREATION_POLICY.load(deps.storage)?; - to_binary(&policy) + to_json_binary(&policy) } pub fn query_list_proposals( @@ -771,7 +771,7 @@ pub fn query_list_proposals( .map(|(id, proposal)| proposal.into_response(&env.block, id)) .collect(); - to_binary(&ProposalListResponse { proposals: props }) + to_json_binary(&ProposalListResponse { proposals: props }) } pub fn query_reverse_proposals( @@ -790,16 +790,16 @@ pub fn query_reverse_proposals( .map(|(id, proposal)| proposal.into_response(&env.block, id)) .collect(); - to_binary(&ProposalListResponse { proposals: props }) + to_json_binary(&ProposalListResponse { proposals: props }) } pub fn query_proposal_count(deps: Deps) -> StdResult { let proposal_count = PROPOSAL_COUNT.load(deps.storage)?; - to_binary(&proposal_count) + to_json_binary(&proposal_count) } pub fn query_next_proposal_id(deps: Deps) -> StdResult { - to_binary(&next_proposal_id(deps.storage)?) + to_json_binary(&next_proposal_id(deps.storage)?) } pub fn query_vote(deps: Deps, proposal_id: u64, voter: String) -> StdResult { @@ -811,7 +811,7 @@ pub fn query_vote(deps: Deps, proposal_id: u64, voter: String) -> StdResult>>()?; - to_binary(&VoteListResponse { votes }) + to_json_binary(&VoteListResponse { votes }) } pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/proposal/dao-proposal-single/src/testing/adversarial_tests.rs b/contracts/proposal/dao-proposal-single/src/testing/adversarial_tests.rs index 5d32804b9..19d3900e9 100644 --- a/contracts/proposal/dao-proposal-single/src/testing/adversarial_tests.rs +++ b/contracts/proposal/dao-proposal-single/src/testing/adversarial_tests.rs @@ -11,7 +11,7 @@ use crate::testing::{ }, queries::{query_balance_cw20, query_dao_token, query_proposal, query_single_proposal_module}, }; -use cosmwasm_std::{to_binary, Addr, CosmosMsg, Decimal, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, CosmosMsg, Decimal, Uint128, WasmMsg}; use cw20::Cw20Coin; use cw_multi_test::{next_block, App}; use cw_utils::Duration; @@ -301,7 +301,7 @@ pub fn test_passed_prop_state_remains_after_vote_swing() { recipient: "threshold".to_string(), amount: Uint128::new(100_000_000), }; - let binary_msg = to_binary(&msg).unwrap(); + let binary_msg = to_json_binary(&msg).unwrap(); mint_cw20s(&mut app, &gov_token, &core_addr, CREATOR_ADDR, 10_000_000); let proposal_id = make_proposal( diff --git a/contracts/proposal/dao-proposal-single/src/testing/instantiate.rs b/contracts/proposal/dao-proposal-single/src/testing/instantiate.rs index b9e9d74de..3fd485f62 100644 --- a/contracts/proposal/dao-proposal-single/src/testing/instantiate.rs +++ b/contracts/proposal/dao-proposal-single/src/testing/instantiate.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, Addr, Coin, Decimal, Empty, Uint128}; +use cosmwasm_std::{to_json_binary, Addr, Coin, Decimal, Empty, Uint128}; use cw20::Cw20Coin; use cw_multi_test::{next_block, App, BankSudo, Executor, SudoMsg}; @@ -34,7 +34,7 @@ pub(crate) fn get_pre_propose_info( PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_contract, - msg: to_binary(&cppbps::InstantiateMsg { + msg: to_json_binary(&cppbps::InstantiateMsg { deposit_info, open_proposal_submission, extension: Empty::default(), @@ -146,7 +146,7 @@ pub(crate) fn instantiate_with_staked_cw721_governance( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: cw721_stake_id, - msg: to_binary(&dao_voting_cw721_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw721_staked::msg::InstantiateMsg { unstaking_duration: None, nft_contract: dao_voting_cw721_staked::msg::NftContract::Existing { address: nft_address.to_string(), @@ -160,7 +160,7 @@ pub(crate) fn instantiate_with_staked_cw721_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -208,7 +208,7 @@ pub(crate) fn instantiate_with_staked_cw721_governance( &cw721_base::msg::ExecuteMsg::SendNft::, Empty> { contract: staking_addr.to_string(), token_id: format!("{address}_{i}"), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -265,7 +265,7 @@ pub(crate) fn instantiate_with_native_staked_balances_governance( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: native_stake_id, - msg: to_binary(&dao_voting_token_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_token_staked::msg::InstantiateMsg { token_info: dao_voting_token_staked::msg::TokenInfo::Existing { denom: "ujuno".to_string(), }, @@ -279,7 +279,7 @@ pub(crate) fn instantiate_with_native_staked_balances_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -378,7 +378,7 @@ pub(crate) fn instantiate_with_staked_balances_governance( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: staked_balances_voting_id, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { active_threshold: None, token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: cw20_id, @@ -400,7 +400,7 @@ pub(crate) fn instantiate_with_staked_balances_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -451,7 +451,7 @@ pub(crate) fn instantiate_with_staked_balances_governance( &cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount, - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -493,7 +493,7 @@ pub(crate) fn instantiate_with_staking_active_threshold( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: cw20_id, label: "DAO DAO governance token".to_string(), @@ -515,7 +515,7 @@ pub(crate) fn instantiate_with_staking_active_threshold( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module".to_string(), @@ -581,7 +581,7 @@ pub(crate) fn instantiate_with_cw4_groups_governance( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw4::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw4::msg::InstantiateMsg { group_contract: GroupContract::New { cw4_group_code_id: cw4_id, initial_members: initial_weights, @@ -594,7 +594,7 @@ pub(crate) fn instantiate_with_cw4_groups_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module".to_string(), diff --git a/contracts/proposal/dao-proposal-single/src/testing/migration_tests.rs b/contracts/proposal/dao-proposal-single/src/testing/migration_tests.rs index 1e3aa7c0c..3d68ffb7a 100644 --- a/contracts/proposal/dao-proposal-single/src/testing/migration_tests.rs +++ b/contracts/proposal/dao-proposal-single/src/testing/migration_tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, Addr, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, Uint128, WasmMsg}; use cw20::Cw20Coin; use cw_multi_test::{next_block, App, Executor}; use dao_interface::query::{GetItemResponse, ProposalModuleCountResponse}; @@ -68,7 +68,7 @@ fn test_v1_v2_full_migration() { automatically_add_cw721s: true, voting_module_instantiate_info: cw_core_v1::msg::ModuleInstantiateInfo { code_id: voting_code, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { active_threshold: None, token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: cw20_code, @@ -89,7 +89,7 @@ fn test_v1_v2_full_migration() { }, proposal_modules_instantiate_info: vec![cw_core_v1::msg::ModuleInstantiateInfo { code_id: proposal_code, - msg: to_binary(&cw_proposal_single_v1::msg::InstantiateMsg { + msg: to_json_binary(&cw_proposal_single_v1::msg::InstantiateMsg { threshold: voting_v1::Threshold::AbsolutePercentage { percentage: voting_v1::PercentageThreshold::Majority {}, }, @@ -152,7 +152,7 @@ fn test_v1_v2_full_migration() { &cw20::Cw20ExecuteMsg::Send { contract: staking.into_string(), amount: Uint128::new(1), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -188,7 +188,7 @@ fn test_v1_v2_full_migration() { description: "d".to_string(), msgs: vec![WasmMsg::Execute { contract_addr: core.to_string(), - msg: to_binary(&cw_core_v1::msg::ExecuteMsg::UpdateCw20List { + msg: to_json_binary(&cw_core_v1::msg::ExecuteMsg::UpdateCw20List { to_add: vec![token.to_string()], to_remove: vec![], }) @@ -247,7 +247,7 @@ fn test_v1_v2_full_migration() { description: "d".to_string(), msgs: vec![WasmMsg::Execute { contract_addr: token.to_string(), - msg: to_binary(&cw20::Cw20ExecuteMsg::Transfer { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::Transfer { recipient: sender.to_string(), // more tokens than the DAO posseses. amount: Uint128::new(101), @@ -316,7 +316,7 @@ fn test_v1_v2_full_migration() { WasmMsg::Migrate { contract_addr: core.to_string(), new_code_id: v2_core_code, - msg: to_binary(&dao_interface::msg::MigrateMsg::FromV1 { + msg: to_json_binary(&dao_interface::msg::MigrateMsg::FromV1 { dao_uri: Some("dao-uri".to_string()), params: None, }) @@ -326,7 +326,7 @@ fn test_v1_v2_full_migration() { WasmMsg::Migrate { contract_addr: proposal.to_string(), new_code_id: v2_proposal_code, - msg: to_binary(&crate::msg::MigrateMsg::FromV1 { + msg: to_json_binary(&crate::msg::MigrateMsg::FromV1 { close_proposal_on_execution_failure: true, pre_propose_info, }) @@ -413,7 +413,7 @@ fn test_v1_v2_full_migration() { sender.as_str(), vec![WasmMsg::Execute { contract_addr: core.to_string(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::UpdateCw20List { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::UpdateCw20List { to_add: vec![], to_remove: vec![token.into_string()], }) diff --git a/contracts/proposal/dao-proposal-single/src/testing/tests.rs b/contracts/proposal/dao-proposal-single/src/testing/tests.rs index 8634243dd..a5cc7aa01 100644 --- a/contracts/proposal/dao-proposal-single/src/testing/tests.rs +++ b/contracts/proposal/dao-proposal-single/src/testing/tests.rs @@ -1,8 +1,8 @@ use cosmwasm_std::{ coins, testing::{mock_dependencies, mock_env}, - to_binary, Addr, Attribute, BankMsg, Binary, ContractInfoResponse, CosmosMsg, Decimal, Empty, - Reply, StdError, SubMsgResult, Uint128, WasmMsg, WasmQuery, + to_json_binary, Addr, Attribute, BankMsg, Binary, ContractInfoResponse, CosmosMsg, Decimal, + Empty, Reply, StdError, SubMsgResult, Uint128, WasmMsg, WasmQuery, }; use cw2::ContractVersion; use cw20::Cw20Coin; @@ -321,7 +321,7 @@ fn test_proposal_message_execution() { vec![ WasmMsg::Execute { contract_addr: gov_token.to_string(), - msg: to_binary(&cw20::Cw20ExecuteMsg::Mint { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::Mint { recipient: CREATOR_ADDR.to_string(), amount: Uint128::new(10_000_000), }) @@ -540,7 +540,7 @@ fn test_cant_execute_not_member_when_proposal_created() { &cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(10_000_000), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -578,7 +578,7 @@ fn test_update_config() { CREATOR_ADDR, vec![WasmMsg::Execute { contract_addr: proposal_module.to_string(), - msg: to_binary(&ExecuteMsg::UpdateConfig { + msg: to_json_binary(&ExecuteMsg::UpdateConfig { threshold: Threshold::AbsoluteCount { threshold: Uint128::new(10_000), }, @@ -890,7 +890,7 @@ fn test_active_threshold_absolute() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(100), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract(Addr::unchecked(CREATOR_ADDR), gov_token, &msg, &[]) .unwrap(); @@ -971,7 +971,7 @@ fn test_active_threshold_percent() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(20_000_000), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract(Addr::unchecked(CREATOR_ADDR), gov_token, &msg, &[]) .unwrap(); @@ -1545,7 +1545,7 @@ fn test_migrate_from_compatible() { CosmosMsg::Wasm(WasmMsg::Migrate { contract_addr: proposal_module.to_string(), new_code_id, - msg: to_binary(&MigrateMsg::FromCompatible {}).unwrap(), + msg: to_json_binary(&MigrateMsg::FromCompatible {}).unwrap(), }), ) .unwrap(); @@ -1609,7 +1609,7 @@ fn test_migrate_from_v1() { automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: staked_balances_voting_id, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { active_threshold: None, token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: cw20_id, @@ -1631,7 +1631,7 @@ fn test_migrate_from_v1() { }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: v1_proposal_single_code, - msg: to_binary(&instantiate).unwrap(), + msg: to_json_binary(&instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -1682,7 +1682,7 @@ fn test_migrate_from_v1() { &cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount, - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -1730,7 +1730,7 @@ fn test_migrate_from_v1() { pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_single, - msg: to_binary(&dao_pre_propose_single::InstantiateMsg { + msg: to_json_binary(&dao_pre_propose_single::InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: dao_voting::deposit::DepositToken::VotingModuleToken {}, amount: Uint128::new(1), @@ -1752,7 +1752,7 @@ fn test_migrate_from_v1() { CosmosMsg::Wasm(WasmMsg::Migrate { contract_addr: proposal_module.to_string(), new_code_id: v2_proposal_single, - msg: to_binary(&migrate_msg).unwrap(), + msg: to_json_binary(&migrate_msg).unwrap(), }), ) .unwrap_err() @@ -1770,7 +1770,7 @@ fn test_migrate_from_v1() { CosmosMsg::Wasm(WasmMsg::Migrate { contract_addr: proposal_module.to_string(), new_code_id: v2_proposal_single, - msg: to_binary(&migrate_msg).unwrap(), + msg: to_json_binary(&migrate_msg).unwrap(), }), ) .unwrap(); @@ -1798,7 +1798,7 @@ fn test_migrate_from_v1() { CosmosMsg::Wasm(WasmMsg::Migrate { contract_addr: proposal_module.to_string(), new_code_id: v2_proposal_single, - msg: to_binary(&migrate_msg).unwrap(), + msg: to_json_binary(&migrate_msg).unwrap(), }), ) .unwrap_err() @@ -2397,11 +2397,11 @@ fn test_update_pre_propose_module() { CREATOR_ADDR, vec![WasmMsg::Execute { contract_addr: proposal_module.to_string(), - msg: to_binary(&ExecuteMsg::UpdatePreProposeInfo { + msg: to_json_binary(&ExecuteMsg::UpdatePreProposeInfo { info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&dao_pre_propose_single::InstantiateMsg { + msg: to_json_binary(&dao_pre_propose_single::InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: dao_voting::deposit::DepositToken::VotingModuleToken {}, amount: Uint128::new(1), @@ -2495,7 +2495,8 @@ fn test_update_pre_propose_module() { CREATOR_ADDR, vec![WasmMsg::Execute { contract_addr: pre_propose_start.into_string(), - msg: to_binary(&dao_pre_propose_single::ExecuteMsg::Withdraw { denom: None }).unwrap(), + msg: to_json_binary(&dao_pre_propose_single::ExecuteMsg::Withdraw { denom: None }) + .unwrap(), funds: vec![], } .into()], diff --git a/contracts/staking/cw20-stake-external-rewards/src/contract.rs b/contracts/staking/cw20-stake-external-rewards/src/contract.rs index b1774414f..e92b0b6d9 100644 --- a/contracts/staking/cw20-stake-external-rewards/src/contract.rs +++ b/contracts/staking/cw20-stake-external-rewards/src/contract.rs @@ -14,7 +14,7 @@ use crate::ContractError::{ use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_binary, to_binary, Addr, BankMsg, Binary, Coin, CosmosMsg, Deps, DepsMut, Empty, Env, + from_json, to_json_binary, Addr, BankMsg, Binary, Coin, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Response, StdError, StdResult, Uint128, Uint256, WasmMsg, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; @@ -143,7 +143,7 @@ pub fn execute_receive( info: MessageInfo, wrapper: Cw20ReceiveMsg, ) -> Result, ContractError> { - let msg: ReceiveMsg = from_binary(&wrapper.msg)?; + let msg: ReceiveMsg = from_json(&wrapper.msg)?; let config = CONFIG.load(deps.storage)?; let sender = deps.api.addr_validate(&wrapper.sender)?; if config.reward_token != Denom::Cw20(info.sender) { @@ -280,7 +280,7 @@ pub fn get_transfer_msg(recipient: Addr, amount: Uint128, denom: Denom) -> StdRe } .into()), Denom::Cw20(addr) => { - let cw20_msg = to_binary(&cw20::Cw20ExecuteMsg::Transfer { + let cw20_msg = to_json_binary(&cw20::Cw20ExecuteMsg::Transfer { recipient: recipient.into_string(), amount, })?; @@ -414,11 +414,11 @@ fn scale_factor() -> Uint256 { #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { - QueryMsg::Info {} => Ok(to_binary(&query_info(deps, env)?)?), + QueryMsg::Info {} => Ok(to_json_binary(&query_info(deps, env)?)?), QueryMsg::GetPendingRewards { address } => { - Ok(to_binary(&query_pending_rewards(deps, env, address)?)?) + Ok(to_json_binary(&query_pending_rewards(deps, env, address)?)?) } - QueryMsg::Ownership {} => to_binary(&cw_ownable::get_ownership(deps.storage)?), + QueryMsg::Ownership {} => to_json_binary(&cw_ownable::get_ownership(deps.storage)?), } } @@ -462,7 +462,7 @@ mod tests { use crate::{msg::MigrateMsg, ContractError}; - use cosmwasm_std::{coin, to_binary, Addr, Empty, Uint128, WasmMsg}; + use cosmwasm_std::{coin, to_json_binary, Addr, Empty, Uint128, WasmMsg}; use cw20::{Cw20Coin, Cw20ExecuteMsg, Denom}; use cw_ownable::{Action, Ownership, OwnershipError}; use cw_utils::Duration; @@ -566,7 +566,7 @@ mod tests { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_addr.to_string(), amount: Uint128::new(amount), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract(Addr::unchecked(sender), cw20_addr.clone(), &msg, &[]) .unwrap(); @@ -679,7 +679,7 @@ mod tests { reward_addr: &Addr, amount: u128, ) { - let fund_sub_msg = to_binary(&ReceiveMsg::Fund {}).unwrap(); + let fund_sub_msg = to_json_binary(&ReceiveMsg::Fund {}).unwrap(); let fund_msg = Cw20ExecuteMsg::Send { contract: reward_addr.clone().into_string(), amount: Uint128::new(amount), @@ -1680,7 +1680,7 @@ mod tests { amount: Uint128::new(500000000), }], ); - let fund_sub_msg = to_binary(&ReceiveMsg::Fund {}).unwrap(); + let fund_sub_msg = to_json_binary(&ReceiveMsg::Fund {}).unwrap(); let fund_msg = Cw20ExecuteMsg::Send { contract: reward_addr.into_string(), amount: Uint128::new(100), @@ -1733,7 +1733,7 @@ mod tests { app.borrow_mut().update_block(|b| b.height = 1000); // Test with invalid token - let fund_sub_msg = to_binary(&ReceiveMsg::Fund {}).unwrap(); + let fund_sub_msg = to_json_binary(&ReceiveMsg::Fund {}).unwrap(); let fund_msg = Cw20ExecuteMsg::Send { contract: reward_addr.clone().into_string(), amount: Uint128::new(100), @@ -2003,7 +2003,7 @@ mod tests { WasmMsg::Migrate { contract_addr: rewards_addr.to_string(), new_code_id: v2_code, - msg: to_binary(&MigrateMsg::FromV1 {}).unwrap(), + msg: to_json_binary(&MigrateMsg::FromV1 {}).unwrap(), } .into(), ) @@ -2025,7 +2025,7 @@ mod tests { WasmMsg::Migrate { contract_addr: rewards_addr.to_string(), new_code_id: v2_code, - msg: to_binary(&MigrateMsg::FromV1 {}).unwrap(), + msg: to_json_binary(&MigrateMsg::FromV1 {}).unwrap(), } .into(), ) diff --git a/contracts/staking/cw20-stake-reward-distributor/src/contract.rs b/contracts/staking/cw20-stake-reward-distributor/src/contract.rs index d4108d88c..66636add1 100644 --- a/contracts/staking/cw20-stake-reward-distributor/src/contract.rs +++ b/contracts/staking/cw20-stake-reward-distributor/src/contract.rs @@ -2,7 +2,7 @@ use std::cmp::min; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; -use cosmwasm_std::{to_binary, Addr, CosmosMsg, StdError, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, CosmosMsg, StdError, Uint128, WasmMsg}; use crate::error::ContractError; use crate::msg::{ExecuteMsg, InfoResponse, InstantiateMsg, MigrateMsg, QueryMsg}; @@ -162,10 +162,10 @@ fn get_distribution_msg(deps: Deps, env: &Env) -> Result StdResult { match msg { - QueryMsg::Info {} => to_binary(&query_info(deps, env)?), - QueryMsg::Ownership {} => to_binary(&cw_ownable::get_ownership(deps.storage)?), + QueryMsg::Info {} => to_json_binary(&query_info(deps, env)?), + QueryMsg::Ownership {} => to_json_binary(&cw_ownable::get_ownership(deps.storage)?), } } diff --git a/contracts/staking/cw20-stake-reward-distributor/src/tests.rs b/contracts/staking/cw20-stake-reward-distributor/src/tests.rs index 829fafaf4..7b6bde529 100644 --- a/contracts/staking/cw20-stake-reward-distributor/src/tests.rs +++ b/contracts/staking/cw20-stake-reward-distributor/src/tests.rs @@ -6,7 +6,7 @@ use crate::{ use cw20_stake_reward_distributor_v1 as v1; -use cosmwasm_std::{to_binary, Addr, Empty, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, Empty, Uint128, WasmMsg}; use cw20::Cw20Coin; use cw_multi_test::{next_block, App, Contract, ContractWrapper, Executor}; use cw_ownable::{Action, Expiration, Ownership, OwnershipError}; @@ -711,7 +711,7 @@ fn test_migrate_from_v1() { WasmMsg::Migrate { contract_addr: distributor.to_string(), new_code_id: v2_code, - msg: to_binary(&MigrateMsg::FromV1 {}).unwrap(), + msg: to_json_binary(&MigrateMsg::FromV1 {}).unwrap(), } .into(), ) @@ -747,7 +747,7 @@ fn test_migrate_from_v1() { WasmMsg::Migrate { contract_addr: distributor.to_string(), new_code_id: v2_code, - msg: to_binary(&MigrateMsg::FromV1 {}).unwrap(), + msg: to_json_binary(&MigrateMsg::FromV1 {}).unwrap(), } .into(), ) diff --git a/contracts/staking/cw20-stake/src/contract.rs b/contracts/staking/cw20-stake/src/contract.rs index f200b3737..64af7482a 100644 --- a/contracts/staking/cw20-stake/src/contract.rs +++ b/contracts/staking/cw20-stake/src/contract.rs @@ -2,7 +2,7 @@ use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_binary, to_binary, Addr, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Response, + from_json, to_json_binary, Addr, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Response, StdError, StdResult, Uint128, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; @@ -129,7 +129,7 @@ pub fn execute_receive( expected: config.token_address, }); } - let msg: ReceiveMsg = from_binary(&wrapper.msg)?; + let msg: ReceiveMsg = from_json(&wrapper.msg)?; let sender = deps.api.addr_validate(&wrapper.sender)?; match msg { ReceiveMsg::Stake {} => execute_stake(deps, env, sender, wrapper.amount), @@ -221,7 +221,7 @@ pub fn execute_unstake( }; let wasm_msg = cosmwasm_std::WasmMsg::Execute { contract_addr: config.token_address.to_string(), - msg: to_binary(&cw_send_msg)?, + msg: to_json_binary(&cw_send_msg)?, funds: vec![], }; Ok(Response::new() @@ -270,7 +270,7 @@ pub fn execute_claim( }; let wasm_msg = cosmwasm_std::WasmMsg::Execute { contract_addr: config.token_address.to_string(), - msg: to_binary(&cw_send_msg)?, + msg: to_json_binary(&cw_send_msg)?, funds: vec![], }; Ok(Response::new() @@ -336,21 +336,23 @@ pub fn execute_update_owner( #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { - QueryMsg::GetConfig {} => to_binary(&query_config(deps)?), + QueryMsg::GetConfig {} => to_json_binary(&query_config(deps)?), QueryMsg::StakedBalanceAtHeight { address, height } => { - to_binary(&query_staked_balance_at_height(deps, env, address, height)?) + to_json_binary(&query_staked_balance_at_height(deps, env, address, height)?) } QueryMsg::TotalStakedAtHeight { height } => { - to_binary(&query_total_staked_at_height(deps, env, height)?) + to_json_binary(&query_total_staked_at_height(deps, env, height)?) } - QueryMsg::StakedValue { address } => to_binary(&query_staked_value(deps, env, address)?), - QueryMsg::TotalValue {} => to_binary(&query_total_value(deps, env)?), - QueryMsg::Claims { address } => to_binary(&query_claims(deps, address)?), - QueryMsg::GetHooks {} => to_binary(&query_hooks(deps)?), + QueryMsg::StakedValue { address } => { + to_json_binary(&query_staked_value(deps, env, address)?) + } + QueryMsg::TotalValue {} => to_json_binary(&query_total_value(deps, env)?), + QueryMsg::Claims { address } => to_json_binary(&query_claims(deps, address)?), + QueryMsg::GetHooks {} => to_json_binary(&query_hooks(deps)?), QueryMsg::ListStakers { start_after, limit } => { query_list_stakers(deps, start_after, limit) } - QueryMsg::Ownership {} => to_binary(&cw_ownable::get_ownership(deps.storage)?), + QueryMsg::Ownership {} => to_json_binary(&cw_ownable::get_ownership(deps.storage)?), } } @@ -450,7 +452,7 @@ pub fn query_list_stakers( }) .collect(); - to_binary(&ListStakersResponse { stakers }) + to_json_binary(&ListStakersResponse { stakers }) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/staking/cw20-stake/src/tests.rs b/contracts/staking/cw20-stake/src/tests.rs index 1838265a5..147bd806f 100644 --- a/contracts/staking/cw20-stake/src/tests.rs +++ b/contracts/staking/cw20-stake/src/tests.rs @@ -1,6 +1,6 @@ use anyhow::Result as AnyResult; use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info}; -use cosmwasm_std::{to_binary, Addr, Empty, MessageInfo, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, Empty, MessageInfo, Uint128, WasmMsg}; use cw20::Cw20Coin; use cw_controllers::{Claim, ClaimsResponse}; use cw_multi_test::{next_block, App, AppResponse, Contract, ContractWrapper, Executor}; @@ -190,7 +190,7 @@ fn stake_tokens( let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_addr.to_string(), amount, - msg: to_binary(&ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract(info.sender, cw20_addr.clone(), &msg, &[]) } @@ -653,7 +653,7 @@ fn test_auto_compounding_staking() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_addr.to_string(), amount: Uint128::from(100u128), - msg: to_binary(&ReceiveMsg::Fund {}).unwrap(), + msg: to_json_binary(&ReceiveMsg::Fund {}).unwrap(), }; let _res = app .borrow_mut() @@ -725,7 +725,7 @@ fn test_auto_compounding_staking() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_addr.to_string(), amount: Uint128::from(90u128), - msg: to_binary(&ReceiveMsg::Fund {}).unwrap(), + msg: to_json_binary(&ReceiveMsg::Fund {}).unwrap(), }; let _res = app .borrow_mut() @@ -1151,7 +1151,7 @@ fn test_migrate_from_v1() { WasmMsg::Migrate { contract_addr: staking.to_string(), new_code_id: v2_code, - msg: to_binary(&MigrateMsg::FromV1 {}).unwrap(), + msg: to_json_binary(&MigrateMsg::FromV1 {}).unwrap(), } .into(), ) @@ -1164,7 +1164,7 @@ fn test_migrate_from_v1() { WasmMsg::Migrate { contract_addr: staking.to_string(), new_code_id: v2_code, - msg: to_binary(&MigrateMsg::FromV1 {}).unwrap(), + msg: to_json_binary(&MigrateMsg::FromV1 {}).unwrap(), } .into(), ) diff --git a/contracts/test/dao-proposal-hook-counter/src/contract.rs b/contracts/test/dao-proposal-hook-counter/src/contract.rs index 0f2a36fd3..3aaefca3d 100644 --- a/contracts/test/dao-proposal-hook-counter/src/contract.rs +++ b/contracts/test/dao-proposal-hook-counter/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, Uint128, + to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, Uint128, }; use cw2::set_contract_version; use dao_hooks::stake::StakeChangedHookMsg; @@ -121,14 +121,14 @@ pub fn execute_vote_hook( #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { match msg { - QueryMsg::ProposalCounter {} => to_binary(&CountResponse { + QueryMsg::ProposalCounter {} => to_json_binary(&CountResponse { count: PROPOSAL_COUNTER.load(deps.storage)?, }), - QueryMsg::StakeCounter {} => to_binary(&STAKE_COUNTER.load(deps.storage)?), - QueryMsg::StatusChangedCounter {} => to_binary(&CountResponse { + QueryMsg::StakeCounter {} => to_json_binary(&STAKE_COUNTER.load(deps.storage)?), + QueryMsg::StatusChangedCounter {} => to_json_binary(&CountResponse { count: STATUS_CHANGED_COUNTER.load(deps.storage)?, }), - QueryMsg::VoteCounter {} => to_binary(&CountResponse { + QueryMsg::VoteCounter {} => to_json_binary(&CountResponse { count: VOTE_COUNTER.load(deps.storage)?, }), } diff --git a/contracts/test/dao-proposal-hook-counter/src/tests.rs b/contracts/test/dao-proposal-hook-counter/src/tests.rs index 728baba65..fddc0f104 100644 --- a/contracts/test/dao-proposal-hook-counter/src/tests.rs +++ b/contracts/test/dao-proposal-hook-counter/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, Addr, Empty, Uint128}; +use cosmwasm_std::{to_json_binary, Addr, Empty, Uint128}; use cw20::Cw20Coin; use cw_hooks::HooksResponse; use cw_multi_test::{App, Contract, ContractWrapper, Executor}; @@ -108,7 +108,7 @@ fn instantiate_with_default_governance( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw20_balance::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_balance::msg::InstantiateMsg { token_info: dao_voting_cw20_balance::msg::TokenInfo::New { code_id: cw20_id, label: "DAO DAO governance token".to_string(), @@ -126,7 +126,7 @@ fn instantiate_with_default_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id, - msg: to_binary(&msg).unwrap(), + msg: to_json_binary(&msg).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module".to_string(), diff --git a/contracts/test/dao-proposal-sudo/src/contract.rs b/contracts/test/dao-proposal-sudo/src/contract.rs index 82df228e3..902a0ee34 100644 --- a/contracts/test/dao-proposal-sudo/src/contract.rs +++ b/contracts/test/dao-proposal-sudo/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Response, StdResult, + to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Response, StdResult, WasmMsg, }; use cw2::set_contract_version; @@ -59,7 +59,7 @@ pub fn execute_execute( let msg = WasmMsg::Execute { contract_addr: dao.to_string(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { msgs })?, + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { msgs })?, funds: vec![], }; @@ -78,14 +78,14 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { } pub fn query_admin(deps: Deps) -> StdResult { - to_binary(&ROOT.load(deps.storage)?) + to_json_binary(&ROOT.load(deps.storage)?) } pub fn query_dao(deps: Deps) -> StdResult { - to_binary(&DAO.load(deps.storage)?) + to_json_binary(&DAO.load(deps.storage)?) } pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } diff --git a/contracts/test/dao-test-custom-factory/src/contract.rs b/contracts/test/dao-test-custom-factory/src/contract.rs index 7091c027a..67ad19686 100644 --- a/contracts/test/dao-test-custom-factory/src/contract.rs +++ b/contracts/test/dao-test-custom-factory/src/contract.rs @@ -1,8 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, - StdResult, SubMsg, Uint128, WasmMsg, + to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Reply, + Response, StdResult, SubMsg, Uint128, WasmMsg, }; use cw2::set_contract_version; use cw721::{Cw721QueryMsg, NumTokensResponse}; @@ -131,7 +131,7 @@ pub fn execute_nft_factory( INITIAL_NFTS.save(deps.storage, &initial_nfts)?; // Override minter to be the DAO address - let msg = to_binary(&Cw721InstantiateMsg { + let msg = to_json_binary(&Cw721InstantiateMsg { name: cw721_instantiate_msg.name, symbol: cw721_instantiate_msg.symbol, minter: dao.to_string(), @@ -190,11 +190,13 @@ pub fn execute_nft_factory_wrong_callback( _env: Env, _info: MessageInfo, ) -> Result { - Ok(Response::new().set_data(to_binary(&TokenFactoryCallback { - denom: "wrong".to_string(), - token_contract: None, - module_instantiate_callback: None, - })?)) + Ok( + Response::new().set_data(to_json_binary(&TokenFactoryCallback { + denom: "wrong".to_string(), + token_contract: None, + module_instantiate_callback: None, + })?), + ) } /// An example factory that instantiates a cw_tokenfactory_issuer contract @@ -224,7 +226,7 @@ pub fn execute_token_factory_factory( WasmMsg::Instantiate { admin: Some(dao.to_string()), code_id: token.token_issuer_code_id, - msg: to_binary(&IssuerInstantiateMsg::NewToken { + msg: to_json_binary(&IssuerInstantiateMsg::NewToken { subdenom: token.subdenom, })?, funds: vec![], @@ -264,10 +266,12 @@ pub fn execute_token_factory_factory_wrong_callback( _env: Env, _info: MessageInfo, ) -> Result { - Ok(Response::new().set_data(to_binary(&NftFactoryCallback { - nft_contract: "nope".to_string(), - module_instantiate_callback: None, - })?)) + Ok( + Response::new().set_data(to_json_binary(&NftFactoryCallback { + nft_contract: "nope".to_string(), + module_instantiate_callback: None, + })?), + ) } /// Example method called in the ModuleInstantiateCallback providing @@ -328,7 +332,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } #[cfg_attr(not(feature = "library"), entry_point)] @@ -377,7 +381,7 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result Result Result Result Result Result { // Parse nft address from instantiate reply @@ -481,16 +485,18 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result Err(ContractError::UnknownReplyId { id: msg.id }), } diff --git a/contracts/test/dao-voting-cw20-balance/src/contract.rs b/contracts/test/dao-voting-cw20-balance/src/contract.rs index 9c533568c..6d75355fd 100644 --- a/contracts/test/dao-voting-cw20-balance/src/contract.rs +++ b/contracts/test/dao-voting-cw20-balance/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, SubMsg, + to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, SubMsg, Uint128, WasmMsg, }; use cw2::set_contract_version; @@ -55,7 +55,7 @@ pub fn instantiate( let msg = WasmMsg::Instantiate { admin: Some(info.sender.to_string()), code_id, - msg: to_binary(&cw20_base::msg::InstantiateMsg { + msg: to_json_binary(&cw20_base::msg::InstantiateMsg { name, symbol, decimals, @@ -104,12 +104,12 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { pub fn query_dao(deps: Deps) -> StdResult { let dao = DAO.load(deps.storage)?; - to_binary(&dao) + to_json_binary(&dao) } pub fn query_token_contract(deps: Deps) -> StdResult { let token = TOKEN.load(deps.storage)?; - to_binary(&token) + to_json_binary(&token) } pub fn query_voting_power_at_height(deps: Deps, env: Env, address: String) -> StdResult { @@ -121,7 +121,7 @@ pub fn query_voting_power_at_height(deps: Deps, env: Env, address: String) -> St address: address.to_string(), }, )?; - to_binary(&dao_interface::voting::VotingPowerAtHeightResponse { + to_json_binary(&dao_interface::voting::VotingPowerAtHeightResponse { power: balance.balance, height: env.block.height, }) @@ -132,7 +132,7 @@ pub fn query_total_power_at_height(deps: Deps, env: Env) -> StdResult { let info: cw20::TokenInfoResponse = deps .querier .query_wasm_smart(token, &cw20::Cw20QueryMsg::TokenInfo {})?; - to_binary(&dao_interface::voting::TotalPowerAtHeightResponse { + to_json_binary(&dao_interface::voting::TotalPowerAtHeightResponse { power: info.total_supply, height: env.block.height, }) @@ -140,7 +140,7 @@ pub fn query_total_power_at_height(deps: Deps, env: Env) -> StdResult { pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/voting/dao-voting-cw20-staked/src/contract.rs b/contracts/voting/dao-voting-cw20-staked/src/contract.rs index 28ed26836..47913a57c 100644 --- a/contracts/voting/dao-voting-cw20-staked/src/contract.rs +++ b/contracts/voting/dao-voting-cw20-staked/src/contract.rs @@ -1,8 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, Binary, Decimal, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, - SubMsg, Uint128, Uint256, WasmMsg, + to_json_binary, Addr, Binary, Decimal, Deps, DepsMut, Env, MessageInfo, Reply, Response, + StdResult, SubMsg, Uint128, Uint256, WasmMsg, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; use cw20::{Cw20Coin, TokenInfoResponse}; @@ -89,7 +89,7 @@ pub fn instantiate( funds: vec![], admin: Some(info.sender.to_string()), label: env.contract.address.to_string(), - msg: to_binary(&cw20_stake::msg::InstantiateMsg { + msg: to_json_binary(&cw20_stake::msg::InstantiateMsg { owner: Some(info.sender.to_string()), unstaking_duration, token_address: address.to_string(), @@ -141,7 +141,7 @@ pub fn instantiate( let msg = WasmMsg::Instantiate { admin: Some(info.sender.to_string()), code_id, - msg: to_binary(&cw20_base::msg::InstantiateMsg { + msg: to_json_binary(&cw20_base::msg::InstantiateMsg { name, symbol, decimals, @@ -245,12 +245,12 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { pub fn query_token_contract(deps: Deps) -> StdResult { let token = TOKEN.load(deps.storage)?; - to_binary(&token) + to_json_binary(&token) } pub fn query_staking_contract(deps: Deps) -> StdResult { let staking_contract = STAKING_CONTRACT.load(deps.storage)?; - to_binary(&staking_contract) + to_json_binary(&staking_contract) } pub fn query_voting_power_at_height( @@ -268,7 +268,7 @@ pub fn query_voting_power_at_height( height, }, )?; - to_binary(&dao_interface::voting::VotingPowerAtHeightResponse { + to_json_binary(&dao_interface::voting::VotingPowerAtHeightResponse { power: res.balance, height: res.height, }) @@ -284,7 +284,7 @@ pub fn query_total_power_at_height( staking_contract, &cw20_stake::msg::QueryMsg::TotalStakedAtHeight { height }, )?; - to_binary(&dao_interface::voting::TotalPowerAtHeightResponse { + to_json_binary(&dao_interface::voting::TotalPowerAtHeightResponse { power: res.total, height: res.height, }) @@ -292,12 +292,12 @@ pub fn query_total_power_at_height( pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } pub fn query_dao(deps: Deps) -> StdResult { let dao = DAO.load(deps.storage)?; - to_binary(&dao) + to_json_binary(&dao) } pub fn query_is_active(deps: Deps) -> StdResult { @@ -311,7 +311,7 @@ pub fn query_is_active(deps: Deps) -> StdResult { &cw20_stake::msg::QueryMsg::TotalStakedAtHeight { height: None }, )?; match threshold { - ActiveThreshold::AbsoluteCount { count } => to_binary(&IsActiveResponse { + ActiveThreshold::AbsoluteCount { count } => to_json_binary(&IsActiveResponse { active: actual_power.total >= count, }), ActiveThreshold::Percentage { percent } => { @@ -354,18 +354,18 @@ pub fn query_is_active(deps: Deps) -> StdResult { let rounded = (applied + Uint256::from(PRECISION_FACTOR) - Uint256::from(1u128)) / Uint256::from(PRECISION_FACTOR); let count: Uint128 = rounded.try_into().unwrap(); - to_binary(&IsActiveResponse { + to_json_binary(&IsActiveResponse { active: actual_power.total >= count, }) } } } else { - to_binary(&IsActiveResponse { active: true }) + to_json_binary(&IsActiveResponse { active: true }) } } pub fn query_active_threshold(deps: Deps) -> StdResult { - to_binary(&ActiveThresholdResponse { + to_json_binary(&ActiveThresholdResponse { active_threshold: ACTIVE_THRESHOLD.may_load(deps.storage)?, }) } @@ -413,7 +413,7 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result StdResult { } QueryMsg::TotalPowerAtHeight { height } => query_total_power_at_height(deps, env, height), QueryMsg::Info {} => query_info(deps), - QueryMsg::GroupContract {} => to_binary(&GROUP_CONTRACT.load(deps.storage)?), - QueryMsg::Dao {} => to_binary(&DAO.load(deps.storage)?), + QueryMsg::GroupContract {} => to_json_binary(&GROUP_CONTRACT.load(deps.storage)?), + QueryMsg::Dao {} => to_json_binary(&DAO.load(deps.storage)?), } } @@ -145,7 +145,7 @@ pub fn query_voting_power_at_height( }, )?; - to_binary(&dao_interface::voting::VotingPowerAtHeightResponse { + to_json_binary(&dao_interface::voting::VotingPowerAtHeightResponse { power: res.weight.unwrap_or(0).into(), height: height.unwrap_or(env.block.height), }) @@ -157,7 +157,7 @@ pub fn query_total_power_at_height(deps: Deps, env: Env, height: Option) -> group_contract, &cw4_group::msg::QueryMsg::TotalWeight { at_height: height }, )?; - to_binary(&dao_interface::voting::TotalPowerAtHeightResponse { + to_json_binary(&dao_interface::voting::TotalPowerAtHeightResponse { power: res.weight.into(), height: height.unwrap_or(env.block.height), }) @@ -165,7 +165,7 @@ pub fn query_total_power_at_height(deps: Deps, env: Env, height: Option) -> pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/voting/dao-voting-cw4/src/tests.rs b/contracts/voting/dao-voting-cw4/src/tests.rs index 69ca443ef..769c53c4c 100644 --- a/contracts/voting/dao-voting-cw4/src/tests.rs +++ b/contracts/voting/dao-voting-cw4/src/tests.rs @@ -1,6 +1,6 @@ use cosmwasm_std::{ testing::{mock_dependencies, mock_env}, - to_binary, Addr, CosmosMsg, Empty, Uint128, WasmMsg, + to_json_binary, Addr, CosmosMsg, Empty, Uint128, WasmMsg, }; use cw2::ContractVersion; use cw_multi_test::{next_block, App, Contract, ContractWrapper, Executor}; @@ -608,7 +608,7 @@ fn test_migrate() { CosmosMsg::Wasm(WasmMsg::Migrate { contract_addr: voting_addr.to_string(), new_code_id: voting_id, - msg: to_binary(&MigrateMsg {}).unwrap(), + msg: to_json_binary(&MigrateMsg {}).unwrap(), }), ) .unwrap(); diff --git a/contracts/voting/dao-voting-cw721-roles/src/contract.rs b/contracts/voting/dao-voting-cw721-roles/src/contract.rs index 9d0f8852d..d44bf10ab 100644 --- a/contracts/voting/dao-voting-cw721-roles/src/contract.rs +++ b/contracts/voting/dao-voting-cw721-roles/src/contract.rs @@ -1,8 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, StdResult, SubMsg, - WasmMsg, + to_json_binary, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, StdResult, + SubMsg, WasmMsg, }; use cw2::set_contract_version; use cw4::{MemberResponse, TotalWeightResponse}; @@ -66,7 +66,7 @@ pub fn instantiate( funds: vec![], admin: Some(info.sender.to_string()), label, - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name, symbol, // Admin must be set to contract to mint initial NFTs @@ -121,7 +121,7 @@ pub fn query_voting_power_at_height( }, )?; - to_binary(&dao_interface::voting::VotingPowerAtHeightResponse { + to_json_binary(&dao_interface::voting::VotingPowerAtHeightResponse { power: member.weight.unwrap_or(0).into(), height: at_height.unwrap_or(env.block.height), }) @@ -140,7 +140,7 @@ pub fn query_total_power_at_height( }, )?; - to_binary(&dao_interface::voting::TotalPowerAtHeightResponse { + to_json_binary(&dao_interface::voting::TotalPowerAtHeightResponse { power: total.weight.into(), height: at_height.unwrap_or(env.block.height), }) @@ -148,17 +148,17 @@ pub fn query_total_power_at_height( pub fn query_config(deps: Deps) -> StdResult { let config = CONFIG.load(deps.storage)?; - to_binary(&config) + to_json_binary(&config) } pub fn query_dao(deps: Deps) -> StdResult { let dao = DAO.load(deps.storage)?; - to_binary(&dao) + to_json_binary(&dao) } pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } #[cfg_attr(not(feature = "library"), entry_point)] @@ -186,7 +186,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result::Mint { token_id: nft.token_id.clone(), owner: nft.owner.clone(), @@ -207,7 +207,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result::UpdateOwnership( Action::TransferOwnership { new_owner: dao.to_string(), diff --git a/contracts/voting/dao-voting-cw721-staked/src/contract.rs b/contracts/voting/dao-voting-cw721-staked/src/contract.rs index 982d40e78..fc83cce13 100644 --- a/contracts/voting/dao-voting-cw721-staked/src/contract.rs +++ b/contracts/voting/dao-voting-cw721-staked/src/contract.rs @@ -1,8 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_binary, to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Reply, - Response, StdError, StdResult, SubMsg, Uint128, Uint256, WasmMsg, + from_json, to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, + Reply, Response, StdError, StdResult, SubMsg, Uint128, Uint256, WasmMsg, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; use cw721::{Cw721QueryMsg, Cw721ReceiveMsg, NumTokensResponse}; @@ -48,9 +48,9 @@ impl NftInstantiateMsg { } } - fn to_binary(&self) -> Result { + fn to_json_binary(&self) -> Result { match self { - NftInstantiateMsg::Cw721(msg) => to_binary(&msg), + NftInstantiateMsg::Cw721(msg) => to_json_binary(&msg), } } } @@ -58,7 +58,7 @@ impl NftInstantiateMsg { pub fn try_deserialize_nft_instantiate_msg( instantiate_msg: Binary, ) -> Result { - if let Ok(cw721_msg) = from_binary::(&instantiate_msg) { + if let Ok(cw721_msg) = from_json::(&instantiate_msg) { return Ok(NftInstantiateMsg::Cw721(cw721_msg)); } @@ -153,7 +153,7 @@ pub fn instantiate( funds: vec![], admin: Some(info.sender.to_string()), label, - msg: instantiate_msg.to_binary()?, + msg: instantiate_msg.to_json_binary()?, }, INSTANTIATE_NFT_CONTRACT_REPLY_ID, ); @@ -162,7 +162,7 @@ pub fn instantiate( .add_attribute("method", "instantiate") .add_submessage(instantiate_msg)) } - NftContract::Factory(binary) => match from_binary(&binary)? { + NftContract::Factory(binary) => match from_json(binary)? { WasmMsg::Execute { msg: wasm_msg, contract_addr, @@ -296,7 +296,7 @@ pub fn execute_unstake( .map(|token_id| -> StdResult { Ok(cosmwasm_std::WasmMsg::Execute { contract_addr: config.nft_address.to_string(), - msg: to_binary(&cw721::Cw721ExecuteMsg::TransferNft { + msg: to_json_binary(&cw721::Cw721ExecuteMsg::TransferNft { recipient: info.sender.to_string(), token_id, })?, @@ -356,7 +356,7 @@ pub fn execute_claim_nfts( .map(|nft| -> StdResult { Ok(WasmMsg::Execute { contract_addr: config.nft_address.to_string(), - msg: to_binary(&cw721::Cw721ExecuteMsg::TransferNft { + msg: to_json_binary(&cw721::Cw721ExecuteMsg::TransferNft { recipient: info.sender.to_string(), token_id: nft, })?, @@ -500,7 +500,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { } pub fn query_active_threshold(deps: Deps) -> StdResult { - to_binary(&ActiveThresholdResponse { + to_json_binary(&ActiveThresholdResponse { active_threshold: ACTIVE_THRESHOLD.may_load(deps.storage)?, }) } @@ -518,13 +518,13 @@ pub fn query_is_active(deps: Deps, env: Env) -> StdResult { )?; match threshold { - ActiveThreshold::AbsoluteCount { count } => to_binary(&IsActiveResponse { + ActiveThreshold::AbsoluteCount { count } => to_json_binary(&IsActiveResponse { active: staked_nfts >= count, }), ActiveThreshold::Percentage { percent } => { // Check if there are any staked NFTs if staked_nfts.is_zero() { - return to_binary(&IsActiveResponse { active: false }); + return to_json_binary(&IsActiveResponse { active: false }); } // percent is bounded between [0, 100]. decimal @@ -564,13 +564,13 @@ pub fn query_is_active(deps: Deps, env: Env) -> StdResult { let count: Uint128 = rounded.try_into().unwrap(); // staked_nfts >= total_nfts * percent - to_binary(&IsActiveResponse { + to_json_binary(&IsActiveResponse { active: staked_nfts >= count, }) } } } else { - to_binary(&IsActiveResponse { active: true }) + to_json_binary(&IsActiveResponse { active: true }) } } @@ -585,7 +585,7 @@ pub fn query_voting_power_at_height( let power = NFT_BALANCES .may_load_at_height(deps.storage, &address, height)? .unwrap_or_default(); - to_binary(&dao_interface::voting::VotingPowerAtHeightResponse { power, height }) + to_json_binary(&dao_interface::voting::VotingPowerAtHeightResponse { power, height }) } pub fn query_total_power_at_height(deps: Deps, env: Env, height: Option) -> StdResult { @@ -593,30 +593,30 @@ pub fn query_total_power_at_height(deps: Deps, env: Env, height: Option) -> let power = TOTAL_STAKED_NFTS .may_load_at_height(deps.storage, height)? .unwrap_or_default(); - to_binary(&dao_interface::voting::TotalPowerAtHeightResponse { power, height }) + to_json_binary(&dao_interface::voting::TotalPowerAtHeightResponse { power, height }) } pub fn query_config(deps: Deps) -> StdResult { let config = CONFIG.load(deps.storage)?; - to_binary(&config) + to_json_binary(&config) } pub fn query_dao(deps: Deps) -> StdResult { let dao = DAO.load(deps.storage)?; - to_binary(&dao) + to_json_binary(&dao) } pub fn query_nft_claims(deps: Deps, address: String) -> StdResult { - to_binary(&NFT_CLAIMS.query_claims(deps, &deps.api.addr_validate(&address)?)?) + to_json_binary(&NFT_CLAIMS.query_claims(deps, &deps.api.addr_validate(&address)?)?) } pub fn query_hooks(deps: Deps) -> StdResult { - to_binary(&HOOKS.query_hooks(deps)?) + to_json_binary(&HOOKS.query_hooks(deps)?) } pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } pub fn query_staked_nfts( @@ -639,7 +639,7 @@ pub fn query_staked_nfts( Some(l) => range.take(l as usize).collect(), None => range.collect(), }; - to_binary(&range?) + to_json_binary(&range?) } #[cfg_attr(not(feature = "library"), entry_point)] @@ -692,7 +692,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result::UpdateOwnership( cw721_base::Action::TransferOwnership { new_owner: dao.to_string(), @@ -744,10 +744,10 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result::UpdateOwnership( cw721_base::Action::AcceptOwnership {}, ), @@ -767,7 +767,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result Result::Mint { - owner: accounts[0].address(), - token_uri: Some("https://example.com".to_string()), - token_id: "1".to_string(), - extension: Empty {}, - }, - ) + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::< + Empty, + Empty, + >::Mint { + owner: accounts[0].address(), + token_uri: Some("https://example.com".to_string()), + token_id: "1".to_string(), + extension: Empty {}, + }) .unwrap()], }, ) @@ -100,7 +101,7 @@ fn test_full_integration_with_factory() { }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_single.code_id, - msg: to_binary(&dao_proposal_single::msg::InstantiateMsg { + msg: to_json_binary(&dao_proposal_single::msg::InstantiateMsg { min_voting_period: None, threshold: Threshold::ThresholdQuorum { threshold: PercentageThreshold::Majority {}, diff --git a/contracts/voting/dao-voting-cw721-staked/src/testing/test_tube_env.rs b/contracts/voting/dao-voting-cw721-staked/src/testing/test_tube_env.rs index cea9d24a1..b3dcae089 100644 --- a/contracts/voting/dao-voting-cw721-staked/src/testing/test_tube_env.rs +++ b/contracts/voting/dao-voting-cw721-staked/src/testing/test_tube_env.rs @@ -7,7 +7,7 @@ use crate::{ state::Config, }; -use cosmwasm_std::{to_binary, Addr, Coin, Decimal, Empty, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, Coin, Decimal, Empty, WasmMsg}; use cw_utils::Duration; use dao_interface::{ msg::QueryMsg as DaoQueryMsg, @@ -23,10 +23,9 @@ use dao_testing::test_tube::{ dao_test_custom_factory::CustomFactoryContract, }; use dao_voting::threshold::ActiveThreshold; -use osmosis_std::types::cosmwasm::wasm::v1::MsgExecuteContractResponse; use osmosis_test_tube::{ - Account, Bank, Module, OsmosisTestApp, RunnerError, RunnerExecuteResult, RunnerResult, - SigningAccount, Wasm, + osmosis_std::types::cosmwasm::wasm::v1::MsgExecuteContractResponse, Account, Bank, Module, + OsmosisTestApp, RunnerError, RunnerExecuteResult, RunnerResult, SigningAccount, Wasm, }; use serde::de::DeserializeOwned; use std::path::PathBuf; @@ -86,27 +85,30 @@ impl TestEnvBuilder { automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: vp_contract_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { nft_contract: NftContract::Factory( - to_binary(&WasmMsg::Execute { + to_json_binary(&WasmMsg::Execute { contract_addr: custom_factory.contract_addr.clone(), - msg: to_binary(&dao_test_custom_factory::msg::ExecuteMsg::NftFactory { - code_id: cw721_id, - cw721_instantiate_msg: Cw721InstantiateMsg { - name: "Test NFT".to_string(), - symbol: "TEST".to_string(), - minter: accounts[0].address(), - }, - initial_nfts: vec![to_binary( - &Cw721ExecuteMsg::::Mint { + msg: to_json_binary( + &dao_test_custom_factory::msg::ExecuteMsg::NftFactory { + code_id: cw721_id, + cw721_instantiate_msg: Cw721InstantiateMsg { + name: "Test NFT".to_string(), + symbol: "TEST".to_string(), + minter: accounts[0].address(), + }, + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::< + Empty, + Empty, + >::Mint { owner: accounts[0].address(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), extension: Empty {}, - }, - ) - .unwrap()], - }) + }) + .unwrap()], + }, + ) .unwrap(), funds: vec![], }) @@ -124,7 +126,7 @@ impl TestEnvBuilder { }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_single_id, - msg: to_binary(&dao_proposal_single::msg::InstantiateMsg { + msg: to_json_binary(&dao_proposal_single::msg::InstantiateMsg { min_voting_period: None, threshold: Threshold::ThresholdQuorum { threshold: PercentageThreshold::Majority {}, diff --git a/contracts/voting/dao-voting-cw721-staked/src/testing/tests.rs b/contracts/voting/dao-voting-cw721-staked/src/testing/tests.rs index 2f2ada85d..cdc057bb7 100644 --- a/contracts/voting/dao-voting-cw721-staked/src/testing/tests.rs +++ b/contracts/voting/dao-voting-cw721-staked/src/testing/tests.rs @@ -1,5 +1,5 @@ use cosmwasm_std::testing::{mock_dependencies, mock_env}; -use cosmwasm_std::{to_binary, Addr, Coin, Decimal, Empty, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, Coin, Decimal, Empty, Uint128, WasmMsg}; use cw721_base::msg::{ExecuteMsg as Cw721ExecuteMsg, InstantiateMsg as Cw721InstantiateMsg}; use cw721_controllers::{NftClaim, NftClaimsResponse}; use cw_multi_test::{next_block, App, BankSudo, Executor, SudoMsg}; @@ -45,12 +45,12 @@ fn test_instantiate_with_new_cw721_collection() -> anyhow::Result<()> { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), })?, - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -432,15 +432,15 @@ fn test_instantiate_with_invalid_duration_fails() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Extension { - msg: Empty {}, - }) + initial_nfts: vec![to_json_binary( + &Cw721ExecuteMsg::::Extension { msg: Empty {} }, + ) .unwrap()], }, unstaking_duration: None, @@ -471,13 +471,13 @@ fn test_instantiate_zero_active_threshold_count() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -511,13 +511,13 @@ fn test_instantiate_invalid_active_threshold_count_new_nft() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -577,28 +577,28 @@ fn test_active_threshold_absolute_count() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), initial_nfts: vec![ - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), extension: Empty {}, }) .unwrap(), - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "2".to_string(), extension: Empty {}, }) .unwrap(), - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "3".to_string(), @@ -657,13 +657,13 @@ fn test_active_threshold_percent() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -718,42 +718,42 @@ fn test_active_threshold_percent_rounds_up() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), initial_nfts: vec![ - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), extension: Empty {}, }) .unwrap(), - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "2".to_string(), extension: Empty {}, }) .unwrap(), - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "3".to_string(), extension: Empty {}, }) .unwrap(), - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "4".to_string(), extension: Empty {}, }) .unwrap(), - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "5".to_string(), @@ -820,13 +820,13 @@ fn test_update_active_threshold() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -896,13 +896,13 @@ fn test_active_threshold_percentage_gt_100() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -938,13 +938,13 @@ fn test_active_threshold_percentage_lte_0() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -978,8 +978,8 @@ fn test_invalid_instantiate_msg() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Empty {}).unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + msg: to_json_binary(&Empty {}).unwrap(), + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -1017,15 +1017,15 @@ fn test_invalid_initial_nft_msg() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Extension { - msg: Empty {}, - }) + initial_nfts: vec![to_json_binary( + &Cw721ExecuteMsg::::Extension { msg: Empty {} }, + ) .unwrap()], }, unstaking_duration: None, @@ -1056,16 +1056,18 @@ fn test_invalid_initial_nft_msg_wrong_absolute_count() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), initial_nfts: vec![ - to_binary(&Cw721ExecuteMsg::::Extension { msg: Empty {} }) - .unwrap(), - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Extension { + msg: Empty {}, + }) + .unwrap(), + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -1104,7 +1106,7 @@ fn test_no_initial_nfts_fails() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), @@ -1153,9 +1155,9 @@ fn test_factory() { Addr::unchecked(CREATOR_ADDR), &InstantiateMsg { nft_contract: NftContract::Factory( - to_binary(&WasmMsg::Execute { + to_json_binary(&WasmMsg::Execute { contract_addr: factory_addr.to_string(), - msg: to_binary(&dao_test_custom_factory::msg::ExecuteMsg::NftFactory { + msg: to_json_binary(&dao_test_custom_factory::msg::ExecuteMsg::NftFactory { code_id: cw721_id, cw721_instantiate_msg: Cw721InstantiateMsg { name: "Test NFT".to_string(), @@ -1216,9 +1218,9 @@ fn test_factory_with_funds_pass_through() { Addr::unchecked(CREATOR_ADDR), &InstantiateMsg { nft_contract: NftContract::Factory( - to_binary(&WasmMsg::Execute { + to_json_binary(&WasmMsg::Execute { contract_addr: factory_addr.to_string(), - msg: to_binary( + msg: to_json_binary( &dao_test_custom_factory::msg::ExecuteMsg::NftFactoryWithFunds { code_id: cw721_id, cw721_instantiate_msg: Cw721InstantiateMsg { @@ -1226,12 +1228,14 @@ fn test_factory_with_funds_pass_through() { symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }, - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { - owner: CREATOR_ADDR.to_string(), - token_uri: Some("https://example.com".to_string()), - token_id: "1".to_string(), - extension: Empty {}, - }) + initial_nfts: vec![to_json_binary( + &Cw721ExecuteMsg::::Mint { + owner: CREATOR_ADDR.to_string(), + token_uri: Some("https://example.com".to_string()), + token_id: "1".to_string(), + extension: Empty {}, + }, + ) .unwrap()], }, ) @@ -1261,9 +1265,9 @@ fn test_factory_with_funds_pass_through() { Addr::unchecked(CREATOR_ADDR), &InstantiateMsg { nft_contract: NftContract::Factory( - to_binary(&WasmMsg::Execute { + to_json_binary(&WasmMsg::Execute { contract_addr: factory_addr.to_string(), - msg: to_binary( + msg: to_json_binary( &dao_test_custom_factory::msg::ExecuteMsg::NftFactoryWithFunds { code_id: cw721_id, cw721_instantiate_msg: Cw721InstantiateMsg { @@ -1271,12 +1275,14 @@ fn test_factory_with_funds_pass_through() { symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }, - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { - owner: CREATOR_ADDR.to_string(), - token_uri: Some("https://example.com".to_string()), - token_id: "1".to_string(), - extension: Empty {}, - }) + initial_nfts: vec![to_json_binary( + &Cw721ExecuteMsg::::Mint { + owner: CREATOR_ADDR.to_string(), + token_uri: Some("https://example.com".to_string()), + token_id: "1".to_string(), + extension: Empty {}, + }, + ) .unwrap()], }, ) @@ -1310,9 +1316,9 @@ fn test_unsupported_factory_msg() { Addr::unchecked(CREATOR_ADDR), &InstantiateMsg { nft_contract: NftContract::Factory( - to_binary(&WasmMsg::Instantiate { + to_json_binary(&WasmMsg::Instantiate { code_id: cw721_id, - msg: to_binary(&dao_test_custom_factory::msg::ExecuteMsg::NftFactory { + msg: to_json_binary(&dao_test_custom_factory::msg::ExecuteMsg::NftFactory { code_id: cw721_id, cw721_instantiate_msg: Cw721InstantiateMsg { name: "Test NFT".to_string(), @@ -1368,9 +1374,9 @@ fn test_factory_wrong_callback() { Addr::unchecked(CREATOR_ADDR), &InstantiateMsg { nft_contract: NftContract::Factory( - to_binary(&WasmMsg::Execute { + to_json_binary(&WasmMsg::Execute { contract_addr: factory_addr.to_string(), - msg: to_binary( + msg: to_json_binary( &dao_test_custom_factory::msg::ExecuteMsg::NftFactoryWrongCallback {}, ) .unwrap(), @@ -1416,9 +1422,9 @@ fn test_factory_no_callback() { Addr::unchecked(CREATOR_ADDR), &InstantiateMsg { nft_contract: NftContract::Factory( - to_binary(&WasmMsg::Execute { + to_json_binary(&WasmMsg::Execute { contract_addr: factory_addr.to_string(), - msg: to_binary( + msg: to_json_binary( &dao_test_custom_factory::msg::ExecuteMsg::NftFactoryNoCallback {}, ) .unwrap(), diff --git a/contracts/voting/dao-voting-token-staked/src/contract.rs b/contracts/voting/dao-voting-token-staked/src/contract.rs index 93bb5c8e3..ffcba6902 100644 --- a/contracts/voting/dao-voting-token-staked/src/contract.rs +++ b/contracts/voting/dao-voting-token-staked/src/contract.rs @@ -2,8 +2,8 @@ use cosmwasm_std::entry_point; use cosmwasm_std::{ - coins, from_binary, to_binary, BankMsg, BankQuery, Binary, Coin, CosmosMsg, Deps, DepsMut, Env, - MessageInfo, Order, Reply, Response, StdResult, SubMsg, Uint128, Uint256, WasmMsg, + coins, from_json, to_json_binary, BankMsg, BankQuery, Binary, Coin, CosmosMsg, Deps, DepsMut, + Env, MessageInfo, Order, Reply, Response, StdResult, SubMsg, Uint128, Uint256, WasmMsg, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; use cw_controllers::ClaimsResponse; @@ -112,7 +112,7 @@ pub fn instantiate( WasmMsg::Instantiate { admin: Some(info.sender.to_string()), code_id: *token_issuer_code_id, - msg: to_binary(&IssuerInstantiateMsg::NewToken { + msg: to_json_binary(&IssuerInstantiateMsg::NewToken { subdenom: subdenom.to_string(), })?, funds: info.funds, @@ -126,7 +126,7 @@ pub fn instantiate( .add_attribute("token", "new_token") .add_submessage(issuer_instantiate_msg)) } - TokenInfo::Factory(binary) => match from_binary(&binary)? { + TokenInfo::Factory(binary) => match from_json(binary)? { WasmMsg::Execute { msg, contract_addr, @@ -389,16 +389,16 @@ pub fn execute_remove_hook( pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { QueryMsg::VotingPowerAtHeight { address, height } => { - to_binary(&query_voting_power_at_height(deps, env, address, height)?) + to_json_binary(&query_voting_power_at_height(deps, env, address, height)?) } QueryMsg::TotalPowerAtHeight { height } => { - to_binary(&query_total_power_at_height(deps, env, height)?) + to_json_binary(&query_total_power_at_height(deps, env, height)?) } QueryMsg::Info {} => query_info(deps), QueryMsg::Dao {} => query_dao(deps), - QueryMsg::Claims { address } => to_binary(&query_claims(deps, address)?), - QueryMsg::GetConfig {} => to_binary(&CONFIG.load(deps.storage)?), - QueryMsg::Denom {} => to_binary(&DenomResponse { + QueryMsg::Claims { address } => to_json_binary(&query_claims(deps, address)?), + QueryMsg::GetConfig {} => to_json_binary(&CONFIG.load(deps.storage)?), + QueryMsg::Denom {} => to_json_binary(&DenomResponse { denom: DENOM.load(deps.storage)?, }), QueryMsg::ListStakers { start_after, limit } => { @@ -406,8 +406,10 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { } QueryMsg::IsActive {} => query_is_active(deps), QueryMsg::ActiveThreshold {} => query_active_threshold(deps), - QueryMsg::GetHooks {} => to_binary(&query_hooks(deps)?), - QueryMsg::TokenContract {} => to_binary(&TOKEN_ISSUER_CONTRACT.may_load(deps.storage)?), + QueryMsg::GetHooks {} => to_json_binary(&query_hooks(deps)?), + QueryMsg::TokenContract {} => { + to_json_binary(&TOKEN_ISSUER_CONTRACT.may_load(deps.storage)?) + } } } @@ -439,12 +441,12 @@ pub fn query_total_power_at_height( pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } pub fn query_dao(deps: Deps) -> StdResult { let dao = DAO.load(deps.storage)?; - to_binary(&dao) + to_json_binary(&dao) } pub fn query_claims(deps: Deps, address: String) -> StdResult { @@ -471,7 +473,7 @@ pub fn query_list_stakers( }) .collect::>()?; - to_binary(&ListStakersResponse { stakers }) + to_json_binary(&ListStakersResponse { stakers }) } pub fn query_is_active(deps: Deps) -> StdResult { @@ -480,7 +482,7 @@ pub fn query_is_active(deps: Deps) -> StdResult { let denom = DENOM.load(deps.storage)?; let actual_power = STAKED_TOTAL.may_load(deps.storage)?.unwrap_or_default(); match threshold { - ActiveThreshold::AbsoluteCount { count } => to_binary(&IsActiveResponse { + ActiveThreshold::AbsoluteCount { count } => to_json_binary(&IsActiveResponse { active: actual_power >= count, }), ActiveThreshold::Percentage { percent } => { @@ -526,18 +528,18 @@ pub fn query_is_active(deps: Deps) -> StdResult { let rounded = (applied + Uint256::from(PRECISION_FACTOR) - Uint256::from(1u128)) / Uint256::from(PRECISION_FACTOR); let count: Uint128 = rounded.try_into().unwrap(); - to_binary(&IsActiveResponse { + to_json_binary(&IsActiveResponse { active: actual_power >= count, }) } } } else { - to_binary(&IsActiveResponse { active: true }) + to_json_binary(&IsActiveResponse { active: true }) } } pub fn query_active_threshold(deps: Deps) -> StdResult { - to_binary(&ActiveThresholdResponse { + to_json_binary(&ActiveThresholdResponse { active_threshold: ACTIVE_THRESHOLD.may_load(deps.storage)?, }) } @@ -615,7 +617,7 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result Result Result Result Result Result Result { // Parse info from the callback, this will fail // if incorrectly formatted. - let info: TokenFactoryCallback = from_binary(&data)?; + let info: TokenFactoryCallback = from_json(data)?; // Save Denom DENOM.save(deps.storage, &info.denom)?; @@ -748,7 +750,7 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result WasmMsg::Execute { contract_addr: address.to_string(), - msg: to_binary(&cw20::Cw20ExecuteMsg::Transfer { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::Transfer { recipient: who.to_string(), amount, })?, @@ -203,7 +203,8 @@ impl fmt::Display for CheckedDenom { mod tests { use cosmwasm_std::{ testing::{mock_dependencies, MockQuerier}, - to_binary, Addr, ContractResult, QuerierResult, StdError, SystemError, Uint128, WasmQuery, + to_json_binary, Addr, ContractResult, QuerierResult, StdError, SystemError, Uint128, + WasmQuery, }; use super::*; @@ -217,7 +218,7 @@ mod tests { if *contract_addr == CW20_ADDR { if works { QuerierResult::Ok(ContractResult::Ok( - to_binary(&cw20::TokenInfoResponse { + to_json_binary(&cw20::TokenInfoResponse { name: "coin".to_string(), symbol: "symbol".to_string(), decimals: 6, diff --git a/packages/cw-paginate-storage/README.md b/packages/cw-paginate-storage/README.md index 03a9d03eb..8ab92c658 100644 --- a/packages/cw-paginate-storage/README.md +++ b/packages/cw-paginate-storage/README.md @@ -18,7 +18,7 @@ pub const ITEMS: Map = Map::new("items"); You can use this package to write a query to list it's contents like: ```rust -use cosmwasm_std::{Deps, Binary, to_binary, StdResult}; +use cosmwasm_std::{Deps, Binary, to_json_binary, StdResult}; use cw_storage_plus::Map; use cw_paginate_storage::paginate_map; @@ -29,7 +29,7 @@ pub fn query_list_items( start_after: Option, limit: Option, ) -> StdResult { - to_binary(&paginate_map( + to_json_binary(&paginate_map( deps, &ITEMS, start_after, diff --git a/packages/cw-stake-tracker/src/lib.rs b/packages/cw-stake-tracker/src/lib.rs index fc9a774cf..b9c633966 100644 --- a/packages/cw-stake-tracker/src/lib.rs +++ b/packages/cw-stake-tracker/src/lib.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; -use cosmwasm_std::{to_binary, Binary, StdResult, Storage, Timestamp, Uint128}; +use cosmwasm_std::{to_json_binary, Binary, StdResult, Storage, Timestamp, Uint128}; use cw_wormhole::Wormhole; #[cfg(test)] @@ -261,12 +261,12 @@ impl<'a> StakeTracker<'a> { /// API. pub fn query(&self, storage: &dyn Storage, msg: StakeTrackerQuery) -> StdResult { match msg { - StakeTrackerQuery::Cardinality { t } => to_binary(&Uint128::new( + StakeTrackerQuery::Cardinality { t } => to_json_binary(&Uint128::new( self.validator_cardinality(storage, t)?.into(), )), - StakeTrackerQuery::TotalStaked { t } => to_binary(&self.total_staked(storage, t)?), + StakeTrackerQuery::TotalStaked { t } => to_json_binary(&self.total_staked(storage, t)?), StakeTrackerQuery::ValidatorStaked { validator, t } => { - to_binary(&self.validator_staked(storage, t, validator)?) + to_json_binary(&self.validator_staked(storage, t, validator)?) } } } diff --git a/packages/cw-stake-tracker/src/tests.rs b/packages/cw-stake-tracker/src/tests.rs index 3d0c46b37..2454f9af7 100644 --- a/packages/cw-stake-tracker/src/tests.rs +++ b/packages/cw-stake-tracker/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{from_binary, testing::mock_dependencies, Timestamp, Uint128}; +use cosmwasm_std::{from_json, testing::mock_dependencies, Timestamp, Uint128}; use crate::{StakeTracker, StakeTrackerQuery}; @@ -431,8 +431,8 @@ fn test_queries() { ) .unwrap(); - let cardinality: Uint128 = from_binary( - &st.query( + let cardinality: Uint128 = from_json( + st.query( storage, StakeTrackerQuery::Cardinality { t: Timestamp::from_seconds(11), @@ -443,8 +443,8 @@ fn test_queries() { .unwrap(); assert_eq!(cardinality, Uint128::one()); - let total_staked: Uint128 = from_binary( - &st.query( + let total_staked: Uint128 = from_json( + st.query( storage, StakeTrackerQuery::TotalStaked { t: Timestamp::from_seconds(10), @@ -455,8 +455,8 @@ fn test_queries() { .unwrap(); assert_eq!(total_staked, Uint128::new(42)); - let val_staked: Uint128 = from_binary( - &st.query( + let val_staked: Uint128 = from_json( + st.query( storage, StakeTrackerQuery::ValidatorStaked { t: Timestamp::from_seconds(10), @@ -468,8 +468,8 @@ fn test_queries() { .unwrap(); assert_eq!(val_staked, Uint128::new(42)); - let val_staked_before_staking: Uint128 = from_binary( - &st.query( + let val_staked_before_staking: Uint128 = from_json( + st.query( storage, StakeTrackerQuery::ValidatorStaked { t: Timestamp::from_seconds(9), diff --git a/packages/dao-hooks/src/nft_stake.rs b/packages/dao-hooks/src/nft_stake.rs index 9cebad29b..adae78ca7 100644 --- a/packages/dao-hooks/src/nft_stake.rs +++ b/packages/dao-hooks/src/nft_stake.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{to_binary, Addr, StdResult, Storage, SubMsg, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, StdResult, Storage, SubMsg, WasmMsg}; use cw_hooks::Hooks; /// An enum representing NFT staking hooks. @@ -17,7 +17,7 @@ pub fn stake_nft_hook_msgs( addr: Addr, token_id: String, ) -> StdResult> { - let msg = to_binary(&NftStakeChangedExecuteMsg::NftStakeChangeHook( + let msg = to_json_binary(&NftStakeChangedExecuteMsg::NftStakeChangeHook( NftStakeChangedHookMsg::Stake { addr, token_id }, ))?; hooks.prepare_hooks(storage, |a| { @@ -38,7 +38,7 @@ pub fn unstake_nft_hook_msgs( addr: Addr, token_ids: Vec, ) -> StdResult> { - let msg = to_binary(&NftStakeChangedExecuteMsg::NftStakeChangeHook( + let msg = to_json_binary(&NftStakeChangedExecuteMsg::NftStakeChangeHook( NftStakeChangedHookMsg::Unstake { addr, token_ids }, ))?; diff --git a/packages/dao-hooks/src/proposal.rs b/packages/dao-hooks/src/proposal.rs index 0b95758ad..6ccc7bd34 100644 --- a/packages/dao-hooks/src/proposal.rs +++ b/packages/dao-hooks/src/proposal.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{to_binary, StdResult, Storage, SubMsg, WasmMsg}; +use cosmwasm_std::{to_json_binary, StdResult, Storage, SubMsg, WasmMsg}; use cw_hooks::Hooks; use dao_voting::reply::mask_proposal_hook_index; @@ -28,7 +28,7 @@ pub fn new_proposal_hooks( id: u64, proposer: &str, ) -> StdResult> { - let msg = to_binary(&ProposalHookExecuteMsg::ProposalHook( + let msg = to_json_binary(&ProposalHookExecuteMsg::ProposalHook( ProposalHookMsg::NewProposal { id, proposer: proposer.to_string(), @@ -65,7 +65,7 @@ pub fn proposal_status_changed_hooks( return Ok(vec![]); } - let msg = to_binary(&ProposalHookExecuteMsg::ProposalHook( + let msg = to_json_binary(&ProposalHookExecuteMsg::ProposalHook( ProposalHookMsg::ProposalStatusChanged { id, old_status, diff --git a/packages/dao-hooks/src/stake.rs b/packages/dao-hooks/src/stake.rs index 6161bf2c9..f74203173 100644 --- a/packages/dao-hooks/src/stake.rs +++ b/packages/dao-hooks/src/stake.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{to_binary, Addr, StdResult, Storage, SubMsg, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, StdResult, Storage, SubMsg, Uint128, WasmMsg}; use cw_hooks::Hooks; /// An enum representing staking hooks. @@ -17,7 +17,7 @@ pub fn stake_hook_msgs( addr: Addr, amount: Uint128, ) -> StdResult> { - let msg = to_binary(&StakeChangedExecuteMsg::StakeChangeHook( + let msg = to_json_binary(&StakeChangedExecuteMsg::StakeChangeHook( StakeChangedHookMsg::Stake { addr, amount }, ))?; hooks.prepare_hooks(storage, |a| { @@ -38,7 +38,7 @@ pub fn unstake_hook_msgs( addr: Addr, amount: Uint128, ) -> StdResult> { - let msg = to_binary(&StakeChangedExecuteMsg::StakeChangeHook( + let msg = to_json_binary(&StakeChangedExecuteMsg::StakeChangeHook( StakeChangedHookMsg::Unstake { addr, amount }, ))?; hooks.prepare_hooks(storage, |a| { diff --git a/packages/dao-hooks/src/vote.rs b/packages/dao-hooks/src/vote.rs index b8a0dd772..9d5dedf3e 100644 --- a/packages/dao-hooks/src/vote.rs +++ b/packages/dao-hooks/src/vote.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{to_binary, StdResult, Storage, SubMsg, WasmMsg}; +use cosmwasm_std::{to_json_binary, StdResult, Storage, SubMsg, WasmMsg}; use cw_hooks::Hooks; use dao_voting::reply::mask_vote_hook_index; @@ -23,7 +23,7 @@ pub fn new_vote_hooks( voter: String, vote: String, ) -> StdResult> { - let msg = to_binary(&VoteHookExecuteMsg::VoteHook(VoteHookMsg::NewVote { + let msg = to_json_binary(&VoteHookExecuteMsg::VoteHook(VoteHookMsg::NewVote { proposal_id, voter, vote, diff --git a/packages/dao-interface/src/state.rs b/packages/dao-interface/src/state.rs index 0bd445de3..2022640eb 100644 --- a/packages/dao-interface/src/state.rs +++ b/packages/dao-interface/src/state.rs @@ -91,13 +91,13 @@ pub struct ModuleInstantiateCallback { mod tests { use super::*; - use cosmwasm_std::{to_binary, Addr, WasmMsg}; + use cosmwasm_std::{to_json_binary, Addr, WasmMsg}; #[test] fn test_module_instantiate_admin_none() { let no_admin = ModuleInstantiateInfo { code_id: 42, - msg: to_binary("foo").unwrap(), + msg: to_json_binary("foo").unwrap(), admin: None, label: "bar".to_string(), funds: vec![], @@ -107,7 +107,7 @@ mod tests { WasmMsg::Instantiate { admin: None, code_id: 42, - msg: to_binary("foo").unwrap(), + msg: to_json_binary("foo").unwrap(), funds: vec![], label: "bar".to_string() } @@ -118,7 +118,7 @@ mod tests { fn test_module_instantiate_admin_addr() { let no_admin = ModuleInstantiateInfo { code_id: 42, - msg: to_binary("foo").unwrap(), + msg: to_json_binary("foo").unwrap(), admin: Some(Admin::Address { addr: "core".to_string(), }), @@ -130,7 +130,7 @@ mod tests { WasmMsg::Instantiate { admin: Some("core".to_string()), code_id: 42, - msg: to_binary("foo").unwrap(), + msg: to_json_binary("foo").unwrap(), funds: vec![], label: "bar".to_string() } @@ -141,7 +141,7 @@ mod tests { fn test_module_instantiate_instantiator_addr() { let no_admin = ModuleInstantiateInfo { code_id: 42, - msg: to_binary("foo").unwrap(), + msg: to_json_binary("foo").unwrap(), admin: Some(Admin::CoreModule {}), label: "bar".to_string(), funds: vec![], @@ -151,7 +151,7 @@ mod tests { WasmMsg::Instantiate { admin: Some("ekez".to_string()), code_id: 42, - msg: to_binary("foo").unwrap(), + msg: to_json_binary("foo").unwrap(), funds: vec![], label: "bar".to_string() } diff --git a/packages/dao-pre-propose-base/src/execute.rs b/packages/dao-pre-propose-base/src/execute.rs index 225a465fe..8bbb51929 100644 --- a/packages/dao-pre-propose-base/src/execute.rs +++ b/packages/dao-pre-propose-base/src/execute.rs @@ -1,6 +1,7 @@ use cosmwasm_schema::schemars::JsonSchema; use cosmwasm_std::{ - to_binary, Addr, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, SubMsg, WasmMsg, + to_json_binary, Addr, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, SubMsg, + WasmMsg, }; use cw2::set_contract_version; @@ -138,7 +139,7 @@ where let propose_messsage = WasmMsg::Execute { contract_addr: proposal_module.into_string(), - msg: to_binary(&msg)?, + msg: to_json_binary(&msg)?, funds: vec![], }; @@ -147,7 +148,7 @@ where .prepare_hooks(deps.storage, |a| { let execute = WasmMsg::Execute { contract_addr: a.into_string(), - msg: to_binary(&msg)?, + msg: to_json_binary(&msg)?, funds: vec![], }; Ok(SubMsg::new(execute)) @@ -314,7 +315,7 @@ where Ok(Response::default() .add_attribute("method", "execute_proposal_completed_hook") .add_attribute("proposal", id.to_string()) - .add_attribute("deposit_info", to_binary(&deposit_info)?.to_string()) + .add_attribute("deposit_info", to_json_binary(&deposit_info)?.to_string()) .add_messages(messages)) } @@ -349,18 +350,20 @@ where pub fn query(&self, deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { match msg { - QueryMsg::ProposalModule {} => to_binary(&self.proposal_module.load(deps.storage)?), - QueryMsg::Dao {} => to_binary(&self.dao.load(deps.storage)?), - QueryMsg::Config {} => to_binary(&self.config.load(deps.storage)?), + QueryMsg::ProposalModule {} => { + to_json_binary(&self.proposal_module.load(deps.storage)?) + } + QueryMsg::Dao {} => to_json_binary(&self.dao.load(deps.storage)?), + QueryMsg::Config {} => to_json_binary(&self.config.load(deps.storage)?), QueryMsg::DepositInfo { proposal_id } => { let (deposit_info, proposer) = self.deposits.load(deps.storage, proposal_id)?; - to_binary(&DepositInfoResponse { + to_json_binary(&DepositInfoResponse { deposit_info, proposer, }) } QueryMsg::ProposalSubmittedHooks {} => { - to_binary(&self.proposal_submitted_hooks.query_hooks(deps)?) + to_json_binary(&self.proposal_submitted_hooks.query_hooks(deps)?) } QueryMsg::QueryExtension { .. } => Ok(Binary::default()), } diff --git a/packages/dao-pre-propose-base/src/tests.rs b/packages/dao-pre-propose-base/src/tests.rs index f04c6ed5a..c2f29284e 100644 --- a/packages/dao-pre-propose-base/src/tests.rs +++ b/packages/dao-pre-propose-base/src/tests.rs @@ -1,7 +1,7 @@ use cosmwasm_std::{ - from_binary, + from_json, testing::{mock_dependencies, mock_env, mock_info}, - to_binary, Addr, Binary, ContractResult, Empty, Response, SubMsg, WasmMsg, + to_json_binary, Addr, Binary, ContractResult, Empty, Response, SubMsg, WasmMsg, }; use cw_hooks::HooksResponse; use dao_voting::status::Status; @@ -97,8 +97,8 @@ fn test_proposal_submitted_hooks() { module .execute_add_proposal_submitted_hook(deps.as_mut(), info, "one".to_string()) .unwrap(); - let hooks: HooksResponse = from_binary( - &module + let hooks: HooksResponse = from_json( + module .query( deps.as_ref(), mock_env(), @@ -118,7 +118,7 @@ fn test_proposal_submitted_hooks() { deps.querier.update_wasm(|_| { // for responding to the next proposal ID query that gets fired by propose. - cosmwasm_std::SystemResult::Ok(ContractResult::Ok(to_binary(&1u64).unwrap())) + cosmwasm_std::SystemResult::Ok(ContractResult::Ok(to_json_binary(&1u64).unwrap())) }); // The hooks fire when a proposal is created. @@ -136,7 +136,7 @@ fn test_proposal_submitted_hooks() { res.messages[1], SubMsg::new(WasmMsg::Execute { contract_addr: "one".to_string(), - msg: to_binary(&Empty::default()).unwrap(), + msg: to_json_binary(&Empty::default()).unwrap(), funds: vec![], }) ); @@ -153,8 +153,8 @@ fn test_proposal_submitted_hooks() { module .execute_remove_proposal_submitted_hook(deps.as_mut(), info, "one".to_string()) .unwrap(); - let hooks: HooksResponse = from_binary( - &module + let hooks: HooksResponse = from_json( + module .query( deps.as_ref(), mock_env(), diff --git a/packages/dao-testing/src/helpers.rs b/packages/dao-testing/src/helpers.rs index 9bccd53c7..b629e7ba0 100644 --- a/packages/dao-testing/src/helpers.rs +++ b/packages/dao-testing/src/helpers.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, Addr, Binary, Uint128}; +use cosmwasm_std::{to_json_binary, Addr, Binary, Uint128}; use cw20::Cw20Coin; use cw_multi_test::{App, Executor}; use cw_utils::Duration; @@ -57,7 +57,7 @@ pub fn instantiate_with_cw20_balances_governance( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw20_balance::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_balance::msg::InstantiateMsg { token_info: dao_voting_cw20_balance::msg::TokenInfo::New { code_id: cw20_id, label: "DAO DAO governance token".to_string(), @@ -138,7 +138,7 @@ pub fn instantiate_with_staked_balances_governance( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: staked_balances_voting_id, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { active_threshold: None, token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: cw20_id, @@ -211,7 +211,7 @@ pub fn instantiate_with_staked_balances_governance( &cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount, - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -259,7 +259,7 @@ pub fn instantiate_with_staking_active_threshold( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: cw20_id, label: "DAO DAO governance token".to_string(), @@ -342,7 +342,7 @@ pub fn instantiate_with_cw4_groups_governance( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw4::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw4::msg::InstantiateMsg { group_contract: GroupContract::New { cw4_group_code_id: cw4_id, initial_members: initial_weights, diff --git a/packages/dao-voting/src/deposit.rs b/packages/dao-voting/src/deposit.rs index bf0852ea8..33fbb832c 100644 --- a/packages/dao-voting/src/deposit.rs +++ b/packages/dao-voting/src/deposit.rs @@ -1,6 +1,6 @@ use cosmwasm_schema::cw_serde; use cosmwasm_std::{ - to_binary, Addr, CosmosMsg, Deps, MessageInfo, StdError, StdResult, Uint128, WasmMsg, + to_json_binary, Addr, CosmosMsg, Deps, MessageInfo, StdError, StdResult, Uint128, WasmMsg, }; use cw_utils::{must_pay, PaymentError}; @@ -170,7 +170,7 @@ impl CheckedDepositInfo { vec![WasmMsg::Execute { contract_addr: address.to_string(), funds: vec![], - msg: to_binary(&cw20::Cw20ExecuteMsg::TransferFrom { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::TransferFrom { owner: depositor.to_string(), recipient: contract.to_string(), amount: *amount, @@ -312,7 +312,7 @@ pub mod tests { messages, vec![CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: CW20.to_string(), - msg: to_binary(&cw20::Cw20ExecuteMsg::TransferFrom { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::TransferFrom { owner: "ekez".to_string(), recipient: "contract".to_string(), amount: Uint128::new(10) @@ -371,7 +371,7 @@ pub mod tests { messages, vec![CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: CW20.to_string(), - msg: to_binary(&cw20::Cw20ExecuteMsg::Transfer { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::Transfer { recipient: "ekez".to_string(), amount: Uint128::new(10) }) diff --git a/packages/dao-voting/src/pre_propose.rs b/packages/dao-voting/src/pre_propose.rs index 7671425a3..482bf9260 100644 --- a/packages/dao-voting/src/pre_propose.rs +++ b/packages/dao-voting/src/pre_propose.rs @@ -60,7 +60,7 @@ impl PreProposeInfo { #[cfg(test)] mod tests { - use cosmwasm_std::{to_binary, WasmMsg}; + use cosmwasm_std::{to_json_binary, WasmMsg}; use super::*; @@ -114,7 +114,7 @@ mod tests { let info = PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: 42, - msg: to_binary("foo").unwrap(), + msg: to_json_binary("foo").unwrap(), admin: None, funds: vec![], label: "pre-propose-9000".to_string(), @@ -136,7 +136,7 @@ mod tests { WasmMsg::Instantiate { admin: None, code_id: 42, - msg: to_binary("foo").unwrap(), + msg: to_json_binary("foo").unwrap(), funds: vec![], label: "pre-propose-9000".to_string() },