diff --git a/Cargo.lock b/Cargo.lock index 55b685a4d..9bc8c76a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,11 +2,26 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "aes" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if", "cipher", @@ -37,24 +52,24 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "0f2135563fb5c609d2b2b87c1e8ce7bc41b0b45430fa9661f457981503dd5bf0" dependencies = [ "memchr", ] [[package]] name = "anyhow" -version = "1.0.69" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "assert_matches" @@ -64,9 +79,9 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-channel" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", "event-listener", @@ -75,9 +90,9 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" +checksum = "6fa3dc5f2a8564f07759c008b9109dc0d39de92a88d5588b8a5036d286383afb" dependencies = [ "async-lock", "async-task", @@ -104,29 +119,29 @@ dependencies = [ [[package]] name = "async-io" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ "async-lock", "autocfg", + "cfg-if", "concurrent-queue", "futures-lite", - "libc", "log", "parking", "polling", + "rustix", "slab", - "socket2", + "socket2 0.4.9", "waker-fn", - "windows-sys 0.42.0", ] [[package]] name = "async-lock" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ "event-listener", ] @@ -159,9 +174,9 @@ dependencies = [ [[package]] name = "async-stream" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad445822218ce64be7a341abfb0b1ea43b5c23aa83902542a4542e78309d8e5e" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" dependencies = [ "async-stream-impl", "futures-core", @@ -170,37 +185,37 @@ dependencies = [ [[package]] name = "async-stream-impl" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4655ae1a7b0cdf149156f780c5bf3f1352bc53cbd9e0a361a7ef7b22947e965" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "async-task" -version = "4.3.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" +checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" [[package]] name = "async-trait" -version = "0.1.66" +version = "0.1.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b84f9ebcc6c1f5b8cb160f6990096a5c127f423fcb6e1ccc46c370cbdfb75dfc" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "atomic-waker" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599" +checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" [[package]] name = "atty" @@ -215,14 +230,14 @@ dependencies = [ [[package]] name = "auto_impl" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a8c1df849285fbacd587de7818cc7d13be6cd2cbcd47a04fb1801b0e2706e33" +checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -233,9 +248,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "axum" -version = "0.6.11" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d8068b6ccb8b34db9de397c7043f91db8b4c66414952c6db944f238c4d3db3" +checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" dependencies = [ "async-trait", "axum-core", @@ -261,9 +276,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f958c80c248b34b9a877a643811be8dbca03ca5ba827f2b63baf3a81e5fc4e" +checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" dependencies = [ "async-trait", "bytes", @@ -276,6 +291,21 @@ dependencies = [ "tower-service", ] +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "base-factory" version = "3.4.0" @@ -397,7 +427,7 @@ dependencies = [ "pbkdf2", "rand_core 0.6.4", "ripemd", - "sha2 0.10.6", + "sha2 0.10.7", "subtle", "zeroize", ] @@ -436,7 +466,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -457,7 +487,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] @@ -466,7 +496,7 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] @@ -480,9 +510,9 @@ dependencies = [ [[package]] name = "blocking" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8" +checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65" dependencies = [ "async-channel", "async-lock", @@ -490,6 +520,7 @@ dependencies = [ "atomic-waker", "fastrand", "futures-lite", + "log", ] [[package]] @@ -500,9 +531,9 @@ checksum = "128a44527fc0d6abf05f9eda748b9027536e12dff93f5acc8449f51583309350" [[package]] name = "borsh" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40f9ca3698b2e4cb7c15571db0abc5551dca417a21ae8140460b50309bb2cc62" +checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" dependencies = [ "borsh-derive", "hashbrown 0.13.2", @@ -510,37 +541,37 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598b3eacc6db9c3ee57b22707ad8f6a8d2f6d442bfe24ffeb8cbb70ca59e6a35" +checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7" dependencies = [ "borsh-derive-internal", "borsh-schema-derive-internal", "proc-macro-crate 0.1.5", "proc-macro2", - "syn", + "syn 1.0.109", ] [[package]] name = "borsh-derive-internal" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186b734fa1c9f6743e90c95d7233c9faab6360d1a96d4ffa19d9cfd1e9350f8a" +checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "borsh-schema-derive-internal" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b7ff1008316626f485991b960ade129253d4034014616b94f309a15366cc49" +checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -554,9 +585,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byte-slice-cast" @@ -572,9 +603,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "bytecheck" -version = "0.6.10" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13fe11640a23eb24562225322cd3e452b93a3d4091d62fab69c70542fcd17d1f" +checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" dependencies = [ "bytecheck_derive", "ptr_meta", @@ -583,13 +614,13 @@ dependencies = [ [[package]] name = "bytecheck_derive" -version = "0.6.10" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31225543cb46f81a7e224762764f4a6a0f097b1db0b175f69e8065efaa42de5" +checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -600,18 +631,21 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" dependencies = [ "serde", ] [[package]] name = "cc" -version = "1.0.79" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cfg-if" @@ -621,11 +655,10 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.24" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ - "num-integer", "num-traits", ] @@ -648,13 +681,13 @@ dependencies = [ "bincode", "bs58", "coins-core", - "digest 0.10.6", + "digest 0.10.7", "getrandom", "hmac", "k256 0.11.6", "lazy_static", "serde", - "sha2 0.10.6", + "sha2 0.10.7", "thiserror", ] @@ -671,7 +704,7 @@ dependencies = [ "hmac", "pbkdf2", "rand", - "sha2 0.10.6", + "sha2 0.10.7", "thiserror", ] @@ -685,22 +718,22 @@ dependencies = [ "base64 0.12.3", "bech32", "blake2", - "digest 0.10.6", - "generic-array 0.14.6", + "digest 0.10.7", + "generic-array 0.14.7", "hex", "ripemd", "serde", "serde_derive", - "sha2 0.10.6", + "sha2 0.10.7", "sha3", "thiserror", ] [[package]] name = "concurrent-queue" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c278839b831783b70278b14df4d45e1beb1aad306c07bb796637de9a0e323e8e" +checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" dependencies = [ "crossbeam-utils", ] @@ -726,9 +759,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.2" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "convert_case" @@ -751,9 +784,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cosm-orc" @@ -792,7 +825,7 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "673d31bd830c0772d78545de20d975129b6ab2f7db4e4e9313c3b8777d319194" dependencies = [ - "prost 0.11.8", + "prost 0.11.9", "prost-types", "tendermint-proto", "tonic", @@ -825,7 +858,7 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ca101fbf2f76723711a30ea3771ef312ec3ec254ad021b237871ed802f9f175" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", "ed25519-zebra", "k256 0.13.1", "rand_core 0.6.4", @@ -838,7 +871,7 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c73d2dd292f60e42849d2b07c03d809cf31e128a4299a805abd6d24553bcaaf5" dependencies = [ - "syn", + "syn 1.0.109", ] [[package]] @@ -862,7 +895,7 @@ checksum = "96694ec781a7dd6dea1f968a2529ade009c21ad999c88b5f53d6cc495b3b96f7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -881,24 +914,24 @@ dependencies = [ "schemars", "serde", "serde-json-wasm", - "sha2 0.10.6", + "sha2 0.10.7", "thiserror", ] [[package]] name = "cpufeatures" -version = "0.2.5" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] @@ -915,7 +948,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", "rand_core 0.6.4", "subtle", "zeroize", @@ -927,7 +960,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", "rand_core 0.6.4", "subtle", "zeroize", @@ -939,7 +972,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", "typenum", ] @@ -952,16 +985,6 @@ dependencies = [ "sct", ] -[[package]] -name = "ctor" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" -dependencies = [ - "quote", - "syn", -] - [[package]] name = "ctr" version = "0.9.2" @@ -1025,9 +1048,9 @@ dependencies = [ [[package]] name = "cw-multi-test" -version = "0.16.2" +version = "0.16.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2eb84554bbfa6b66736abcd6a9bfdf237ee0ecb83910f746dff7f799093c80a" +checksum = "127c7bb95853b8e828bdab97065c81cb5ddc20f7339180b61b2300565aaa99d1" dependencies = [ "anyhow", "cosmwasm-std", @@ -1065,7 +1088,7 @@ checksum = "a1d3bf2e0f341bb6cc100d7d441d31cf713fbd3ce0c511f91e79f14b40a889af" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1260,6 +1283,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "deranged" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" + [[package]] name = "derivative" version = "2.2.0" @@ -1268,7 +1297,7 @@ checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1279,7 +1308,7 @@ checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1297,14 +1326,14 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", "const-oid", @@ -1320,9 +1349,9 @@ checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" [[package]] name = "dyn-clone" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" +checksum = "bbfc4744c1b8f2a09adc0e55242f60b1af195d88596bd8700be74418c056c555" [[package]] name = "e2e" @@ -1362,12 +1391,12 @@ dependencies = [ [[package]] name = "ecdsa" -version = "0.16.7" +version = "0.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" dependencies = [ "der 0.7.8", - "digest 0.10.6", + "digest 0.10.7", "elliptic-curve 0.13.5", "rfc6979 0.4.0", "signature 2.1.0", @@ -1412,9 +1441,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "elliptic-curve" @@ -1425,9 +1454,9 @@ dependencies = [ "base16ct 0.1.1", "crypto-bigint 0.4.9", "der 0.6.1", - "digest 0.10.6", + "digest 0.10.7", "ff 0.12.1", - "generic-array 0.14.6", + "generic-array 0.14.7", "group 0.12.1", "pkcs8 0.9.0", "rand_core 0.6.4", @@ -1444,13 +1473,13 @@ checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" dependencies = [ "base16ct 0.2.0", "crypto-bigint 0.5.3", - "digest 0.10.6", + "digest 0.10.7", "ff 0.13.0", - "generic-array 0.14.6", + "generic-array 0.14.7", "group 0.13.0", "pkcs8 0.10.2", "rand_core 0.6.4", - "sec1 0.7.1", + "sec1 0.7.3", "subtle", "zeroize", ] @@ -1468,15 +1497,42 @@ dependencies = [ "termcolor", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "erased-serde" -version = "0.3.25" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f2b0c2380453a92ea8b6c8e5f64ecaafccddde8ceab55ff7a8ac1029f894569" +checksum = "6c138974f9d5e7fe373eb04df7cae98833802ae4b11c24ac7039a21d5af4b26c" dependencies = [ "serde", ] +[[package]] +name = "errno" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +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 = "eth-keystore" version = "0.5.0" @@ -1485,7 +1541,7 @@ checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" dependencies = [ "aes", "ctr", - "digest 0.10.6", + "digest 0.10.7", "hex", "hmac", "pbkdf2", @@ -1493,10 +1549,10 @@ dependencies = [ "scrypt", "serde", "serde_json", - "sha2 0.10.6", + "sha2 0.10.7", "sha3", "thiserror", - "uuid", + "uuid 0.8.2", ] [[package]] @@ -1554,7 +1610,7 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "hex", - "sha2 0.10.6", + "sha2 0.10.7", "sha3", ] @@ -1570,7 +1626,7 @@ dependencies = [ "convert_case", "elliptic-curve 0.12.3", "ethabi", - "generic-array 0.14.6", + "generic-array 0.14.7", "hex", "k256 0.11.6", "open-fastrlp", @@ -1581,7 +1637,7 @@ dependencies = [ "serde", "serde_json", "strum", - "syn", + "syn 1.0.109", "thiserror", "tiny-keccak", "unicode-xid", @@ -1601,7 +1657,7 @@ dependencies = [ "ethers-core", "hex", "rand", - "sha2 0.10.6", + "sha2 0.10.7", "thiserror", ] @@ -1686,9 +1742,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -1707,9 +1763,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "531ac96c6ff5fd7c62263c5e3c67a603af4fcaee2e1a0ae5565ba3a11e69e549" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" dependencies = [ "futures-channel", "futures-core", @@ -1722,9 +1778,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "164713a5a0dcc3e7b4b1ed7d3b433cabc18025386f9339346e8daf15963cf7ac" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", "futures-sink", @@ -1732,15 +1788,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d7a0c1aa76363dac491de0ee99faf6941128376f1cf96f07db7603b7de69dd" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] name = "futures-executor" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1997dd9df74cdac935c76252744c1ed5794fac083242ea4fe77ef3ed60ba0f83" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" dependencies = [ "futures-core", "futures-task", @@ -1749,15 +1805,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d422fa3cbe3b40dca574ab087abb5bc98258ea57eea3fd6f1fa7162c778b91" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" [[package]] name = "futures-lite" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ "fastrand", "futures-core", @@ -1770,32 +1826,32 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eb14ed937631bd8b8b8977f2c198443447a8355b6e3ca599f38c975e5a963b6" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "futures-sink" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec93083a4aecafb2a80a885c9de1f0ccae9dbd32c2bb54b0c3a65690e0b8d2f2" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" [[package]] name = "futures-task" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd65540d33b37b16542a0438c12e6aeead10d4ac5d05bd3f805b8f35ab592879" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] name = "futures-util" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ef6b17e481503ec85211fed8f39d1970f128935ca1f814cd32ac4a6842e84ab" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-channel", "futures-core", @@ -1820,9 +1876,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.6" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", @@ -1831,9 +1887,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "js-sys", @@ -1842,6 +1898,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" + [[package]] name = "gloo-timers" version = "0.2.6" @@ -1878,9 +1940,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.16" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes", "fnv", @@ -1888,7 +1950,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -1913,14 +1975,19 @@ dependencies = [ "ahash 0.8.3", ] +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + [[package]] name = "headers" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3e372db8e5c0d213e0cd0b9be18be2aca3d44cf2fe30a9d46a65581cd454584" +checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" dependencies = [ - "base64 0.13.1", - "bitflags", + "base64 0.21.4", "bytes", "headers-core", "http", @@ -1955,12 +2022,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.2.6" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "hex" @@ -1974,7 +2038,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -2007,9 +2071,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "humantime" @@ -2019,9 +2083,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.25" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", @@ -2034,7 +2098,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.4.9", "tokio", "tower-service", "tracing", @@ -2092,9 +2156,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -2135,7 +2199,7 @@ checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -2146,21 +2210,31 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown 0.12.3", ] +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + [[package]] name = "inout" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] @@ -2172,6 +2246,17 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi 0.3.2", + "libc", + "windows-sys", +] + [[package]] name = "itertools" version = "0.10.5" @@ -2183,15 +2268,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -2216,7 +2301,7 @@ dependencies = [ "cfg-if", "ecdsa 0.14.8", "elliptic-curve 0.12.3", - "sha2 0.10.6", + "sha2 0.10.7", "sha3", ] @@ -2227,18 +2312,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ "cfg-if", - "ecdsa 0.16.7", + "ecdsa 0.16.8", "elliptic-curve 0.13.5", "once_cell", - "sha2 0.10.6", + "sha2 0.10.7", "signature 2.1.0", ] [[package]] name = "keccak" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" dependencies = [ "cpufeatures", ] @@ -2260,9 +2345,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.140" +version = "0.2.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" [[package]] name = "linked-hash-map" @@ -2270,33 +2355,38 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + [[package]] name = "log" -version = "0.4.17" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" dependencies = [ - "cfg-if", "value-bag", ] [[package]] name = "matchit" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" +checksum = "ed1202b2a6f884ae56f04cff409ab315c5ce26b5e58d7412e484f01fd52f52ef" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "mime" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "minimal-lexical" @@ -2304,16 +2394,24 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + [[package]] name = "mio" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] @@ -2334,43 +2432,42 @@ checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] -name = "num-integer" -version = "0.1.45" +name = "num-traits" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", - "num-traits", ] [[package]] -name = "num-traits" -version = "0.2.15" +name = "num_cpus" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "autocfg", + "hermit-abi 0.3.2", + "libc", ] [[package]] -name = "num_cpus" -version = "1.15.0" +name = "object" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ - "hermit-abi 0.2.6", - "libc", + "memchr", ] [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -2447,7 +2544,7 @@ dependencies = [ "bytes", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -2468,9 +2565,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.4.0" +version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" +checksum = "0dec8a8073036902368c2cdc0387e85ff9a37054d7e7c98e592145e0c92cd4fb" dependencies = [ "arrayvec", "bitvec 1.0.1", @@ -2482,21 +2579,21 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.4" +version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" +checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "parking" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" +checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" [[package]] name = "password-hash" @@ -2511,9 +2608,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pathdiff" @@ -2527,10 +2624,10 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", "hmac", "password-hash", - "sha2 0.10.6", + "sha2 0.10.7", ] [[package]] @@ -2562,25 +2659,26 @@ checksum = "c719dcf55f09a3a7e764c6649ab594c18a177e3599c467983cdf644bfc0a4088" [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.5.6" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cbd939b234e95d72bc393d51788aec68aeeb5d51e748ca08ff3aad58cb722f7" +checksum = "d7a4d085fd991ac8d5b05a147b437791b4260b76326baf0fc60cf7c9c27ecd33" dependencies = [ + "memchr", "thiserror", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.5.6" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a81186863f3d0a27340815be8f2078dd8050b14cd71913db9fbda795e5f707d7" +checksum = "a2bee7be22ce7918f641a33f08e3f43388c7656772244e2bbb2477f44cc9021a" dependencies = [ "pest", "pest_generator", @@ -2588,53 +2686,53 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.5.6" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75a1ef20bf3193c15ac345acb32e26b3dc3223aff4d77ae4fc5359567683796b" +checksum = "d1511785c5e98d79a05e8a6bc34b4ac2168a0e3e92161862030ad84daa223141" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "pest_meta" -version = "2.5.6" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e3b284b1f13a20dc5ebc90aff59a51b8d7137c221131b52a7260c08cbc1cc80" +checksum = "b42f0394d3123e33353ca5e1e89092e533d2cc490389f2bd6131c43c634ebc5f" dependencies = [ "once_cell", "pest", - "sha2 0.10.6", + "sha2 0.10.7", ] [[package]] name = "pin-project" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -2664,9 +2762,9 @@ dependencies = [ [[package]] name = "polling" -version = "2.6.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e1f879b2998099c2d69ab9605d145d5b661195627eccc680002c4918a7fb6fa" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg", "bitflags", @@ -2675,7 +2773,7 @@ dependencies = [ "libc", "log", "pin-project-lite", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] @@ -2726,7 +2824,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "version_check", ] @@ -2743,9 +2841,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -2762,12 +2860,12 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48e50df39172a3e7eb17e14642445da64996989bc212b583015435d39a58537" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ "bytes", - "prost-derive 0.11.8", + "prost-derive 0.11.9", ] [[package]] @@ -2780,29 +2878,29 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "prost-derive" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea9b0f8cbe5e15a8a042d030bd96668db28ecb567ec37d691971ff5731d2b1b" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", "itertools", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "prost-types" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "379119666929a1afd7a043aa6cf96fa67a6dce9af60c88095a4686dbce4c9c88" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" dependencies = [ - "prost 0.11.8", + "prost 0.11.9", ] [[package]] @@ -2822,14 +2920,14 @@ checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -2893,9 +2991,21 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.1" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" dependencies = [ "aho-corasick", "memchr", @@ -2904,9 +3014,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.28" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "rend" @@ -2959,7 +3069,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -2975,27 +3085,30 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.7.40" +version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c30f1d45d9aa61cbc8cd1eb87705470892289bb2d01943e7803b873a57404dc3" +checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" dependencies = [ + "bitvec 1.0.1", "bytecheck", "hashbrown 0.12.3", "ptr_meta", "rend", "rkyv_derive", "seahash", + "tinyvec", + "uuid 1.4.1", ] [[package]] name = "rkyv_derive" -version = "0.7.40" +version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff26ed6c7c4dfc2aa9480b86a60e3c7233543a270a680e10758a507c5a4ce476" +checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -3016,7 +3129,7 @@ checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -3030,6 +3143,15 @@ dependencies = [ "serde", ] +[[package]] +name = "rs_merkle" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05225752ca6ede4cb1b73aa37ce3904affd042e98f28246f56f438ebfd47a810" +dependencies = [ + "sha2 0.10.7", +] + [[package]] name = "rust-ini" version = "0.18.0" @@ -3042,14 +3164,12 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.29.0" +version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b1b21b8760b0ef8ae5b43d40913ff711a2053cb7ff892a34facff7a6365375a" +checksum = "a4c4216490d5a413bc6d10fa4742bd7d4955941d062c0ef873141d6b0e7b30fd" dependencies = [ "arrayvec", "borsh", - "bytecheck", - "byteorder", "bytes", "num-traits", "rand", @@ -3058,12 +3178,32 @@ dependencies = [ "serde_json", ] +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + [[package]] name = "rustc-hex" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +[[package]] +name = "rustix" +version = "0.37.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "rustls" version = "0.19.1" @@ -3091,15 +3231,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "salsa20" @@ -3121,9 +3261,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.3.1" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" +checksum = "35c0a159d0c45c12b20c5a844feb1fe4bea86e28f17b92a5f0c42193634d3782" dependencies = [ "cfg-if", "derive_more", @@ -3133,30 +3273,30 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.3.1" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" +checksum = "912e55f6d20e0e80d63733872b40e1227c0bce1e1ab81ba67d696339bfd7fd29" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "schannel" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys 0.42.0", + "windows-sys", ] [[package]] name = "schemars" -version = "0.8.12" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" +checksum = "1f7b0ce13155372a76ee2e1c5ffba1fe61ede73fbea5630d61eee6fac4929c0c" dependencies = [ "dyn-clone", "schemars_derive", @@ -3166,14 +3306,14 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.12" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" +checksum = "e85e2a16b12bdb763244c69ab79363d71db2b4b918a2def53f80b02e0574b13c" dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn", + "syn 1.0.109", ] [[package]] @@ -3185,7 +3325,7 @@ dependencies = [ "hmac", "pbkdf2", "salsa20", - "sha2 0.10.6", + "sha2 0.10.7", ] [[package]] @@ -3212,7 +3352,7 @@ checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ "base16ct 0.1.1", "der 0.6.1", - "generic-array 0.14.6", + "generic-array 0.14.7", "pkcs8 0.9.0", "subtle", "zeroize", @@ -3220,13 +3360,13 @@ dependencies = [ [[package]] name = "sec1" -version = "0.7.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48518a2b5775ba8ca5b46596aae011caa431e6ce7e4a67ead66d92f08884220e" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct 0.2.0", "der 0.7.8", - "generic-array 0.14.6", + "generic-array 0.14.7", "pkcs8 0.10.2", "subtle", "zeroize", @@ -3234,9 +3374,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.8.2" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags", "core-foundation", @@ -3247,9 +3387,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.8.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys", "libc", @@ -3257,46 +3397,46 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" [[package]] name = "serde" -version = "1.0.156" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "314b5b092c0ade17c00142951e50ced110ec27cea304b1037c6969246c2469a4" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" dependencies = [ "serde_derive", ] [[package]] name = "serde-json-wasm" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15bee9b04dd165c3f4e142628982ddde884c2022a89e8ddf99c4829bf2c3a58" +checksum = "16a62a1fad1e1828b24acac8f2b468971dade7b8c3c2e672bcadefefb1f8c137" dependencies = [ "serde", ] [[package]] name = "serde_bytes" -version = "0.11.9" +version = "0.11.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416bda436f9aab92e02c8e10d49a15ddd339cea90b6e340fe51ed97abb548294" +checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.156" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7e29c4601e36bcec74a223228dce795f4cd3616341a4af93520ca1a837c087d" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] @@ -3307,14 +3447,14 @@ checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "serde_json" -version = "1.0.94" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ "itoa", "ryu", @@ -3323,13 +3463,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.11" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395627de918015623b32e7669714206363a7fc00382bf477e72c1f7533e8eafc" +checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] @@ -3373,7 +3513,7 @@ dependencies = [ "sg1", "sg2", "sg721-base", - "sha2 0.10.6", + "sha2 0.10.7", "sha3", "thiserror", "vending-factory", @@ -3412,7 +3552,7 @@ dependencies = [ "proc-macro2", "quote", "sg-controllers", - "syn", + "syn 1.0.109", ] [[package]] @@ -3630,7 +3770,7 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -3660,22 +3800,22 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] name = "sha3" -version = "0.10.6" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", "keccak", ] @@ -3694,7 +3834,7 @@ version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", "rand_core 0.6.4", ] @@ -3704,7 +3844,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", "rand_core 0.6.4", ] @@ -3716,9 +3856,9 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] @@ -3733,6 +3873,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "socket2" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +dependencies = [ + "libc", + "windows-sys", +] + [[package]] name = "spin" version = "0.5.2" @@ -3784,14 +3934,14 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn", + "syn 1.0.109", ] [[package]] name = "subtle" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "subtle-encoding" @@ -3814,23 +3964,22 @@ dependencies = [ ] [[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - -[[package]] -name = "synstructure" -version = "0.12.6" +name = "syn" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", - "syn", - "unicode-xid", + "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "tap" version = "1.0.1" @@ -3852,7 +4001,7 @@ dependencies = [ "k256 0.11.6", "num-traits", "once_cell", - "prost 0.11.8", + "prost 0.11.9", "prost-types", "ripemd160", "serde", @@ -3892,7 +4041,7 @@ dependencies = [ "flex-error", "num-derive", "num-traits", - "prost 0.11.8", + "prost 0.11.9", "prost-types", "serde", "serde_bytes", @@ -3930,7 +4079,7 @@ dependencies = [ "tokio", "tracing", "url", - "uuid", + "uuid 0.8.2", "walkdir", ] @@ -3961,7 +4110,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8901a55b0a7a06ebc4a674dcca925170da8e613fa3b163a1df804ed10afb154d" dependencies = [ "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -3991,6 +4140,7 @@ dependencies = [ "rand_core 0.6.4", "rand_xoshiro", "rlp", + "rs_merkle", "schemars", "serde", "sg-controllers", @@ -4007,41 +4157,44 @@ dependencies = [ "sg721-base", "sg721-nt", "sg721-updatable", - "sha2 0.10.6", + "sha2 0.10.7", "shuffle", "thiserror", "url", "vending-factory", "vending-minter", + "vending-minter-merkle-wl", "whitelist-immutable", + "whitelist-mtree", ] [[package]] name = "thiserror" -version = "1.0.39" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c" +checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.39" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" +checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "time" -version = "0.3.20" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" +checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" dependencies = [ + "deranged", "serde", "time-core", "time-macros", @@ -4049,15 +4202,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.8" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" +checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" dependencies = [ "time-core", ] @@ -4088,20 +4241,19 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.26.0" +version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" dependencies = [ - "autocfg", + "backtrace", "bytes", "libc", - "memchr", "mio", "num_cpus", "pin-project-lite", - "socket2", + "socket2 0.5.4", "tokio-macros", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] @@ -4116,13 +4268,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.8.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] @@ -4138,9 +4290,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.12" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb52b74f05dbf495a8fba459fdc331812b96aa086d9eb78101fa0d4569c3313" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ "futures-core", "pin-project-lite", @@ -4149,9 +4301,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" dependencies = [ "bytes", "futures-core", @@ -4172,17 +4324,17 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" [[package]] name = "toml_edit" -version = "0.19.7" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc18466501acd8ac6a3f615dd29a3438f8ca6bb3b19537138b3106e575621274" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap", + "indexmap 2.0.0", "toml_datetime", "winnow", ] @@ -4207,8 +4359,8 @@ dependencies = [ "hyper-timeout", "percent-encoding", "pin-project", - "prost 0.11.8", - "prost-derive 0.11.8", + "prost 0.11.9", + "prost-derive 0.11.9", "tokio", "tokio-stream", "tokio-util", @@ -4227,7 +4379,7 @@ checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ "futures-core", "futures-util", - "indexmap", + "indexmap 1.9.3", "pin-project", "pin-project-lite", "rand", @@ -4265,20 +4417,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.23" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "tracing-core" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", ] @@ -4301,15 +4453,15 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ucd-trie" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" [[package]] name = "uint" @@ -4325,15 +4477,15 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.11" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524b68aca1d05e03fdf03fcdce2c6c94b6daf6d16861ddaa7e4f2b6638a9052c" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -4364,9 +4516,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.3.1" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -4383,15 +4535,17 @@ dependencies = [ "serde", ] +[[package]] +name = "uuid" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" + [[package]] name = "value-bag" -version = "1.0.0-alpha.9" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" -dependencies = [ - "ctor", - "version_check", -] +checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3" [[package]] name = "vending-factory" @@ -4434,13 +4588,43 @@ dependencies = [ "sg2", "sg4", "sg721", - "sha2 0.10.6", + "sha2 0.10.7", "shuffle", "thiserror", "url", "vending-factory", ] +[[package]] +name = "vending-minter-merkle-wl" +version = "3.3.0" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 1.1.0", + "cw-utils 1.0.1", + "cw2 1.1.0", + "cw721 0.18.0", + "cw721-base 0.18.0", + "rand_core 0.6.4", + "rand_xoshiro", + "schemars", + "semver", + "serde", + "sg-std", + "sg-whitelist", + "sg1", + "sg2", + "sg4", + "sg721", + "sha2 0.10.7", + "shuffle", + "thiserror", + "url", + "vending-factory", + "whitelist-mtree", +] + [[package]] name = "vending-minter-wl-flex" version = "3.4.0" @@ -4463,7 +4647,7 @@ dependencies = [ "sg2", "sg4", "sg721", - "sha2 0.10.6", + "sha2 0.10.7", "shuffle", "thiserror", "url", @@ -4484,22 +4668,20 @@ checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" [[package]] name = "walkdir" -version = "2.3.2" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", - "winapi", "winapi-util", ] [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -4511,9 +4693,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4521,24 +4703,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.38", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.34" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -4548,9 +4730,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4558,28 +4740,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -4621,6 +4803,27 @@ dependencies = [ "thiserror", ] +[[package]] +name = "whitelist-mtree" +version = "3.3.0" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 1.1.0", + "cw-utils 1.0.1", + "cw2 1.1.0", + "hex", + "rs_merkle", + "rust_decimal", + "schemars", + "serde", + "serde_json", + "sg-std", + "sg1", + "thiserror", + "url", +] + [[package]] name = "winapi" version = "0.3.9" @@ -4654,33 +4857,18 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" -version = "0.42.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -4693,51 +4881,51 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.42.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.42.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.42.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.42.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.42.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.3.6" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d020b441f92996c80d94ae9166e8501e59c7bb56121189dc9eab3bd8216966" +checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" dependencies = [ "memchr", ] @@ -4762,21 +4950,20 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.5.7" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" dependencies = [ "zeroize_derive", ] [[package]] name = "zeroize_derive" -version = "1.3.3" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn", - "synstructure", + "syn 2.0.38", ] diff --git a/Cargo.toml b/Cargo.toml index 1105f8e43..7468f7f6d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,6 +50,9 @@ sg-whitelist = { version = "3.4.0", path = "contracts/whitelists/whiteli thiserror = "1.0.31" url = "2.2.2" sha2 = { version = "0.10.2", default-features = false } + +whitelist-mtree = { version = "3.4.0", path = "contracts/whitelists/whitelist-merkletree" } +vending-minter-merkle-wl = { version = "3.4.0", path = "contracts/minters/vending-minter-merkle-wl" } vending-factory = { version = "3.4.0", path = "contracts/factories/vending-factory" } vending-minter = { version = "3.4.0", path = "contracts/minters/vending-minter" } open-edition-factory = { version = "3.4.0", path = "contracts/factories/open-edition-factory" } @@ -59,6 +62,7 @@ sg-whitelist-flex = { version = "3.4.0", path = "contracts/whitelists/whiteli ethereum-verify = { version = "3.4.0", path = "packages/ethereum-verify" } sg-eth-airdrop = { version = "3.4.0", path = "contracts/sg-eth-airdrop" } test-suite = { version = "3.4.0", path = "test-suite" } + semver = "1" cw-ownable = "0.5.1" @@ -130,10 +134,6 @@ incremental = false codegen-units = 1 incremental = false -[profile.release.package.test-suite] -codegen-units = 1 -incremental = false - [profile.release] rpath = false lto = true diff --git a/contracts/minters/vending-minter-merkle-wl/.cargo/config b/contracts/minters/vending-minter-merkle-wl/.cargo/config new file mode 100644 index 000000000..ab407a024 --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/.cargo/config @@ -0,0 +1,4 @@ +[alias] +wasm = "build --release --lib --target wasm32-unknown-unknown" +unit-test = "test --lib" +schema = "run --example schema" diff --git a/contracts/minters/vending-minter-merkle-wl/.editorconfig b/contracts/minters/vending-minter-merkle-wl/.editorconfig new file mode 100644 index 000000000..3d36f20b1 --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.rs] +indent_size = 4 diff --git a/contracts/minters/vending-minter-merkle-wl/.gitignore b/contracts/minters/vending-minter-merkle-wl/.gitignore new file mode 100644 index 000000000..dfdaaa6bc --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/.gitignore @@ -0,0 +1,15 @@ +# Build results +/target + +# Cargo+Git helper file (https://github.com/rust-lang/cargo/blob/0.44.1/src/cargo/sources/git/utils.rs#L320-L327) +.cargo-ok + +# Text file backups +**/*.rs.bk + +# macOS +.DS_Store + +# IDEs +*.iml +.idea diff --git a/contracts/minters/vending-minter-merkle-wl/Cargo.toml b/contracts/minters/vending-minter-merkle-wl/Cargo.toml new file mode 100644 index 000000000..5b93aa4d7 --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/Cargo.toml @@ -0,0 +1,56 @@ +[package] +name = "vending-minter-merkle-wl" +authors = [ + "Jake Hartnell ", + "Shane Vitarana ", + "Kromsten " +] +description = "Stargaze vending minter contract using merkle trees" +version = { workspace = true } +edition = { workspace = true } +homepage = { workspace = true } +repository = { workspace = true } +license = { workspace = true } + +exclude = [ + # Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. + "contract.wasm", + "hash.txt", +] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +crate-type = ["cdylib", "rlib"] + +[features] +# for more explicit tests, cargo test --features=backtraces +backtraces = ["cosmwasm-std/backtraces"] +# use library feature to disable all instantiate/execute/query exports +library = [] + +[dependencies] +cosmwasm-schema = { workspace = true } +cosmwasm-std = { workspace = true } +cw2 = { workspace = true } +cw721 = { workspace = true } +cw721-base = { workspace = true, features = ["library"] } +cw-storage-plus = { workspace = true } +cw-utils = { workspace = true } +rand_core = { version = "0.6.4", default-features = false } +rand_xoshiro = { version = "0.6.0", default-features = false } +schemars = { workspace = true } +serde = { workspace = true } +sha2 = { workspace = true } +shuffle = { git = "https://github.com/webmaster128/shuffle", branch = "rm-getrandom", version = "0.1.7" } +sg1 = { workspace = true } +sg2 = { workspace = true } +sg4 = { workspace = true } +sg721 = { workspace = true } +sg-std = { workspace = true } +sg-whitelist = { workspace = true, features = ["library"] } +whitelist-mtree = { workspace = true, features = ["library"] } +thiserror = { workspace = true } +url = { workspace = true } +vending-factory = { workspace = true, features = ["library"] } +semver = { workspace = true } \ No newline at end of file diff --git a/contracts/minters/vending-minter-merkle-wl/LICENSE b/contracts/minters/vending-minter-merkle-wl/LICENSE new file mode 100644 index 000000000..1520ce81b --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2022 Public Awesome + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/contracts/minters/vending-minter-merkle-wl/README.md b/contracts/minters/vending-minter-merkle-wl/README.md new file mode 100644 index 000000000..3b7d1380c --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/README.md @@ -0,0 +1,5 @@ +# Stargaze Vending Minter Contract + +A minter that best works for generated art collections. It's designed for collections stored on IPFS that have a base URI root. + +Mints are in random order. The entire collection is shuffled on instantiation. Each mint triggers a smaller "baby" shuffle. At any time, a `Shuffle {}` function can be called to add a time element to the random mint. diff --git a/contracts/minters/vending-minter-merkle-wl/examples/schema.rs b/contracts/minters/vending-minter-merkle-wl/examples/schema.rs new file mode 100644 index 000000000..9f2176a29 --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/examples/schema.rs @@ -0,0 +1,29 @@ +use std::env::current_dir; +use std::fs::create_dir_all; + +use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; + +use sg4::StatusResponse; +use vending_minter_merkle_wl::msg::{ + ConfigResponse, ExecuteMsg, InstantiateMsg, MintCountResponse, MintPriceResponse, + MintableNumTokensResponse, QueryMsg, StartTimeResponse, +}; +use vending_minter_merkle_wl::state::Config; + +fn main() { + let mut out_dir = current_dir().unwrap(); + out_dir.push("schema"); + create_dir_all(&out_dir).unwrap(); + remove_schemas(&out_dir).unwrap(); + + export_schema(&schema_for!(InstantiateMsg), &out_dir); + export_schema(&schema_for!(ExecuteMsg), &out_dir); + export_schema(&schema_for!(QueryMsg), &out_dir); + export_schema(&schema_for!(Config), &out_dir); + export_schema(&schema_for!(ConfigResponse), &out_dir); + export_schema(&schema_for!(MintableNumTokensResponse), &out_dir); + export_schema(&schema_for!(MintCountResponse), &out_dir); + export_schema(&schema_for!(StartTimeResponse), &out_dir); + export_schema(&schema_for!(MintPriceResponse), &out_dir); + export_schema(&schema_for!(StatusResponse), &out_dir); +} diff --git a/contracts/minters/vending-minter-merkle-wl/rustfmt.toml b/contracts/minters/vending-minter-merkle-wl/rustfmt.toml new file mode 100644 index 000000000..79d13fd0a --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/rustfmt.toml @@ -0,0 +1,14 @@ +# stable +newline_style = "Unix" +hard_tabs = false +tab_spaces = 4 + +# unstable... should we require `rustup run nightly cargo fmt` ? +# or just update the style guide when they are stable? +#fn_single_line = true +#format_code_in_doc_comments = true +#overflow_delimited_expr = true +#reorder_impl_items = true +#struct_field_align_threshold = 20 +#struct_lit_single_line = true +#report_todo = "Always" diff --git a/contracts/minters/vending-minter-merkle-wl/schema/config_response.json b/contracts/minters/vending-minter-merkle-wl/schema/config_response.json new file mode 100644 index 000000000..7b69be083 --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/schema/config_response.json @@ -0,0 +1,101 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ConfigResponse", + "type": "object", + "required": [ + "admin", + "base_token_uri", + "factory", + "mint_price", + "num_tokens", + "per_address_limit", + "sg721_address", + "sg721_code_id", + "start_time" + ], + "properties": { + "admin": { + "type": "string" + }, + "base_token_uri": { + "type": "string" + }, + "discount_price": { + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "factory": { + "type": "string" + }, + "mint_price": { + "$ref": "#/definitions/Coin" + }, + "num_tokens": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "sg721_address": { + "type": "string" + }, + "sg721_code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "start_time": { + "$ref": "#/definitions/Timestamp" + }, + "whitelist": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/minters/vending-minter-merkle-wl/schema/execute_msg.json b/contracts/minters/vending-minter-merkle-wl/schema/execute_msg.json new file mode 100644 index 000000000..a6044d1ab --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/schema/execute_msg.json @@ -0,0 +1,255 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "mint" + ], + "properties": { + "mint": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_whitelist" + ], + "properties": { + "set_whitelist": { + "type": "object", + "required": [ + "whitelist" + ], + "properties": { + "whitelist": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "purge" + ], + "properties": { + "purge": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_mint_price" + ], + "properties": { + "update_mint_price": { + "type": "object", + "required": [ + "price" + ], + "properties": { + "price": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_start_time" + ], + "properties": { + "update_start_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Runs custom checks against TradingStartTime on VendingMinter, then updates by calling sg721-base", + "type": "object", + "required": [ + "update_start_trading_time" + ], + "properties": { + "update_start_trading_time": { + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_per_address_limit" + ], + "properties": { + "update_per_address_limit": { + "type": "object", + "required": [ + "per_address_limit" + ], + "properties": { + "per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "mint_to" + ], + "properties": { + "mint_to": { + "type": "object", + "required": [ + "recipient" + ], + "properties": { + "recipient": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "mint_for" + ], + "properties": { + "mint_for": { + "type": "object", + "required": [ + "recipient", + "token_id" + ], + "properties": { + "recipient": { + "type": "string" + }, + "token_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "shuffle" + ], + "properties": { + "shuffle": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "burn_remaining" + ], + "properties": { + "burn_remaining": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_discount_price" + ], + "properties": { + "update_discount_price": { + "type": "object", + "required": [ + "price" + ], + "properties": { + "price": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "remove_discount_price" + ], + "properties": { + "remove_discount_price": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/minters/vending-minter-merkle-wl/schema/instantiate_msg.json b/contracts/minters/vending-minter-merkle-wl/schema/instantiate_msg.json new file mode 100644 index 000000000..e36b41465 --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/schema/instantiate_msg.json @@ -0,0 +1,298 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "create_msg", + "params" + ], + "properties": { + "create_msg": { + "$ref": "#/definitions/CreateMinterMsg_for_VendingMinterInitMsgExtension" + }, + "params": { + "$ref": "#/definitions/MinterParams_for_ParamsExtension" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "CollectionInfo_for_RoyaltyInfoResponse": { + "type": "object", + "required": [ + "creator", + "description", + "image" + ], + "properties": { + "creator": { + "type": "string" + }, + "description": { + "type": "string" + }, + "explicit_content": { + "type": [ + "boolean", + "null" + ] + }, + "external_link": { + "type": [ + "string", + "null" + ] + }, + "image": { + "type": "string" + }, + "royalty_info": { + "anyOf": [ + { + "$ref": "#/definitions/RoyaltyInfoResponse" + }, + { + "type": "null" + } + ] + }, + "start_trading_time": { + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "CollectionParams": { + "type": "object", + "required": [ + "code_id", + "info", + "name", + "symbol" + ], + "properties": { + "code_id": { + "description": "The collection code id", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "info": { + "$ref": "#/definitions/CollectionInfo_for_RoyaltyInfoResponse" + }, + "name": { + "type": "string" + }, + "symbol": { + "type": "string" + } + }, + "additionalProperties": false + }, + "CreateMinterMsg_for_VendingMinterInitMsgExtension": { + "type": "object", + "required": [ + "collection_params", + "init_msg" + ], + "properties": { + "collection_params": { + "$ref": "#/definitions/CollectionParams" + }, + "init_msg": { + "$ref": "#/definitions/VendingMinterInitMsgExtension" + } + }, + "additionalProperties": false + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "MinterParams_for_ParamsExtension": { + "description": "Common params for all minters used for storage", + "type": "object", + "required": [ + "allowed_sg721_code_ids", + "code_id", + "creation_fee", + "extension", + "frozen", + "max_trading_offset_secs", + "min_mint_price", + "mint_fee_bps" + ], + "properties": { + "allowed_sg721_code_ids": { + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "code_id": { + "description": "The minter code id", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "creation_fee": { + "$ref": "#/definitions/Coin" + }, + "extension": { + "$ref": "#/definitions/ParamsExtension" + }, + "frozen": { + "type": "boolean" + }, + "max_trading_offset_secs": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "min_mint_price": { + "$ref": "#/definitions/Coin" + }, + "mint_fee_bps": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "ParamsExtension": { + "description": "Parameters common to all vending minters, as determined by governance", + "type": "object", + "required": [ + "airdrop_mint_fee_bps", + "airdrop_mint_price", + "max_per_address_limit", + "max_token_limit", + "shuffle_fee" + ], + "properties": { + "airdrop_mint_fee_bps": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "airdrop_mint_price": { + "$ref": "#/definitions/Coin" + }, + "max_per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "max_token_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "shuffle_fee": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false + }, + "RoyaltyInfoResponse": { + "type": "object", + "required": [ + "payment_address", + "share" + ], + "properties": { + "payment_address": { + "type": "string" + }, + "share": { + "$ref": "#/definitions/Decimal" + } + }, + "additionalProperties": false + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + }, + "VendingMinterInitMsgExtension": { + "type": "object", + "required": [ + "base_token_uri", + "mint_price", + "num_tokens", + "per_address_limit", + "start_time" + ], + "properties": { + "base_token_uri": { + "type": "string" + }, + "mint_price": { + "$ref": "#/definitions/Coin" + }, + "num_tokens": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "payment_address": { + "type": [ + "string", + "null" + ] + }, + "per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "start_time": { + "$ref": "#/definitions/Timestamp" + }, + "whitelist": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/minters/vending-minter-merkle-wl/schema/mint_count_response.json b/contracts/minters/vending-minter-merkle-wl/schema/mint_count_response.json new file mode 100644 index 000000000..8cb578300 --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/schema/mint_count_response.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MintCountResponse", + "type": "object", + "required": [ + "address", + "count" + ], + "properties": { + "address": { + "type": "string" + }, + "count": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/minters/vending-minter-merkle-wl/schema/mint_price_response.json b/contracts/minters/vending-minter-merkle-wl/schema/mint_price_response.json new file mode 100644 index 000000000..e6857d00b --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/schema/mint_price_response.json @@ -0,0 +1,63 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MintPriceResponse", + "type": "object", + "required": [ + "airdrop_price", + "current_price", + "public_price" + ], + "properties": { + "airdrop_price": { + "$ref": "#/definitions/Coin" + }, + "current_price": { + "$ref": "#/definitions/Coin" + }, + "discount_price": { + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "public_price": { + "$ref": "#/definitions/Coin" + }, + "whitelist_price": { + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/minters/vending-minter-merkle-wl/schema/mintable_num_tokens_response.json b/contracts/minters/vending-minter-merkle-wl/schema/mintable_num_tokens_response.json new file mode 100644 index 000000000..8b80aa85b --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/schema/mintable_num_tokens_response.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MintableNumTokensResponse", + "type": "object", + "required": [ + "count" + ], + "properties": { + "count": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/minters/vending-minter-merkle-wl/schema/minter_config_for__config_extension.json b/contracts/minters/vending-minter-merkle-wl/schema/minter_config_for__config_extension.json new file mode 100644 index 000000000..0556ef225 --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/schema/minter_config_for__config_extension.json @@ -0,0 +1,128 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MinterConfig_for_ConfigExtension", + "description": "Saved in every minter", + "type": "object", + "required": [ + "collection_code_id", + "extension", + "factory", + "mint_price" + ], + "properties": { + "collection_code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "extension": { + "$ref": "#/definitions/ConfigExtension" + }, + "factory": { + "$ref": "#/definitions/Addr" + }, + "mint_price": { + "$ref": "#/definitions/Coin" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "ConfigExtension": { + "type": "object", + "required": [ + "admin", + "base_token_uri", + "num_tokens", + "per_address_limit", + "start_time" + ], + "properties": { + "admin": { + "$ref": "#/definitions/Addr" + }, + "base_token_uri": { + "type": "string" + }, + "discount_price": { + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + }, + "num_tokens": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "payment_address": { + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "start_time": { + "$ref": "#/definitions/Timestamp" + }, + "whitelist": { + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/minters/vending-minter-merkle-wl/schema/query_msg.json b/contracts/minters/vending-minter-merkle-wl/schema/query_msg.json new file mode 100644 index 000000000..56821a1c8 --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/schema/query_msg.json @@ -0,0 +1,92 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "mintable_num_tokens" + ], + "properties": { + "mintable_num_tokens": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "start_time" + ], + "properties": { + "start_time": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "mint_price" + ], + "properties": { + "mint_price": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "mint_count" + ], + "properties": { + "mint_count": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "status" + ], + "properties": { + "status": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/contracts/minters/vending-minter-merkle-wl/schema/start_time_response.json b/contracts/minters/vending-minter-merkle-wl/schema/start_time_response.json new file mode 100644 index 000000000..40a03518d --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/schema/start_time_response.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "StartTimeResponse", + "type": "object", + "required": [ + "start_time" + ], + "properties": { + "start_time": { + "type": "string" + } + }, + "additionalProperties": false +} diff --git a/contracts/minters/vending-minter-merkle-wl/schema/status_response.json b/contracts/minters/vending-minter-merkle-wl/schema/status_response.json new file mode 100644 index 000000000..dfcf3dc33 --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/schema/status_response.json @@ -0,0 +1,36 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "StatusResponse", + "type": "object", + "required": [ + "status" + ], + "properties": { + "status": { + "$ref": "#/definitions/Status" + } + }, + "additionalProperties": false, + "definitions": { + "Status": { + "type": "object", + "required": [ + "is_blocked", + "is_explicit", + "is_verified" + ], + "properties": { + "is_blocked": { + "type": "boolean" + }, + "is_explicit": { + "type": "boolean" + }, + "is_verified": { + "type": "boolean" + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/minters/vending-minter-merkle-wl/src/contract.rs b/contracts/minters/vending-minter-merkle-wl/src/contract.rs new file mode 100644 index 000000000..5fd81b599 --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/src/contract.rs @@ -0,0 +1,1280 @@ +use crate::error::ContractError; +use crate::msg::{ + ConfigResponse, ExecuteMsg, MintCountResponse, MintPriceResponse, MintableNumTokensResponse, + QueryMsg, StartTimeResponse, +}; +use crate::state::{ + Config, ConfigExtension, CONFIG, MINTABLE_NUM_TOKENS, MINTABLE_TOKEN_POSITIONS, MINTER_ADDRS, + SG721_ADDRESS, STATUS, +}; +use crate::validation::{check_dynamic_per_address_limit, get_three_percent_of_tokens}; +#[cfg(not(feature = "library"))] +use cosmwasm_std::entry_point; +use cosmwasm_std::{ + coin, ensure, to_binary, Addr, BankMsg, Binary, Coin, CosmosMsg, Decimal, Deps, DepsMut, Empty, + Env, Event, MessageInfo, Order, Reply, ReplyOn, StdError, StdResult, Timestamp, Uint128, + WasmMsg, +}; +use cw2::set_contract_version; +use cw721_base::Extension; +use cw_utils::{may_pay, maybe_addr, nonpayable, parse_reply_instantiate_data}; +use rand_core::{RngCore, SeedableRng}; +use rand_xoshiro::Xoshiro128PlusPlus; +use semver::Version; +use sg1::{checked_fair_burn, ibc_denom_fair_burn}; +use sg2::query::Sg2QueryMsg; +use sg4::{MinterConfig, Status, StatusResponse, SudoMsg}; +use sg721::{ExecuteMsg as Sg721ExecuteMsg, InstantiateMsg as Sg721InstantiateMsg}; +use sg_std::{StargazeMsgWrapper, GENESIS_MINT_START_TIME, NATIVE_DENOM}; +use sg_whitelist::msg::{ + ConfigResponse as WhitelistConfigResponse, HasMemberResponse, QueryMsg as WhitelistQueryMsg, +}; +use whitelist_mtree::msg::QueryMsg as WhitelistMtreeQueryMsg; +use sha2::{Digest, Sha256}; +use shuffle::{fy::FisherYates, shuffler::Shuffler}; +use std::convert::TryInto; +use url::Url; +use vending_factory::msg::{ParamsResponse, VendingMinterCreateMsg}; +use vending_factory::state::VendingMinterParams; + +pub type Response = cosmwasm_std::Response; +pub type SubMsg = cosmwasm_std::SubMsg; + +pub struct TokenPositionMapping { + pub position: u32, + pub token_id: u32, +} + +// version info for migration info +const CONTRACT_NAME: &str = "crates.io:sg-minter"; +const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); + +const INSTANTIATE_SG721_REPLY_ID: u64 = 1; + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn instantiate( + deps: DepsMut, + env: Env, + info: MessageInfo, + msg: VendingMinterCreateMsg, +) -> Result { + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + + let factory = info.sender.clone(); + + // Make sure the sender is the factory contract + // This will fail if the sender cannot parse a response from the factory contract + let factory_response: ParamsResponse = deps + .querier + .query_wasm_smart(factory.clone(), &Sg2QueryMsg::Params {})?; + let factory_params = factory_response.params; + + // set default status so it can be queried without failing + STATUS.save(deps.storage, &Status::default())?; + + if !check_dynamic_per_address_limit( + msg.init_msg.per_address_limit, + msg.init_msg.num_tokens, + factory_params.extension.max_per_address_limit, + )? { + return Err(ContractError::InvalidPerAddressLimit { + max: display_max_mintable_tokens( + msg.init_msg.per_address_limit, + msg.init_msg.num_tokens, + factory_params.extension.max_per_address_limit, + )?, + min: 1, + got: msg.init_msg.per_address_limit, + }); + } + + // sanitize base token uri + let mut base_token_uri = msg.init_msg.base_token_uri.trim().to_string(); + // Check that base_token_uri is a valid IPFS uri + let parsed_token_uri = Url::parse(&base_token_uri)?; + if parsed_token_uri.scheme() != "ipfs" { + return Err(ContractError::InvalidBaseTokenURI {}); + } + base_token_uri = parsed_token_uri.to_string(); + + let genesis_time = Timestamp::from_nanos(GENESIS_MINT_START_TIME); + // If start time is before genesis time return error + if msg.init_msg.start_time < genesis_time { + return Err(ContractError::BeforeGenesisTime {}); + } + + // If current time is beyond the provided start time return error + if env.block.time > msg.init_msg.start_time { + return Err(ContractError::InvalidStartTime( + msg.init_msg.start_time, + env.block.time, + )); + } + + // Validate address for the optional whitelist contract + let whitelist_addr = msg + .init_msg + .whitelist + .and_then(|w| deps.api.addr_validate(w.as_str()).ok()); + + if let Some(wl) = whitelist_addr.clone() { + // check the whitelist exists + let res: WhitelistConfigResponse = deps + .querier + .query_wasm_smart(wl, &WhitelistQueryMsg::Config {})?; + if res.is_active { + return Err(ContractError::WhitelistAlreadyStarted {}); + } + } + + // Use default start trading time if not provided + let mut collection_info = msg.collection_params.info.clone(); + let offset = factory_params.max_trading_offset_secs; + let default_start_time_with_offset = msg.init_msg.start_time.plus_seconds(offset); + if let Some(start_trading_time) = msg.collection_params.info.start_trading_time { + // If trading start time > start_time + offset, return error + if start_trading_time > default_start_time_with_offset { + return Err(ContractError::InvalidStartTradingTime( + start_trading_time, + default_start_time_with_offset, + )); + } + } + let start_trading_time = msg + .collection_params + .info + .start_trading_time + .or(Some(default_start_time_with_offset)); + collection_info.start_trading_time = start_trading_time; + + let config = Config { + factory: factory.clone(), + collection_code_id: msg.collection_params.code_id, + extension: ConfigExtension { + admin: deps + .api + .addr_validate(&msg.collection_params.info.creator)?, + payment_address: maybe_addr(deps.api, msg.init_msg.payment_address)?, + base_token_uri, + num_tokens: msg.init_msg.num_tokens, + per_address_limit: msg.init_msg.per_address_limit, + whitelist: whitelist_addr, + start_time: msg.init_msg.start_time, + discount_price: None, + }, + mint_price: msg.init_msg.mint_price, + }; + + CONFIG.save(deps.storage, &config)?; + MINTABLE_NUM_TOKENS.save(deps.storage, &msg.init_msg.num_tokens)?; + + let token_ids = random_token_list( + &env, + deps.api + .addr_validate(&msg.collection_params.info.creator)?, + (1..=msg.init_msg.num_tokens).collect::>(), + )?; + // Save mintable token ids map + let mut token_position = 1; + for token_id in token_ids { + MINTABLE_TOKEN_POSITIONS.save(deps.storage, token_position, &token_id)?; + token_position += 1; + } + + // Submessage to instantiate sg721 contract + let submsg = SubMsg { + msg: WasmMsg::Instantiate { + code_id: msg.collection_params.code_id, + msg: to_binary(&Sg721InstantiateMsg { + name: msg.collection_params.name.clone(), + symbol: msg.collection_params.symbol, + minter: env.contract.address.to_string(), + collection_info, + })?, + funds: info.funds, + admin: Some(config.extension.admin.to_string()), + label: format!("SG721-{}", msg.collection_params.name.trim()), + } + .into(), + id: INSTANTIATE_SG721_REPLY_ID, + gas_limit: None, + reply_on: ReplyOn::Success, + }; + + Ok(Response::new() + .add_attribute("action", "instantiate") + .add_attribute("contract_name", CONTRACT_NAME) + .add_attribute("contract_version", CONTRACT_VERSION) + .add_attribute("sender", factory) + .add_submessage(submsg)) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn execute( + deps: DepsMut, + env: Env, + info: MessageInfo, + msg: ExecuteMsg, +) -> Result { + match msg { + ExecuteMsg::Mint { proof_hashes } => execute_mint_sender(deps, env, info, proof_hashes), + ExecuteMsg::Purge {} => execute_purge(deps, env, info), + ExecuteMsg::UpdateMintPrice { price } => execute_update_mint_price(deps, env, info, price), + ExecuteMsg::UpdateStartTime(time) => execute_update_start_time(deps, env, info, time), + ExecuteMsg::UpdateStartTradingTime(time) => { + execute_update_start_trading_time(deps, env, info, time) + } + ExecuteMsg::UpdatePerAddressLimit { per_address_limit } => { + execute_update_per_address_limit(deps, env, info, per_address_limit) + } + ExecuteMsg::MintTo { recipient } => execute_mint_to(deps, env, info, recipient), + ExecuteMsg::MintFor { + token_id, + recipient, + } => execute_mint_for(deps, env, info, token_id, recipient), + ExecuteMsg::SetWhitelist { whitelist } => { + execute_set_whitelist(deps, env, info, &whitelist) + } + ExecuteMsg::Shuffle {} => execute_shuffle(deps, env, info), + ExecuteMsg::BurnRemaining {} => execute_burn_remaining(deps, env, info), + ExecuteMsg::UpdateDiscountPrice { price } => { + execute_update_discount_price(deps, env, info, price) + } + ExecuteMsg::RemoveDiscountPrice {} => execute_remove_discount_price(deps, info), + } +} + +pub fn execute_update_discount_price( + deps: DepsMut, + env: Env, + info: MessageInfo, + price: u128, +) -> Result { + nonpayable(&info)?; + let mut config = CONFIG.load(deps.storage)?; + if info.sender != config.extension.admin { + return Err(ContractError::Unauthorized( + "Sender is not an admin".to_owned(), + )); + } + if env.block.time < config.extension.start_time { + return Err(ContractError::BeforeMintStartTime {}); + } + + // discount price can't be greater than unit price + if price > config.mint_price.amount.u128() { + return Err(ContractError::UpdatedMintPriceTooHigh { + allowed: config.mint_price.amount.u128(), + updated: price, + }); + } + + let factory: ParamsResponse = deps + .querier + .query_wasm_smart(config.clone().factory, &Sg2QueryMsg::Params {})?; + let factory_params = factory.params; + + if factory_params.min_mint_price.amount.u128() > price { + return Err(ContractError::InsufficientMintPrice { + expected: factory_params.min_mint_price.amount.u128(), + got: price, + }); + } + + config.extension.discount_price = Some(coin(price, config.mint_price.denom.clone())); + CONFIG.save(deps.storage, &config)?; + + Ok(Response::new() + .add_attribute("action", "update_discount_price") + .add_attribute("sender", info.sender) + .add_attribute("discount_price", price.to_string())) +} + +pub fn execute_remove_discount_price( + deps: DepsMut, + info: MessageInfo, +) -> Result { + nonpayable(&info)?; + let mut config = CONFIG.load(deps.storage)?; + if info.sender != config.extension.admin { + return Err(ContractError::Unauthorized( + "Sender is not an admin".to_owned(), + )); + } + config.extension.discount_price = None; + CONFIG.save(deps.storage, &config)?; + + Ok(Response::new() + .add_attribute("action", "remove_discount_price") + .add_attribute("sender", info.sender)) +} + +// Purge frees data after a mint is sold out +// Anyone can purge +pub fn execute_purge( + deps: DepsMut, + env: Env, + info: MessageInfo, +) -> Result { + nonpayable(&info)?; + // check mint sold out + let mintable_num_tokens = MINTABLE_NUM_TOKENS.load(deps.storage)?; + if mintable_num_tokens != 0 { + return Err(ContractError::NotSoldOut {}); + } + + let keys = MINTER_ADDRS + .keys(deps.storage, None, None, Order::Ascending) + .collect::>(); + for key in keys { + MINTER_ADDRS.remove(deps.storage, &key?); + } + + Ok(Response::new() + .add_attribute("action", "purge") + .add_attribute("contract", env.contract.address.to_string()) + .add_attribute("sender", info.sender)) +} + +// Anyone can pay to shuffle at any time +// Introduces another source of randomness to minting +// There's a fee because this action is expensive. +pub fn execute_shuffle( + deps: DepsMut, + env: Env, + info: MessageInfo, +) -> Result { + let mut res = Response::new(); + + let config = CONFIG.load(deps.storage)?; + + let factory: ParamsResponse = deps + .querier + .query_wasm_smart(config.factory, &Sg2QueryMsg::Params {})?; + let factory_params = factory.params; + + // Check exact shuffle fee payment included in message + checked_fair_burn( + &info, + factory_params.extension.shuffle_fee.amount.u128(), + None, + &mut res, + )?; + + // Check not sold out + let mintable_num_tokens = MINTABLE_NUM_TOKENS.load(deps.storage)?; + if mintable_num_tokens == 0 { + return Err(ContractError::SoldOut {}); + } + + // get positions and token_ids, then randomize token_ids and reassign positions + let mut positions = vec![]; + let mut token_ids = vec![]; + for mapping in MINTABLE_TOKEN_POSITIONS.range(deps.storage, None, None, Order::Ascending) { + let (position, token_id) = mapping?; + positions.push(position); + token_ids.push(token_id); + } + let randomized_token_ids = random_token_list(&env, info.sender.clone(), token_ids.clone())?; + for (i, position) in positions.iter().enumerate() { + MINTABLE_TOKEN_POSITIONS.save(deps.storage, *position, &randomized_token_ids[i])?; + } + + Ok(res + .add_attribute("action", "shuffle") + .add_attribute("sender", info.sender)) +} + +pub fn execute_set_whitelist( + deps: DepsMut, + env: Env, + info: MessageInfo, + whitelist: &str, +) -> Result { + nonpayable(&info)?; + let mut config = CONFIG.load(deps.storage)?; + let MinterConfig { + factory, + extension: + ConfigExtension { + whitelist: existing_whitelist, + admin, + start_time, + .. + }, + .. + } = config.clone(); + ensure!( + admin == info.sender, + ContractError::Unauthorized("Sender is not an admin".to_owned()) + ); + + ensure!( + env.block.time < start_time, + ContractError::AlreadyStarted {} + ); + + if let Some(wl) = existing_whitelist { + let res: WhitelistConfigResponse = deps + .querier + .query_wasm_smart(wl, &WhitelistQueryMsg::Config {})?; + + ensure!(!res.is_active, ContractError::WhitelistAlreadyStarted {}); + } + + let new_wl = deps.api.addr_validate(whitelist)?; + config.extension.whitelist = Some(new_wl.clone()); + // check that the new whitelist exists + let WhitelistConfigResponse { + is_active: wl_is_active, + mint_price: wl_mint_price, + .. + } = deps + .querier + .query_wasm_smart(new_wl, &WhitelistQueryMsg::Config {})?; + + ensure!(!wl_is_active, ContractError::WhitelistAlreadyStarted {}); + + ensure!( + wl_mint_price.denom == config.mint_price.denom, + ContractError::InvalidDenom { + expected: config.mint_price.denom, + got: wl_mint_price.denom, + } + ); + + // Whitelist could be free, while factory minimum is not + let ParamsResponse { + params: + VendingMinterParams { + min_mint_price: factory_min_mint_price, + .. + }, + } = deps + .querier + .query_wasm_smart(factory, &Sg2QueryMsg::Params {})?; + + ensure!( + factory_min_mint_price.amount <= wl_mint_price.amount, + ContractError::InsufficientWhitelistMintPrice { + expected: factory_min_mint_price.amount.into(), + got: wl_mint_price.amount.into(), + } + ); + + // Whitelist denom should match factory mint denom + ensure!( + factory_min_mint_price.denom == wl_mint_price.denom, + ContractError::InvalidDenom { + expected: factory_min_mint_price.denom, + got: wl_mint_price.denom, + } + ); + + CONFIG.save(deps.storage, &config)?; + + Ok(Response::default() + .add_attribute("action", "set_whitelist") + .add_attribute("whitelist", whitelist.to_string())) +} + +pub fn execute_mint_sender( + deps: DepsMut, + env: Env, + info: MessageInfo, + proof_hashes: Option>, +) -> Result { + let config = CONFIG.load(deps.storage)?; + let action = "mint_sender"; + + // If there is no active whitelist right now, check public mint + // Check if after start_time + if is_public_mint(deps.as_ref(), &info, proof_hashes)? && (env.block.time < config.extension.start_time) { + return Err(ContractError::BeforeMintStartTime {}); + } + + // Check if already minted max per address limit + let mint_count = mint_count(deps.as_ref(), &info)?; + if mint_count >= config.extension.per_address_limit { + return Err(ContractError::MaxPerAddressLimitExceeded {}); + } + + _execute_mint(deps, env, info, action, false, None, None) +} + +// Check if a whitelist exists and not ended +// Sender has to be whitelisted to mint +fn is_public_mint(deps: Deps, info: &MessageInfo, proof_hashes: Option>) -> Result { + let config = CONFIG.load(deps.storage)?; + + // If there is no whitelist, there's only a public mint + if config.extension.whitelist.is_none() { + return Ok(true); + } + + let whitelist = config.extension.whitelist.unwrap(); + + let wl_config: WhitelistConfigResponse = deps + .querier + .query_wasm_smart(whitelist.clone(), &WhitelistQueryMsg::Config {})?; + + if !wl_config.is_active { + return Ok(true); + } + + let res: HasMemberResponse = if is_merkle_tree_wl(&wl_config) && proof_hashes.is_some() { + deps.querier.query_wasm_smart( + whitelist, + &WhitelistMtreeQueryMsg::HasMember { + member: info.sender.to_string(), + proof_hashes: proof_hashes.unwrap(), + }, + )? + } else { + deps.querier.query_wasm_smart( + whitelist, + &WhitelistQueryMsg::HasMember { + member: info.sender.to_string(), + }, + )? + }; + + if !res.has_member { + return Err(ContractError::NotWhitelisted { + addr: info.sender.to_string(), + }); + } + + // Check wl per address limit + let mint_count = mint_count(deps, info)?; + if mint_count >= wl_config.per_address_limit { + return Err(ContractError::MaxPerAddressLimitExceeded {}); + } + + Ok(false) +} + + +fn is_merkle_tree_wl(wl_config_res: &WhitelistConfigResponse) -> bool { + wl_config_res.member_limit == 0 && + wl_config_res.num_members == 0 +} + + +pub fn execute_mint_to( + deps: DepsMut, + env: Env, + info: MessageInfo, + recipient: String, +) -> Result { + let recipient = deps.api.addr_validate(&recipient)?; + let config = CONFIG.load(deps.storage)?; + let action = "mint_to"; + + // Check only admin + if info.sender != config.extension.admin { + return Err(ContractError::Unauthorized( + "Sender is not an admin".to_owned(), + )); + } + + _execute_mint(deps, env, info, action, true, Some(recipient), None) +} + +pub fn execute_mint_for( + deps: DepsMut, + env: Env, + info: MessageInfo, + token_id: u32, + recipient: String, +) -> Result { + let recipient = deps.api.addr_validate(&recipient)?; + let config = CONFIG.load(deps.storage)?; + let action = "mint_for"; + + // Check only admin + if info.sender != config.extension.admin { + return Err(ContractError::Unauthorized( + "Sender is not an admin".to_owned(), + )); + } + + _execute_mint( + deps, + env, + info, + action, + true, + Some(recipient), + Some(token_id), + ) +} + +// Generalize checks and mint message creation +// mint -> _execute_mint(recipient: None, token_id: None) +// mint_to(recipient: "friend") -> _execute_mint(Some(recipient), token_id: None) +// mint_for(recipient: "friend2", token_id: 420) -> _execute_mint(recipient, token_id) +fn _execute_mint( + deps: DepsMut, + env: Env, + info: MessageInfo, + action: &str, + is_admin: bool, + recipient: Option, + token_id: Option, +) -> Result { + let mintable_num_tokens = MINTABLE_NUM_TOKENS.load(deps.storage)?; + if mintable_num_tokens == 0 { + return Err(ContractError::SoldOut {}); + } + + let config = CONFIG.load(deps.storage)?; + + if let Some(token_id) = token_id { + if token_id == 0 || token_id > config.extension.num_tokens { + return Err(ContractError::InvalidTokenId {}); + } + } + + let sg721_address = SG721_ADDRESS.load(deps.storage)?; + + let recipient_addr = match recipient { + Some(some_recipient) => some_recipient, + None => info.sender.clone(), + }; + + let mint_price: Coin = mint_price(deps.as_ref(), is_admin)?; + // Exact payment only accepted + let payment = may_pay(&info, &mint_price.denom)?; + if payment != mint_price.amount { + return Err(ContractError::IncorrectPaymentAmount( + coin(payment.u128(), &config.mint_price.denom), + mint_price, + )); + } + + let mut res = Response::new(); + + let factory: ParamsResponse = deps + .querier + .query_wasm_smart(config.factory, &Sg2QueryMsg::Params {})?; + let factory_params = factory.params; + + // Create network fee msgs + let mint_fee = if is_admin { + Decimal::bps(factory_params.extension.airdrop_mint_fee_bps) + } else { + Decimal::bps(factory_params.mint_fee_bps) + }; + + let network_fee = mint_price.amount * mint_fee; + + // send non-native fees to community pool + if mint_price.denom != NATIVE_DENOM { + // only send non-zero amounts + if !network_fee.is_zero() { + ibc_denom_fair_burn( + coin(network_fee.u128(), mint_price.clone().denom), + None, + &mut res, + )?; + } + } else { + checked_fair_burn(&info, network_fee.u128(), None, &mut res)?; + } + + let mintable_token_mapping = match token_id { + Some(token_id) => { + // set position to invalid value, iterate to find matching token_id + // if token_id not found, token_id is already sold, position is unchanged and throw err + // otherwise return position and token_id + let mut position = 0; + for res in MINTABLE_TOKEN_POSITIONS.range(deps.storage, None, None, Order::Ascending) { + let (pos, id) = res?; + if id == token_id { + position = pos; + break; + } + } + if position == 0 { + return Err(ContractError::TokenIdAlreadySold { token_id }); + } + TokenPositionMapping { position, token_id } + } + None => random_mintable_token_mapping(deps.as_ref(), env, info.sender.clone())?, + }; + + // Create mint msgs + let mint_msg = Sg721ExecuteMsg::::Mint { + token_id: mintable_token_mapping.token_id.to_string(), + owner: recipient_addr.to_string(), + token_uri: Some(format!( + "{}/{}", + config.extension.base_token_uri, mintable_token_mapping.token_id + )), + extension: None, + }; + let msg = CosmosMsg::Wasm(WasmMsg::Execute { + contract_addr: sg721_address.to_string(), + msg: to_binary(&mint_msg)?, + funds: vec![], + }); + res = res.add_message(msg); + + // Remove mintable token position from map + MINTABLE_TOKEN_POSITIONS.remove(deps.storage, mintable_token_mapping.position); + let mintable_num_tokens = MINTABLE_NUM_TOKENS.load(deps.storage)?; + // Decrement mintable num tokens + MINTABLE_NUM_TOKENS.save(deps.storage, &(mintable_num_tokens - 1))?; + // Save the new mint count for the sender's address + let new_mint_count = mint_count(deps.as_ref(), &info)? + 1; + MINTER_ADDRS.save(deps.storage, &info.sender, &new_mint_count)?; + + let seller_amount = if !is_admin { + let amount = mint_price.amount - network_fee; + let payment_address = config.extension.payment_address; + let seller = config.extension.admin; + // Sending 0 coins fails, so only send if amount is non-zero + if !amount.is_zero() { + let msg = BankMsg::Send { + to_address: payment_address.unwrap_or(seller).to_string(), + amount: vec![coin(amount.u128(), mint_price.clone().denom)], + }; + res = res.add_message(msg); + } + amount + } else { + Uint128::zero() + }; + + Ok(res + .add_attribute("action", action) + .add_attribute("sender", info.sender) + .add_attribute("recipient", recipient_addr) + .add_attribute("token_id", mintable_token_mapping.token_id.to_string()) + .add_attribute( + "network_fee", + coin(network_fee.u128(), mint_price.clone().denom).to_string(), + ) + .add_attribute("mint_price", mint_price.to_string()) + .add_attribute( + "seller_amount", + coin(seller_amount.u128(), mint_price.denom).to_string(), + )) +} + +fn random_token_list( + env: &Env, + sender: Addr, + mut tokens: Vec, +) -> Result, ContractError> { + let tx_index = if let Some(tx) = &env.transaction { + tx.index + } else { + 0 + }; + let sha256 = Sha256::digest( + format!("{}{}{}{}", sender, env.block.height, tokens.len(), tx_index).into_bytes(), + ); + // Cut first 16 bytes from 32 byte value + let randomness: [u8; 16] = sha256.to_vec()[0..16].try_into().unwrap(); + let mut rng = Xoshiro128PlusPlus::from_seed(randomness); + let mut shuffler = FisherYates::default(); + shuffler + .shuffle(&mut tokens, &mut rng) + .map_err(StdError::generic_err)?; + Ok(tokens) +} + +// Does a baby shuffle, picking a token_id from the first or last 50 mintable positions. +fn random_mintable_token_mapping( + deps: Deps, + env: Env, + sender: Addr, +) -> Result { + let num_tokens = MINTABLE_NUM_TOKENS.load(deps.storage)?; + let tx_index = if let Some(tx) = &env.transaction { + tx.index + } else { + 0 + }; + let sha256 = Sha256::digest( + format!("{}{}{}{}", sender, num_tokens, env.block.height, tx_index).into_bytes(), + ); + // Cut first 16 bytes from 32 byte value + let randomness: [u8; 16] = sha256.to_vec()[0..16].try_into().unwrap(); + + let mut rng = Xoshiro128PlusPlus::from_seed(randomness); + + let r = rng.next_u32(); + + let order = match r % 2 { + 1 => Order::Descending, + _ => Order::Ascending, + }; + let mut rem = 50; + if rem > num_tokens { + rem = num_tokens; + } + let n = r % rem; + let position = MINTABLE_TOKEN_POSITIONS + .keys(deps.storage, None, None, order) + .skip(n as usize) + .take(1) + .collect::>>()?[0]; + + let token_id = MINTABLE_TOKEN_POSITIONS.load(deps.storage, position)?; + Ok(TokenPositionMapping { position, token_id }) +} + +pub fn execute_update_mint_price( + deps: DepsMut, + env: Env, + info: MessageInfo, + price: u128, +) -> Result { + nonpayable(&info)?; + let mut config = CONFIG.load(deps.storage)?; + if info.sender != config.extension.admin { + return Err(ContractError::Unauthorized( + "Sender is not an admin".to_owned(), + )); + } + // If current time is after the stored start time, only allow lowering price + if env.block.time >= config.extension.start_time && price >= config.mint_price.amount.u128() { + return Err(ContractError::UpdatedMintPriceTooHigh { + allowed: config.mint_price.amount.u128(), + updated: price, + }); + } + + let factory: ParamsResponse = deps + .querier + .query_wasm_smart(config.clone().factory, &Sg2QueryMsg::Params {})?; + let factory_params = factory.params; + + if factory_params.min_mint_price.amount.u128() > price { + return Err(ContractError::InsufficientMintPrice { + expected: factory_params.min_mint_price.amount.u128(), + got: price, + }); + } + + config.mint_price = coin(price, config.mint_price.denom); + CONFIG.save(deps.storage, &config)?; + Ok(Response::new() + .add_attribute("action", "update_mint_price") + .add_attribute("sender", info.sender) + .add_attribute("mint_price", price.to_string())) +} + +pub fn execute_update_start_time( + deps: DepsMut, + env: Env, + info: MessageInfo, + start_time: Timestamp, +) -> Result { + nonpayable(&info)?; + let mut config = CONFIG.load(deps.storage)?; + if info.sender != config.extension.admin { + return Err(ContractError::Unauthorized( + "Sender is not an admin".to_owned(), + )); + } + // If current time is after the stored start time return error + if env.block.time >= config.extension.start_time { + return Err(ContractError::AlreadyStarted {}); + } + + // If current time already passed the new start_time return error + if env.block.time > start_time { + return Err(ContractError::InvalidStartTime(start_time, env.block.time)); + } + + let genesis_start_time = Timestamp::from_nanos(GENESIS_MINT_START_TIME); + // If the new start_time is before genesis start time return error + if start_time < genesis_start_time { + return Err(ContractError::BeforeGenesisTime {}); + } + + config.extension.start_time = start_time; + CONFIG.save(deps.storage, &config)?; + Ok(Response::new() + .add_attribute("action", "update_start_time") + .add_attribute("sender", info.sender) + .add_attribute("start_time", start_time.to_string())) +} + +pub fn execute_update_start_trading_time( + deps: DepsMut, + env: Env, + info: MessageInfo, + start_time: Option, +) -> Result { + nonpayable(&info)?; + let config = CONFIG.load(deps.storage)?; + let sg721_contract_addr = SG721_ADDRESS.load(deps.storage)?; + + if info.sender != config.extension.admin { + return Err(ContractError::Unauthorized( + "Sender is not an admin".to_owned(), + )); + } + + // add custom rules here + let factory_params: ParamsResponse = deps + .querier + .query_wasm_smart(config.factory.clone(), &Sg2QueryMsg::Params {})?; + let default_start_time_with_offset = config + .extension + .start_time + .plus_seconds(factory_params.params.max_trading_offset_secs); + + if let Some(start_trading_time) = start_time { + if env.block.time > start_trading_time { + return Err(ContractError::InvalidStartTradingTime( + env.block.time, + start_trading_time, + )); + } + // If new start_trading_time > old start time + offset , return error + if start_trading_time > default_start_time_with_offset { + return Err(ContractError::InvalidStartTradingTime( + start_trading_time, + default_start_time_with_offset, + )); + } + } + + // execute sg721 contract + let msg = WasmMsg::Execute { + contract_addr: sg721_contract_addr.to_string(), + msg: to_binary(&Sg721ExecuteMsg::::UpdateStartTradingTime( + start_time, + ))?, + funds: vec![], + }; + + Ok(Response::new() + .add_attribute("action", "update_start_trading_time") + .add_attribute("sender", info.sender) + .add_message(msg)) +} + +pub fn execute_update_per_address_limit( + deps: DepsMut, + _env: Env, + info: MessageInfo, + per_address_limit: u32, +) -> Result { + nonpayable(&info)?; + let mut config = CONFIG.load(deps.storage)?; + if info.sender != config.extension.admin { + return Err(ContractError::Unauthorized( + "Sender is not an admin".to_owned(), + )); + } + + let factory: ParamsResponse = deps + .querier + .query_wasm_smart(config.factory.clone(), &Sg2QueryMsg::Params {})?; + let factory_params = factory.params; + + if per_address_limit == 0 || per_address_limit > factory_params.extension.max_per_address_limit + { + return Err(ContractError::InvalidPerAddressLimit { + max: factory_params.extension.max_per_address_limit, + min: 1, + got: per_address_limit, + }); + } + + if !check_dynamic_per_address_limit( + per_address_limit, + config.extension.num_tokens, + factory_params.extension.max_per_address_limit, + )? { + return Err(ContractError::InvalidPerAddressLimit { + max: display_max_mintable_tokens( + per_address_limit, + config.extension.num_tokens, + factory_params.extension.max_per_address_limit, + )?, + min: 1, + got: per_address_limit, + }); + } + + config.extension.per_address_limit = per_address_limit; + CONFIG.save(deps.storage, &config)?; + Ok(Response::new() + .add_attribute("action", "update_per_address_limit") + .add_attribute("sender", info.sender) + .add_attribute("limit", per_address_limit.to_string())) +} + +pub fn execute_burn_remaining( + deps: DepsMut, + env: Env, + info: MessageInfo, +) -> Result { + nonpayable(&info)?; + let config = CONFIG.load(deps.storage)?; + // Check only admin + if info.sender != config.extension.admin { + return Err(ContractError::Unauthorized( + "Sender is not an admin".to_owned(), + )); + } + + // check mint not sold out + let mintable_num_tokens = MINTABLE_NUM_TOKENS.load(deps.storage)?; + if mintable_num_tokens == 0 { + return Err(ContractError::SoldOut {}); + } + + let keys = MINTABLE_TOKEN_POSITIONS + .keys(deps.storage, None, None, Order::Ascending) + .collect::>(); + let mut total: u32 = 0; + for key in keys { + total += 1; + MINTABLE_TOKEN_POSITIONS.remove(deps.storage, key?); + } + // Decrement mintable num tokens + MINTABLE_NUM_TOKENS.save(deps.storage, &(mintable_num_tokens - total))?; + + let event = Event::new("burn-remaining") + .add_attribute("sender", info.sender) + .add_attribute("tokens_burned", total.to_string()) + .add_attribute("minter", env.contract.address.to_string()); + Ok(Response::new().add_event(event)) +} + +// if admin_no_fee => no fee, +// else if in whitelist => whitelist price +// else => config unit price +pub fn mint_price(deps: Deps, is_admin: bool) -> Result { + let config = CONFIG.load(deps.storage)?; + + let factory: ParamsResponse = deps + .querier + .query_wasm_smart(config.factory, &Sg2QueryMsg::Params {})?; + let factory_params = factory.params; + + if is_admin { + return Ok(coin( + factory_params.extension.airdrop_mint_price.amount.u128(), + factory_params.extension.airdrop_mint_price.denom, + )); + } + + if config.extension.whitelist.is_none() { + let price = config.extension.discount_price.unwrap_or(config.mint_price); + return Ok(price); + } + + let whitelist = config.extension.whitelist.unwrap(); + + let wl_config: WhitelistConfigResponse = deps + .querier + .query_wasm_smart(whitelist, &WhitelistQueryMsg::Config {})?; + + if wl_config.is_active { + Ok(wl_config.mint_price) + } else { + let price = config.extension.discount_price.unwrap_or(config.mint_price); + Ok(price) + } +} + +fn mint_count(deps: Deps, info: &MessageInfo) -> Result { + let mint_count = (MINTER_ADDRS.key(&info.sender).may_load(deps.storage)?).unwrap_or(0); + Ok(mint_count) +} + +pub fn display_max_mintable_tokens( + per_address_limit: u32, + num_tokens: u32, + max_per_address_limit: u32, +) -> Result { + if per_address_limit > max_per_address_limit { + return Ok(max_per_address_limit); + } + if num_tokens < 100 { + return Ok(3_u32); + } + let three_percent = get_three_percent_of_tokens(num_tokens)?.u128(); + Ok(three_percent as u32) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn sudo(deps: DepsMut, _env: Env, msg: SudoMsg) -> Result { + match msg { + SudoMsg::UpdateStatus { + is_verified, + is_blocked, + is_explicit, + } => update_status(deps, is_verified, is_blocked, is_explicit) + .map_err(|_| ContractError::UpdateStatus {}), + } +} + +/// Only governance can update contract params +pub fn update_status( + deps: DepsMut, + is_verified: bool, + is_blocked: bool, + is_explicit: bool, +) -> StdResult { + let mut status = STATUS.load(deps.storage)?; + status.is_verified = is_verified; + status.is_blocked = is_blocked; + status.is_explicit = is_explicit; + STATUS.save(deps.storage, &status)?; + + Ok(Response::new().add_attribute("action", "sudo_update_status")) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { + match msg { + QueryMsg::Config {} => to_binary(&query_config(deps)?), + QueryMsg::Status {} => to_binary(&query_status(deps)?), + QueryMsg::StartTime {} => to_binary(&query_start_time(deps)?), + QueryMsg::MintableNumTokens {} => to_binary(&query_mintable_num_tokens(deps)?), + QueryMsg::MintPrice {} => to_binary(&query_mint_price(deps)?), + QueryMsg::MintCount { address } => to_binary(&query_mint_count(deps, address)?), + } +} + +fn query_config(deps: Deps) -> StdResult { + let config = CONFIG.load(deps.storage)?; + let sg721_address = SG721_ADDRESS.load(deps.storage)?; + + Ok(ConfigResponse { + admin: config.extension.admin.to_string(), + base_token_uri: config.extension.base_token_uri, + sg721_address: sg721_address.to_string(), + sg721_code_id: config.collection_code_id, + num_tokens: config.extension.num_tokens, + start_time: config.extension.start_time, + mint_price: config.mint_price, + per_address_limit: config.extension.per_address_limit, + whitelist: config.extension.whitelist.map(|w| w.to_string()), + factory: config.factory.to_string(), + discount_price: config.extension.discount_price, + }) +} + +pub fn query_status(deps: Deps) -> StdResult { + let status = STATUS.load(deps.storage)?; + + Ok(StatusResponse { status }) +} + +fn query_mint_count(deps: Deps, address: String) -> StdResult { + let addr = deps.api.addr_validate(&address)?; + let mint_count = (MINTER_ADDRS.key(&addr).may_load(deps.storage)?).unwrap_or(0); + Ok(MintCountResponse { + address: addr.to_string(), + count: mint_count, + }) +} + +fn query_start_time(deps: Deps) -> StdResult { + let config = CONFIG.load(deps.storage)?; + Ok(StartTimeResponse { + start_time: config.extension.start_time.to_string(), + }) +} + +fn query_mintable_num_tokens(deps: Deps) -> StdResult { + let count = MINTABLE_NUM_TOKENS.load(deps.storage)?; + Ok(MintableNumTokensResponse { count }) +} + +fn query_mint_price(deps: Deps) -> StdResult { + let config = CONFIG.load(deps.storage)?; + + let factory: ParamsResponse = deps + .querier + .query_wasm_smart(config.factory, &Sg2QueryMsg::Params {})?; + + let factory_params = factory.params; + + let current_price = mint_price(deps, false)?; + let public_price = config.mint_price.clone(); + let whitelist_price: Option = if let Some(whitelist) = config.extension.whitelist { + let wl_config: WhitelistConfigResponse = deps + .querier + .query_wasm_smart(whitelist, &WhitelistQueryMsg::Config {})?; + Some(wl_config.mint_price) + } else { + None + }; + let airdrop_price = coin( + factory_params.extension.airdrop_mint_price.amount.u128(), + config.mint_price.denom, + ); + let discount_price = config.extension.discount_price; + Ok(MintPriceResponse { + public_price, + airdrop_price, + whitelist_price, + current_price, + discount_price, + }) +} + +// Reply callback triggered from cw721 contract instantiation +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result { + if msg.id != INSTANTIATE_SG721_REPLY_ID { + return Err(ContractError::InvalidReplyID {}); + } + + let reply = parse_reply_instantiate_data(msg); + match reply { + Ok(res) => { + let sg721_address = res.contract_address; + SG721_ADDRESS.save(deps.storage, &Addr::unchecked(sg721_address.clone()))?; + Ok(Response::default() + .add_attribute("action", "instantiate_sg721_reply") + .add_attribute("sg721_address", sg721_address)) + } + Err(_) => Err(ContractError::InstantiateSg721Error {}), + } +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn migrate(deps: DepsMut, _env: Env, _msg: Empty) -> Result { + let current_version = cw2::get_contract_version(deps.storage)?; + if current_version.contract != CONTRACT_NAME { + return Err(StdError::generic_err("Cannot upgrade to a different contract").into()); + } + let version: Version = current_version + .version + .parse() + .map_err(|_| StdError::generic_err("Invalid contract version"))?; + let new_version: Version = CONTRACT_VERSION + .parse() + .map_err(|_| StdError::generic_err("Invalid contract version"))?; + + if version > new_version { + return Err(StdError::generic_err("Cannot upgrade to a previous contract version").into()); + } + // if same version return + if version == new_version { + return Ok(Response::new()); + } + + // set new contract version + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + let event = Event::new("migrate") + .add_attribute("from_name", current_version.contract) + .add_attribute("from_version", current_version.version) + .add_attribute("to_name", CONTRACT_NAME) + .add_attribute("to_version", CONTRACT_VERSION); + Ok(Response::new().add_event(event)) +} diff --git a/contracts/minters/vending-minter-merkle-wl/src/error.rs b/contracts/minters/vending-minter-merkle-wl/src/error.rs new file mode 100644 index 000000000..5defd6e75 --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/src/error.rs @@ -0,0 +1,106 @@ +use cosmwasm_std::{Coin, StdError, Timestamp}; +use cw_utils::PaymentError; +use sg1::FeeError; +use thiserror::Error; +use url::ParseError; +#[derive(Error, Debug, PartialEq)] +pub enum ContractError { + #[error("{0}")] + Std(#[from] StdError), + + #[error("{0}")] + Payment(#[from] PaymentError), + + #[error("{0}")] + ParseError(#[from] ParseError), + + #[error("{0}")] + Fee(#[from] FeeError), + + #[error("Unauthorized: {0}")] + Unauthorized(String), + + #[error("UpdateStatus")] + UpdateStatus {}, + + #[error("Invalid reply ID")] + InvalidReplyID {}, + + #[error("Not enough funds sent")] + NotEnoughFunds {}, + + #[error("TooManyCoins")] + TooManyCoins {}, + + #[error("IncorrectPaymentAmount {0} != {1}")] + IncorrectPaymentAmount(Coin, Coin), + + #[error("InvalidNumTokens {max}, min: 1")] + InvalidNumTokens { max: u32, min: u32 }, + + #[error("Sold out")] + SoldOut {}, + + #[error("Not sold out")] + NotSoldOut {}, + + #[error("InvalidDenom {expected} got {got}")] + InvalidDenom { expected: String, got: String }, + + #[error("Minimum network mint price {expected} got {got}")] + InsufficientMintPrice { expected: u128, got: u128 }, + + #[error("Minimum whitelist mint price {expected} got {got}")] + InsufficientWhitelistMintPrice { expected: u128, got: u128 }, + + #[error("Update price {updated} higher than allowed price {allowed}")] + UpdatedMintPriceTooHigh { allowed: u128, updated: u128 }, + + #[error("Invalid address {addr}")] + InvalidAddress { addr: String }, + + #[error("Invalid token id")] + InvalidTokenId {}, + + #[error("AlreadyStarted")] + AlreadyStarted {}, + + #[error("BeforeGenesisTime")] + BeforeGenesisTime {}, + + #[error("WhitelistAlreadyStarted")] + WhitelistAlreadyStarted {}, + + #[error("InvalidStartTime {0} < {1}")] + InvalidStartTime(Timestamp, Timestamp), + + #[error("InvalidStartTradingTime {0} > {1}")] + InvalidStartTradingTime(Timestamp, Timestamp), + + #[error("Instantiate sg721 error")] + InstantiateSg721Error {}, + + #[error("Invalid base token URI (must be an IPFS URI)")] + InvalidBaseTokenURI {}, + + #[error("address not on whitelist: {addr}")] + NotWhitelisted { addr: String }, + + #[error("Minting has not started yet")] + BeforeMintStartTime {}, + + #[error("Invalid minting limit per address. max: {max}, min: 1, got: {got}")] + InvalidPerAddressLimit { max: u32, min: u32, got: u32 }, + + #[error("Max minting limit per address exceeded")] + MaxPerAddressLimitExceeded {}, + + #[error("Token id: {token_id} already sold")] + TokenIdAlreadySold { token_id: u32 }, + + #[error("NoEnvTransactionIndex")] + NoEnvTransactionIndex {}, + + #[error("Multiply Fraction Error")] + CheckedMultiplyFractionError {}, +} diff --git a/contracts/minters/vending-minter-merkle-wl/src/helpers.rs b/contracts/minters/vending-minter-merkle-wl/src/helpers.rs new file mode 100644 index 000000000..173587cb6 --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/src/helpers.rs @@ -0,0 +1,62 @@ +use cosmwasm_schema::cw_serde; +use cosmwasm_std::{ + to_binary, Addr, Coin, ContractInfoResponse, CustomQuery, Querier, QuerierWrapper, StdResult, + WasmMsg, WasmQuery, +}; +use sg_std::CosmosMsg; + +use crate::msg::{ConfigResponse, ExecuteMsg, QueryMsg}; + +/// MinterContract is a wrapper around Addr that provides a lot of helpers +/// for working with this. +#[cw_serde] +pub struct MinterContract(pub Addr); + +impl MinterContract { + pub fn addr(&self) -> Addr { + self.0.clone() + } + + pub fn call>(&self, msg: T) -> StdResult { + let msg = to_binary(&msg.into())?; + Ok(WasmMsg::Execute { + contract_addr: self.addr().into(), + msg, + funds: vec![], + } + .into()) + } + + pub fn call_with_funds>( + &self, + msg: T, + funds: Coin, + ) -> StdResult { + let msg = to_binary(&msg.into())?; + Ok(WasmMsg::Execute { + contract_addr: self.addr().into(), + msg, + funds: vec![funds], + } + .into()) + } + + pub fn contract_info(&self, querier: &Q) -> StdResult + where + Q: Querier, + T: Into, + CQ: CustomQuery, + { + let query = WasmQuery::ContractInfo { + contract_addr: self.addr().into(), + } + .into(); + let res: ContractInfoResponse = QuerierWrapper::::new(querier).query(&query)?; + Ok(res) + } + + pub fn config(&self, querier: &QuerierWrapper) -> StdResult { + let res: ConfigResponse = querier.query_wasm_smart(self.addr(), &QueryMsg::Config {})?; + Ok(res) + } +} diff --git a/contracts/minters/vending-minter-merkle-wl/src/lib.rs b/contracts/minters/vending-minter-merkle-wl/src/lib.rs new file mode 100644 index 000000000..e061fa43c --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/src/lib.rs @@ -0,0 +1,9 @@ +pub mod contract; +mod error; +pub mod msg; + +pub mod state; +pub use crate::error::ContractError; + +pub mod helpers; +pub mod validation; diff --git a/contracts/minters/vending-minter-merkle-wl/src/msg.rs b/contracts/minters/vending-minter-merkle-wl/src/msg.rs new file mode 100644 index 000000000..cdf95406c --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/src/msg.rs @@ -0,0 +1,92 @@ +use cosmwasm_schema::cw_serde; +use cosmwasm_std::{Coin, Timestamp}; +use vending_factory::{msg::VendingMinterCreateMsg, state::VendingMinterParams}; + +#[cw_serde] +pub struct InstantiateMsg { + pub create_msg: VendingMinterCreateMsg, + pub params: VendingMinterParams, +} + +#[cw_serde] +pub enum ExecuteMsg { + Mint { + proof_hashes: Option> + }, + SetWhitelist { + whitelist: String, + }, + Purge {}, + UpdateMintPrice { + price: u128, + }, + UpdateStartTime(Timestamp), + /// Runs custom checks against TradingStartTime on VendingMinter, then updates by calling sg721-base + UpdateStartTradingTime(Option), + UpdatePerAddressLimit { + per_address_limit: u32, + }, + MintTo { + recipient: String, + }, + MintFor { + token_id: u32, + recipient: String, + }, + Shuffle {}, + BurnRemaining {}, + UpdateDiscountPrice { + price: u128, + }, + RemoveDiscountPrice {}, +} + +#[cw_serde] +pub enum QueryMsg { + Config {}, + MintableNumTokens {}, + StartTime {}, + MintPrice {}, + MintCount { address: String }, + Status {}, +} + +#[cw_serde] +pub struct ConfigResponse { + pub admin: String, + pub base_token_uri: String, + pub num_tokens: u32, + pub per_address_limit: u32, + pub sg721_address: String, + pub sg721_code_id: u64, + pub start_time: Timestamp, + pub mint_price: Coin, + pub whitelist: Option, + pub factory: String, + pub discount_price: Option, +} + +#[cw_serde] +pub struct MintableNumTokensResponse { + pub count: u32, +} + +#[cw_serde] +pub struct StartTimeResponse { + pub start_time: String, +} + +#[cw_serde] +pub struct MintPriceResponse { + pub public_price: Coin, + pub airdrop_price: Coin, + pub whitelist_price: Option, + pub current_price: Coin, + pub discount_price: Option, +} + +#[cw_serde] +pub struct MintCountResponse { + pub address: String, + pub count: u32, +} diff --git a/contracts/minters/vending-minter-merkle-wl/src/state.rs b/contracts/minters/vending-minter-merkle-wl/src/state.rs new file mode 100644 index 000000000..04c98b3c1 --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/src/state.rs @@ -0,0 +1,27 @@ +use cosmwasm_schema::cw_serde; +use cosmwasm_std::{Addr, Coin, Timestamp}; +use cw_storage_plus::{Item, Map}; +use sg4::{MinterConfig, Status}; + +#[cw_serde] +pub struct ConfigExtension { + pub admin: Addr, + pub payment_address: Option, + pub base_token_uri: String, + pub num_tokens: u32, + pub whitelist: Option, + pub start_time: Timestamp, + pub per_address_limit: u32, + pub discount_price: Option, +} +pub type Config = MinterConfig; + +pub const CONFIG: Item = Item::new("config"); +pub const SG721_ADDRESS: Item = Item::new("sg721_address"); +// map of index position and token id +pub const MINTABLE_TOKEN_POSITIONS: Map = Map::new("mt"); +pub const MINTABLE_NUM_TOKENS: Item = Item::new("mintable_num_tokens"); +pub const MINTER_ADDRS: Map<&Addr, u32> = Map::new("ma"); + +/// Holds the status of the minter. Can be changed with on-chain governance proposals. +pub const STATUS: Item = Item::new("status"); diff --git a/contracts/minters/vending-minter-merkle-wl/src/testing.rs b/contracts/minters/vending-minter-merkle-wl/src/testing.rs new file mode 100644 index 000000000..8af010928 --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/src/testing.rs @@ -0,0 +1,2 @@ +mod setup; +mod tests; diff --git a/contracts/minters/vending-minter-merkle-wl/src/validation.rs b/contracts/minters/vending-minter-merkle-wl/src/validation.rs new file mode 100644 index 000000000..a3eb1acef --- /dev/null +++ b/contracts/minters/vending-minter-merkle-wl/src/validation.rs @@ -0,0 +1,28 @@ +use crate::ContractError; +use crate::ContractError::CheckedMultiplyFractionError; +use cosmwasm_std::Uint128; + +pub fn get_three_percent_of_tokens(num_tokens: u32) -> Result { + let three_percent = (Uint128::new(3), Uint128::new(100)); + let three_percent_tokens = Uint128::from(num_tokens) + .checked_mul_ceil(three_percent) + .map_err(|_| CheckedMultiplyFractionError {})?; + Ok(three_percent_tokens) +} + +// Check per address limit to make sure it's <= 1% num tokens +pub fn check_dynamic_per_address_limit( + per_address_limit: u32, + num_tokens: u32, + max_per_address_limit: u32, +) -> Result { + if per_address_limit > max_per_address_limit { + return Ok(false); + } + if num_tokens < 100 { + return Ok(per_address_limit <= 3); + } + let three_percent_tokens = get_three_percent_of_tokens(num_tokens)?; + let result = Uint128::from(per_address_limit) <= three_percent_tokens; + Ok(result) +} diff --git a/contracts/whitelists/whitelist-merkletree/.cargo/config b/contracts/whitelists/whitelist-merkletree/.cargo/config new file mode 100644 index 000000000..af5698e58 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/.cargo/config @@ -0,0 +1,4 @@ +[alias] +wasm = "build --release --lib --target wasm32-unknown-unknown" +unit-test = "test --lib" +schema = "run --bin schema" diff --git a/contracts/whitelists/whitelist-merkletree/.editorconfig b/contracts/whitelists/whitelist-merkletree/.editorconfig new file mode 100644 index 000000000..3d36f20b1 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.rs] +indent_size = 4 diff --git a/contracts/whitelists/whitelist-merkletree/.gitignore b/contracts/whitelists/whitelist-merkletree/.gitignore new file mode 100644 index 000000000..dfdaaa6bc --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/.gitignore @@ -0,0 +1,15 @@ +# Build results +/target + +# Cargo+Git helper file (https://github.com/rust-lang/cargo/blob/0.44.1/src/cargo/sources/git/utils.rs#L320-L327) +.cargo-ok + +# Text file backups +**/*.rs.bk + +# macOS +.DS_Store + +# IDEs +*.iml +.idea diff --git a/contracts/whitelists/whitelist-merkletree/Cargo.toml b/contracts/whitelists/whitelist-merkletree/Cargo.toml new file mode 100644 index 000000000..f9b9d18e7 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/Cargo.toml @@ -0,0 +1,44 @@ +[package] +name = "whitelist-mtree" +authors = ["Martin Mo Kromsten "] +description = "Stargaze Merkle Tree Whitelist Contract" +version = { workspace = true } +edition = { workspace = true } +homepage = { workspace = true } +repository = { workspace = true } +license = { workspace = true } + +exclude = [ + # Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. + "contract.wasm", + "hash.txt", +] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +crate-type = ["cdylib", "rlib"] + +[features] +# for more explicit tests, cargo test --features=backtraces +backtraces = ["cosmwasm-std/backtraces"] +# use library feature to disable all instantiate/execute/query exports +library = [] + +[dependencies] +cosmwasm-schema = { workspace = true } +cosmwasm-std = { workspace = true } +cw2 = { workspace = true } +cw-storage-plus = { workspace = true } +cw-utils = { workspace = true } +rust_decimal = { version = "1.14.3" } +schemars = { workspace = true } +serde = { workspace = true } +sg1 = { workspace = true } +sg-std = { workspace = true } +thiserror = { workspace = true } +url = { workspace = true } +hex = "0.4.3" +serde_json = "1.0.105" +rs_merkle = { version = "1.4.1", default-features = false } + diff --git a/contracts/whitelists/whitelist-merkletree/README.md b/contracts/whitelists/whitelist-merkletree/README.md new file mode 100644 index 000000000..da2ee3822 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/README.md @@ -0,0 +1,26 @@ +# Whitelist MerkleTree contract + +A whitelist contract that relies on MerkleTree data structure for verifying inclusion of an address in a whitelist. + +Only merkle root (and optionaly URI of a tree) are stored within the state. Inclusion can be verified by submitting a user address and hex-encoded list of merklee proofs. This approach allows significant reduction of gas usage during storage phase with a downside of having actual data off-chain and reliance on 3rd parties for providing inclusiong proofs. + +Inclusion operation is a slighly more complex and costly when compared to the standard map-based whitelist. The contract uses **Sha256** for hashing concatenated proofs. Hashes are sorted on byte level prior to concatenation, which significantly simplifies the verification process by not requiring submission of leaf positions. + +**Important:** Make sure that your algorithm for merkle tree construction also sort the hashes. See example of extending `rs-merkle` library in `tests/hasher.rs` + +## Gas Usage + +The contracts for the merkletree based whitelist and the updated minter that supports it were both deployed to the testnet to measure actual gas usage in production. The contracts were instantiated and tested with two different whitelist sizes: **703** and **91,750,400** entries + +#### Instantiating +Naturally due to only needing to store a merkle tree root in the state of the contract there is no difference between instantiating a whitelist with the [smaller](https://testnet-explorer.publicawesome.dev/stargaze/tx/07BB768915A24C17C12982D3FE34ADF0453AA9231961197A8B4E5E228D5C6B54) and the [bigger](https://testnet-explorer.publicawesome.dev/stargaze/tx/14E2DFB03AFB2A711A6AF601FA43FAEADFC8D0BA8581DD9E02EEFFB582E8AFB7) list sizes and they both consume 190,350 units of gas. + +#### Minting + +Number of hashing operations required to check for inclusion of an address in a merkle tree is at most `Math.ceil[ logâ‚‚N ]` and in some cases even smaller depending on the depth of a leaf within a tree. + +In case of the smaller tree with 704 records we had to submit 8 hash proofs and an example mint [transaction](https://testnet-explorer.publicawesome.dev/stargaze/tx/8692581537939E09BF5D81594B078436D4224F0944B515A421F096CEE480ECA9) took 635,345 units of gas + +The bigger tree with ~90 million records [used](https://testnet-explorer.publicawesome.dev/stargaze/tx/670A76A64F0A64FB1A5077DADDB6C326A9A64B66999215345C47BA3F03265811) 647,448 units of gas and required 24 proofs only (up to 27 with deeper leaves). + +The jump from computing 8 to computing 24 proofs (+16) only took additional 8 thousands units of gas. Keep in mind that another increase in 16 proofs allow us to check for inclusion in a tree with 1 trillion addresses. diff --git a/contracts/whitelists/whitelist-merkletree/rustfmt.toml b/contracts/whitelists/whitelist-merkletree/rustfmt.toml new file mode 100644 index 000000000..11a85e6a9 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/rustfmt.toml @@ -0,0 +1,15 @@ +# stable +newline_style = "unix" +hard_tabs = false +tab_spaces = 4 + +# unstable... should we require `rustup run nightly cargo fmt` ? +# or just update the style guide when they are stable? +#fn_single_line = true +#format_code_in_doc_comments = true +#overflow_delimited_expr = true +#reorder_impl_items = true +#struct_field_align_threshold = 20 +#struct_lit_single_line = true +#report_todo = "Always" + diff --git a/contracts/whitelists/whitelist-merkletree/schema/raw/execute.json b/contracts/whitelists/whitelist-merkletree/schema/raw/execute.json new file mode 100644 index 000000000..48a24ca07 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/schema/raw/execute.json @@ -0,0 +1,81 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "update_start_time" + ], + "properties": { + "update_start_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_end_time" + ], + "properties": { + "update_end_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_admins" + ], + "properties": { + "update_admins": { + "type": "object", + "required": [ + "admins" + ], + "properties": { + "admins": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "freeze" + ], + "properties": { + "freeze": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/whitelists/whitelist-merkletree/schema/raw/instantiate.json b/contracts/whitelists/whitelist-merkletree/schema/raw/instantiate.json new file mode 100644 index 000000000..c1b60a34c --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/schema/raw/instantiate.json @@ -0,0 +1,82 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "admins", + "admins_mutable", + "end_time", + "merkle_root", + "mint_price", + "per_address_limit", + "start_time" + ], + "properties": { + "admins": { + "type": "array", + "items": { + "type": "string" + } + }, + "admins_mutable": { + "type": "boolean" + }, + "end_time": { + "$ref": "#/definitions/Timestamp" + }, + "merkle_root": { + "type": "string" + }, + "merkle_tree_uri": { + "type": [ + "string", + "null" + ] + }, + "mint_price": { + "$ref": "#/definitions/Coin" + }, + "per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "start_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/whitelists/whitelist-merkletree/schema/raw/query.json b/contracts/whitelists/whitelist-merkletree/schema/raw/query.json new file mode 100644 index 000000000..216056198 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/schema/raw/query.json @@ -0,0 +1,451 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "has_started" + ], + "properties": { + "has_started": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "has_ended" + ], + "properties": { + "has_ended": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "is_active" + ], + "properties": { + "is_active": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "has_member" + ], + "properties": { + "has_member": { + "type": "object", + "required": [ + "member", + "proof_hashes" + ], + "properties": { + "member": { + "type": "string" + }, + "proof_hashes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "admin_list" + ], + "properties": { + "admin_list": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "can_execute" + ], + "properties": { + "can_execute": { + "type": "object", + "required": [ + "msg", + "sender" + ], + "properties": { + "msg": { + "$ref": "#/definitions/CosmosMsg_for_Empty" + }, + "sender": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "merkle_root" + ], + "properties": { + "merkle_root": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "merkle_tree_u_r_i" + ], + "properties": { + "merkle_tree_u_r_i": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "BankMsg": { + "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", + "oneOf": [ + { + "description": "Sends native tokens from the contract to the given address.\n\nThis is translated to a [MsgSend](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto#L19-L28). `from_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "send" + ], + "properties": { + "send": { + "type": "object", + "required": [ + "amount", + "to_address" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "to_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will burn the given coins from the contract's account. There is no Cosmos SDK message that performs this, but it can be done by calling the bank keeper. Important if a contract controls significant token supply that must be retired.", + "type": "object", + "required": [ + "burn" + ], + "properties": { + "burn": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "CosmosMsg_for_Empty": { + "oneOf": [ + { + "type": "object", + "required": [ + "bank" + ], + "properties": { + "bank": { + "$ref": "#/definitions/BankMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "custom" + ], + "properties": { + "custom": { + "$ref": "#/definitions/Empty" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "wasm" + ], + "properties": { + "wasm": { + "$ref": "#/definitions/WasmMsg" + } + }, + "additionalProperties": false + } + ] + }, + "Empty": { + "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", + "type": "object" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "WasmMsg": { + "description": "The message types of the wasm module.\n\nSee https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto", + "oneOf": [ + { + "description": "Dispatches a call to another contract at a known address (with known ABI).\n\nThis is translated to a [MsgExecuteContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L68-L78). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "contract_addr", + "funds", + "msg" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "msg": { + "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "instantiate" + ], + "properties": { + "instantiate": { + "type": "object", + "required": [ + "code_id", + "funds", + "label", + "msg" + ], + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + }, + "code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "label": { + "description": "A human-readbale label for the contract", + "type": "string" + }, + "msg": { + "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "migrate" + ], + "properties": { + "migrate": { + "type": "object", + "required": [ + "contract_addr", + "msg", + "new_code_id" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "msg": { + "description": "msg is the json-encoded MigrateMsg struct that will be passed to the new code", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "new_code_id": { + "description": "the code_id of the new logic to place in the given contract", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sets a new admin (for migrate) on the given contract. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "update_admin" + ], + "properties": { + "update_admin": { + "type": "object", + "required": [ + "admin", + "contract_addr" + ], + "properties": { + "admin": { + "type": "string" + }, + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Clears the admin on the given contract, so no more migration possible. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "clear_admin" + ], + "properties": { + "clear_admin": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_admin_list.json b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_admin_list.json new file mode 100644 index 000000000..3b04e955c --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_admin_list.json @@ -0,0 +1,21 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AdminListResponse", + "type": "object", + "required": [ + "admins", + "mutable" + ], + "properties": { + "admins": { + "type": "array", + "items": { + "type": "string" + } + }, + "mutable": { + "type": "boolean" + } + }, + "additionalProperties": false +} diff --git a/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_can_execute.json b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_can_execute.json new file mode 100644 index 000000000..e2ed10214 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_can_execute.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "CanExecuteResponse", + "type": "object", + "required": [ + "can_execute" + ], + "properties": { + "can_execute": { + "type": "boolean" + } + }, + "additionalProperties": false +} diff --git a/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_config.json b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_config.json new file mode 100644 index 000000000..e96c30e53 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_config.json @@ -0,0 +1,77 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ConfigResponse", + "type": "object", + "required": [ + "end_time", + "is_active", + "member_limit", + "mint_price", + "num_members", + "per_address_limit", + "start_time" + ], + "properties": { + "end_time": { + "$ref": "#/definitions/Timestamp" + }, + "is_active": { + "type": "boolean" + }, + "member_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "mint_price": { + "$ref": "#/definitions/Coin" + }, + "num_members": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "start_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_has_ended.json b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_has_ended.json new file mode 100644 index 000000000..6e207ab48 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_has_ended.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "HasEndedResponse", + "type": "object", + "required": [ + "has_ended" + ], + "properties": { + "has_ended": { + "type": "boolean" + } + }, + "additionalProperties": false +} diff --git a/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_has_member.json b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_has_member.json new file mode 100644 index 000000000..8e203003b --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_has_member.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "HasMemberResponse", + "type": "object", + "required": [ + "has_member" + ], + "properties": { + "has_member": { + "type": "boolean" + } + }, + "additionalProperties": false +} diff --git a/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_has_started.json b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_has_started.json new file mode 100644 index 000000000..25614f8d8 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_has_started.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "HasStartedResponse", + "type": "object", + "required": [ + "has_started" + ], + "properties": { + "has_started": { + "type": "boolean" + } + }, + "additionalProperties": false +} diff --git a/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_is_active.json b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_is_active.json new file mode 100644 index 000000000..2dc928c41 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_is_active.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "IsActiveResponse", + "type": "object", + "required": [ + "is_active" + ], + "properties": { + "is_active": { + "type": "boolean" + } + }, + "additionalProperties": false +} diff --git a/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_merkle_root.json b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_merkle_root.json new file mode 100644 index 000000000..fad931f91 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_merkle_root.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MerkleRootResponse", + "type": "object", + "required": [ + "merkle_root" + ], + "properties": { + "merkle_root": { + "type": "string" + } + }, + "additionalProperties": false +} diff --git a/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_merkle_tree_u_r_i.json b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_merkle_tree_u_r_i.json new file mode 100644 index 000000000..a6991d43f --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/schema/raw/response_to_merkle_tree_u_r_i.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MerkleTreeURIResponse", + "type": "object", + "properties": { + "merkle_tree_uri": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false +} diff --git a/contracts/whitelists/whitelist-merkletree/schema/whitelist-mtree.json b/contracts/whitelists/whitelist-merkletree/schema/whitelist-mtree.json new file mode 100644 index 000000000..634cb4c63 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/schema/whitelist-mtree.json @@ -0,0 +1,819 @@ +{ + "contract_name": "whitelist-mtree", + "contract_version": "3.1.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "admins", + "admins_mutable", + "end_time", + "merkle_root", + "mint_price", + "per_address_limit", + "start_time" + ], + "properties": { + "admins": { + "type": "array", + "items": { + "type": "string" + } + }, + "admins_mutable": { + "type": "boolean" + }, + "end_time": { + "$ref": "#/definitions/Timestamp" + }, + "merkle_root": { + "type": "string" + }, + "merkle_tree_uri": { + "type": [ + "string", + "null" + ] + }, + "mint_price": { + "$ref": "#/definitions/Coin" + }, + "per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "start_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "update_start_time" + ], + "properties": { + "update_start_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_end_time" + ], + "properties": { + "update_end_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_admins" + ], + "properties": { + "update_admins": { + "type": "object", + "required": [ + "admins" + ], + "properties": { + "admins": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "freeze" + ], + "properties": { + "freeze": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "has_started" + ], + "properties": { + "has_started": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "has_ended" + ], + "properties": { + "has_ended": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "is_active" + ], + "properties": { + "is_active": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "has_member" + ], + "properties": { + "has_member": { + "type": "object", + "required": [ + "member", + "proof_hashes" + ], + "properties": { + "member": { + "type": "string" + }, + "proof_hashes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "admin_list" + ], + "properties": { + "admin_list": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "can_execute" + ], + "properties": { + "can_execute": { + "type": "object", + "required": [ + "msg", + "sender" + ], + "properties": { + "msg": { + "$ref": "#/definitions/CosmosMsg_for_Empty" + }, + "sender": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "merkle_root" + ], + "properties": { + "merkle_root": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "merkle_tree_u_r_i" + ], + "properties": { + "merkle_tree_u_r_i": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "BankMsg": { + "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", + "oneOf": [ + { + "description": "Sends native tokens from the contract to the given address.\n\nThis is translated to a [MsgSend](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto#L19-L28). `from_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "send" + ], + "properties": { + "send": { + "type": "object", + "required": [ + "amount", + "to_address" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "to_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This will burn the given coins from the contract's account. There is no Cosmos SDK message that performs this, but it can be done by calling the bank keeper. Important if a contract controls significant token supply that must be retired.", + "type": "object", + "required": [ + "burn" + ], + "properties": { + "burn": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "CosmosMsg_for_Empty": { + "oneOf": [ + { + "type": "object", + "required": [ + "bank" + ], + "properties": { + "bank": { + "$ref": "#/definitions/BankMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "custom" + ], + "properties": { + "custom": { + "$ref": "#/definitions/Empty" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "wasm" + ], + "properties": { + "wasm": { + "$ref": "#/definitions/WasmMsg" + } + }, + "additionalProperties": false + } + ] + }, + "Empty": { + "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", + "type": "object" + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "WasmMsg": { + "description": "The message types of the wasm module.\n\nSee https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto", + "oneOf": [ + { + "description": "Dispatches a call to another contract at a known address (with known ABI).\n\nThis is translated to a [MsgExecuteContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L68-L78). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "contract_addr", + "funds", + "msg" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "msg": { + "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThe contract address is non-predictable. But it is guaranteed that when emitting the same Instantiate message multiple times, multiple instances on different addresses will be generated. See also Instantiate2.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L53-L71). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "instantiate" + ], + "properties": { + "instantiate": { + "type": "object", + "required": [ + "code_id", + "funds", + "label", + "msg" + ], + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + }, + "code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "label": { + "description": "A human-readbale label for the contract", + "type": "string" + }, + "msg": { + "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "migrate" + ], + "properties": { + "migrate": { + "type": "object", + "required": [ + "contract_addr", + "msg", + "new_code_id" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "msg": { + "description": "msg is the json-encoded MigrateMsg struct that will be passed to the new code", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "new_code_id": { + "description": "the code_id of the new logic to place in the given contract", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Sets a new admin (for migrate) on the given contract. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "update_admin" + ], + "properties": { + "update_admin": { + "type": "object", + "required": [ + "admin", + "contract_addr" + ], + "properties": { + "admin": { + "type": "string" + }, + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Clears the admin on the given contract, so no more migration possible. Fails if this contract is not currently admin of the target contract.", + "type": "object", + "required": [ + "clear_admin" + ], + "properties": { + "clear_admin": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + } + } + }, + "migrate": null, + "sudo": null, + "responses": { + "admin_list": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AdminListResponse", + "type": "object", + "required": [ + "admins", + "mutable" + ], + "properties": { + "admins": { + "type": "array", + "items": { + "type": "string" + } + }, + "mutable": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "can_execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "CanExecuteResponse", + "type": "object", + "required": [ + "can_execute" + ], + "properties": { + "can_execute": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "config": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ConfigResponse", + "type": "object", + "required": [ + "end_time", + "is_active", + "member_limit", + "mint_price", + "num_members", + "per_address_limit", + "start_time" + ], + "properties": { + "end_time": { + "$ref": "#/definitions/Timestamp" + }, + "is_active": { + "type": "boolean" + }, + "member_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "mint_price": { + "$ref": "#/definitions/Coin" + }, + "num_members": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "start_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } + }, + "has_ended": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "HasEndedResponse", + "type": "object", + "required": [ + "has_ended" + ], + "properties": { + "has_ended": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "has_member": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "HasMemberResponse", + "type": "object", + "required": [ + "has_member" + ], + "properties": { + "has_member": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "has_started": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "HasStartedResponse", + "type": "object", + "required": [ + "has_started" + ], + "properties": { + "has_started": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "is_active": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "IsActiveResponse", + "type": "object", + "required": [ + "is_active" + ], + "properties": { + "is_active": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "merkle_root": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MerkleRootResponse", + "type": "object", + "required": [ + "merkle_root" + ], + "properties": { + "merkle_root": { + "type": "string" + } + }, + "additionalProperties": false + }, + "merkle_tree_u_r_i": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MerkleTreeURIResponse", + "type": "object", + "properties": { + "merkle_tree_uri": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/whitelists/whitelist-merkletree/src/admin.rs b/contracts/whitelists/whitelist-merkletree/src/admin.rs new file mode 100644 index 000000000..f4c065b9f --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/admin.rs @@ -0,0 +1,67 @@ +use cosmwasm_std::{Addr, Deps, DepsMut, Env, MessageInfo, StdResult}; +use sg_std::Response; + +use crate::{ + helpers::validators::map_validate, + msg::{AdminListResponse, CanExecuteResponse}, + state::ADMIN_LIST, + ContractError, +}; + +pub fn execute_update_admins( + deps: DepsMut, + _env: Env, + info: MessageInfo, + admins: Vec, +) -> Result { + let mut cfg = ADMIN_LIST.load(deps.storage)?; + if !cfg.can_modify(info.sender.as_ref()) { + Err(ContractError::Unauthorized {}) + } else { + cfg.admins = map_validate(deps.api, &admins)?; + ADMIN_LIST.save(deps.storage, &cfg)?; + + let res = Response::new().add_attribute("action", "update_admins"); + Ok(res) + } +} + +pub fn can_execute(deps: &DepsMut, sender: Addr) -> Result { + let cfg = ADMIN_LIST.load(deps.storage)?; + let can = cfg.is_admin(&sender); + if !can { + return Err(ContractError::Unauthorized {}); + } + Ok(sender) +} + +pub fn execute_freeze( + deps: DepsMut, + _env: Env, + info: MessageInfo, +) -> Result { + let mut cfg = ADMIN_LIST.load(deps.storage)?; + if !cfg.can_modify(info.sender.as_ref()) { + Err(ContractError::Unauthorized {}) + } else { + cfg.mutable = false; + ADMIN_LIST.save(deps.storage, &cfg)?; + + let res = Response::new().add_attribute("action", "freeze"); + Ok(res) + } +} + +pub fn query_admin_list(deps: Deps) -> StdResult { + let cfg = ADMIN_LIST.load(deps.storage)?; + Ok(AdminListResponse { + admins: cfg.admins.into_iter().map(|a| a.into()).collect(), + mutable: cfg.mutable, + }) +} + +pub fn query_can_execute(deps: Deps, sender: &str) -> StdResult { + let cfg = ADMIN_LIST.load(deps.storage)?; + let can = cfg.is_admin(deps.api.addr_validate(sender)?); + Ok(CanExecuteResponse { can_execute: can }) +} diff --git a/contracts/whitelists/whitelist-merkletree/src/bin/schema.rs b/contracts/whitelists/whitelist-merkletree/src/bin/schema.rs new file mode 100644 index 000000000..fca0d2225 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/bin/schema.rs @@ -0,0 +1,11 @@ +use cosmwasm_schema::write_api; + +use whitelist_mtree::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; + +fn main() { + write_api! { + instantiate: InstantiateMsg, + execute: ExecuteMsg, + query: QueryMsg, + } +} diff --git a/contracts/whitelists/whitelist-merkletree/src/contract.rs b/contracts/whitelists/whitelist-merkletree/src/contract.rs new file mode 100644 index 000000000..a85d65d59 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/contract.rs @@ -0,0 +1,312 @@ +use crate::admin::{ + can_execute, execute_freeze, execute_update_admins, query_admin_list, query_can_execute, +}; +use crate::error::ContractError; +use crate::helpers::crypto::{verify_merkle_root, valid_hash_string, string_to_byte_slice}; +use crate::helpers::utils::verify_tree_uri; +use crate::helpers::validators::map_validate; +use crate::msg::{ + ConfigResponse, ExecuteMsg, HasEndedResponse, HasMemberResponse, + HasStartedResponse, InstantiateMsg, IsActiveResponse, QueryMsg, MerkleRootResponse, MerkleTreeURIResponse, +}; +use crate::state::{AdminList, Config, ADMIN_LIST, CONFIG, MERKLE_ROOT, MERKLE_TREE_URI}; +#[cfg(not(feature = "library"))] +use cosmwasm_std::entry_point; +use cosmwasm_std::{to_binary, Binary, Deps, DepsMut, Env, MessageInfo, StdResult, StdError, Timestamp}; +use cw2::set_contract_version; +use sg_std::{Response, GENESIS_MINT_START_TIME, NATIVE_DENOM}; +use cw_utils::nonpayable; + +use rs_merkle::{algorithms::Sha256, Hasher}; + + +// version info for migration info +const CONTRACT_NAME: &str = "crates.io:whitelist-merkletree"; +const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); + +// contract governance params +pub const PRICE_PER_1000_MEMBERS: u128 = 100_000_000; +pub const MIN_MINT_PRICE: u128 = 0; + + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn instantiate( + deps: DepsMut, + env: Env, + info: MessageInfo, + msg: InstantiateMsg, +) -> Result { + nonpayable(&info)?; + verify_merkle_root(&msg.merkle_root)?; + verify_tree_uri(&msg.merkle_tree_uri)?; + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + + if msg.mint_price.denom != NATIVE_DENOM { + return Err(ContractError::InvalidDenom(msg.mint_price.denom)); + } + + if msg.start_time > msg.end_time { + return Err(ContractError::InvalidStartTime( + msg.start_time, + msg.end_time, + )); + } + + if env.block.time >= msg.start_time { + return Err(ContractError::InvalidStartTime( + env.block.time, + msg.start_time, + )); + } + + let genesis_start_time = Timestamp::from_nanos(GENESIS_MINT_START_TIME); + if msg.start_time < genesis_start_time { + return Err(ContractError::InvalidStartTime( + msg.start_time, + genesis_start_time, + )); + } + + + let config = Config { + start_time: msg.start_time, + end_time: msg.end_time, + mint_price: msg.mint_price, + per_address_limit: msg.per_address_limit, + }; + + + let admin_config = AdminList { + admins: map_validate(deps.api, &msg.admins)?, + mutable: msg.admins_mutable, + }; + + MERKLE_ROOT.save(deps.storage, &msg.merkle_root)?; + ADMIN_LIST.save(deps.storage, &admin_config)?; + CONFIG.save(deps.storage, &config)?; + + let tree_url = msg.merkle_tree_uri.unwrap_or(String::default()); + + let mut attrs = Vec::with_capacity(6); + + attrs.push(("action", "update_merkle_tree")); + attrs.push(("merkle_root", &msg.merkle_root)); + attrs.push(("contract_name", CONTRACT_NAME)); + attrs.push(("contract_version", CONTRACT_VERSION)); + if tree_url.len() > 0 { attrs.push(("merkle_tree_uri", &tree_url)); } + attrs.push(("sender", info.sender.as_str())); + + Ok(Response::new().add_attributes(attrs)) + +} + + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn execute( + deps: DepsMut, + env: Env, + info: MessageInfo, + msg: ExecuteMsg, +) -> Result { + match msg { + ExecuteMsg::UpdateStartTime(time) => execute_update_start_time(deps, env, info, time), + ExecuteMsg::UpdateEndTime(time) => execute_update_end_time(deps, env, info, time), + ExecuteMsg::UpdateAdmins { admins } => execute_update_admins(deps, env, info, admins), + ExecuteMsg::Freeze {} => execute_freeze(deps, env, info), + } +} + +pub fn execute_update_merkle_tree( + deps: DepsMut, + env: Env, + info: MessageInfo, + merkle_root: String, + merkle_tree_uri: Option, +) -> Result { + let config = CONFIG.load(deps.storage)?; + can_execute(&deps, info.sender.clone())?; + verify_merkle_root(&merkle_root)?; + verify_tree_uri(&merkle_tree_uri)?; + + if env.block.time < config.end_time { + return Err(ContractError::AlreadyEnded {}); + } + + MERKLE_ROOT.save(deps.storage, &merkle_root)?; + + + let mut attrs = Vec::with_capacity(4); + + attrs.push(("action", String::from("update_merkle_tree"))); + attrs.push(("merkle_root", merkle_root)); + if let Some(uri) = merkle_tree_uri { attrs.push(("merkle_tree_uri", uri)); } + attrs.push(("sender", info.sender.to_string())); + + Ok(Response::new().add_attributes(attrs)) +} + + +pub fn execute_update_start_time( + deps: DepsMut, + env: Env, + info: MessageInfo, + start_time: Timestamp, +) -> Result { + let mut config = CONFIG.load(deps.storage)?; + can_execute(&deps, info.sender.clone())?; + + // don't allow updating start time if whitelist is active + if env.block.time >= config.start_time { + return Err(ContractError::AlreadyStarted {}); + } + + if start_time > config.end_time { + return Err(ContractError::InvalidStartTime(start_time, config.end_time)); + } + + let genesis_start_time = Timestamp::from_nanos(GENESIS_MINT_START_TIME); + let start_time = if start_time < genesis_start_time { + genesis_start_time + } else { + start_time + }; + + config.start_time = start_time; + CONFIG.save(deps.storage, &config)?; + Ok(Response::new() + .add_attribute("action", "update_start_time") + .add_attribute("start_time", start_time.to_string()) + .add_attribute("sender", info.sender)) +} + + + +pub fn execute_update_end_time( + deps: DepsMut, + env: Env, + info: MessageInfo, + end_time: Timestamp, +) -> Result { + let mut config = CONFIG.load(deps.storage)?; + can_execute(&deps, info.sender.clone())?; + + if env.block.time >= config.start_time && end_time > config.end_time { + return Err(ContractError::AlreadyStarted {}); + } + + if end_time < config.start_time { + return Err(ContractError::InvalidEndTime(end_time, config.start_time)); + } + + config.end_time = end_time; + CONFIG.save(deps.storage, &config)?; + Ok(Response::new() + .add_attribute("action", "update_end_time") + .add_attribute("end_time", end_time.to_string()) + .add_attribute("sender", info.sender)) +} + + + + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { + match msg { + QueryMsg::HasStarted {} => to_binary(&query_has_started(deps, env)?), + QueryMsg::HasEnded {} => to_binary(&query_has_ended(deps, env)?), + QueryMsg::IsActive {} => to_binary(&query_is_active(deps, env)?), + QueryMsg::HasMember { member , proof_hashes} => to_binary(&query_has_member(deps, member, proof_hashes)?), + QueryMsg::Config {} => to_binary(&query_config(deps, env)?), + QueryMsg::AdminList {} => to_binary(&query_admin_list(deps)?), + QueryMsg::CanExecute { sender, .. } => to_binary(&query_can_execute(deps, &sender)?), + QueryMsg::MerkleRoot {} => to_binary(&query_merkle_root(deps)?), + QueryMsg::MerkleTreeURI {} => to_binary(&query_merkle_tree_uri(deps)?) + } +} + +fn query_has_started(deps: Deps, env: Env) -> StdResult { + let config = CONFIG.load(deps.storage)?; + Ok(HasStartedResponse { + has_started: (env.block.time >= config.start_time), + }) +} + +fn query_has_ended(deps: Deps, env: Env) -> StdResult { + let config = CONFIG.load(deps.storage)?; + Ok(HasEndedResponse { + has_ended: (env.block.time >= config.end_time), + }) +} + +fn query_is_active(deps: Deps, env: Env) -> StdResult { + let config = CONFIG.load(deps.storage)?; + Ok(IsActiveResponse { + is_active: (env.block.time >= config.start_time) && (env.block.time < config.end_time), + }) +} + + +pub fn query_has_member( + deps: Deps, + member: String, + proof_hashes: Vec, +) -> StdResult { + + deps.api.addr_validate(&member)?; + + let merkle_root = MERKLE_ROOT.load(deps.storage)?; + + let member_init_hash_slice = Sha256::hash(member.as_bytes()); + + let final_hash = proof_hashes + .into_iter() + .try_fold(member_init_hash_slice, + |accum_hash_slice, new_proof_hashstring| { + valid_hash_string(&new_proof_hashstring)?; + + let mut hashe_slices = [ + accum_hash_slice, + string_to_byte_slice(&new_proof_hashstring)? + ]; + hashe_slices.sort_unstable(); + + Sha256::hash(&hashe_slices.concat()) + .try_into() + .map_err(|_| StdError::GenericErr { msg: "Error parsing merkle proof".to_string() }) + }); + + + if final_hash.is_err() { + return Err(cosmwasm_std::StdError::GenericErr { + msg: "Invalid Merkle Proof".to_string(), + }); + } + + return Ok(HasMemberResponse { has_member: merkle_root == hex::encode(final_hash.unwrap()) }); + +} + +pub fn query_config(deps: Deps, env: Env) -> StdResult { + let config = CONFIG.load(deps.storage)?; + Ok(ConfigResponse { + num_members: 0, + member_limit: 0, + per_address_limit: config.per_address_limit, + start_time: config.start_time, + end_time: config.end_time, + mint_price: config.mint_price, + is_active: (env.block.time >= config.start_time) && (env.block.time < config.end_time), + }) +} + +pub fn query_merkle_root(deps: Deps) -> StdResult { + Ok(MerkleRootResponse { + merkle_root: MERKLE_ROOT.load(deps.storage)? + }) +} + +pub fn query_merkle_tree_uri(deps: Deps) -> StdResult { + Ok(MerkleTreeURIResponse { + merkle_tree_uri: MERKLE_TREE_URI.may_load(deps.storage)? + }) +} \ No newline at end of file diff --git a/contracts/whitelists/whitelist-merkletree/src/error.rs b/contracts/whitelists/whitelist-merkletree/src/error.rs new file mode 100644 index 000000000..83c26659d --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/error.rs @@ -0,0 +1,55 @@ +use cosmwasm_std::{StdError, Timestamp}; +use cw_utils::PaymentError; +use sg1::FeeError; +use thiserror::Error; + +#[derive(Error, Debug)] +pub enum ContractError { + #[error("{0}")] + Std(#[from] StdError), + + #[error("Unauthorized")] + Unauthorized {}, + + #[error("AlreadyStarted")] + AlreadyStarted {}, + + #[error("AlreadyEnded")] + AlreadyEnded {}, + + #[error("InvalidDenom: {0}")] + InvalidDenom(String), + + #[error("NoMemberFound: {0}")] + NoMemberFound(String), + + #[error("InvalidStartTime {0} > {1}")] + InvalidStartTime(Timestamp, Timestamp), + + #[error("InvalidEndTime {0} > {1}")] + InvalidEndTime(Timestamp, Timestamp), + + #[error("Invalid merkle tree URI (must be an IPFS URI)")] + InvalidMerkleTreeURI {}, + + #[error("Max minting limit per address exceeded")] + MaxPerAddressLimitExceeded {}, + + #[error("{0}")] + Fee(#[from] FeeError), + + #[error("InvalidUnitPrice {0} < {1}")] + InvalidUnitPrice(u128, u128), + + #[error("IncorrectCreationFee {0} < {1}")] + IncorrectCreationFee(u128, u128), + + #[error("{0}")] + PaymentError(#[from] PaymentError), + + #[error("UnauthorizedAdmin")] + UnauthorizedAdmin {}, + + #[error("InvalidHashString: {0}")] + InvalidHashString(String), +} diff --git a/contracts/whitelists/whitelist-merkletree/src/helpers.rs b/contracts/whitelists/whitelist-merkletree/src/helpers.rs new file mode 100644 index 000000000..90ecbaac7 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/helpers.rs @@ -0,0 +1,4 @@ +pub mod interface; +pub mod validators; +pub mod crypto; +pub mod utils; diff --git a/contracts/whitelists/whitelist-merkletree/src/helpers/crypto.rs b/contracts/whitelists/whitelist-merkletree/src/helpers/crypto.rs new file mode 100644 index 000000000..a7e65c34f --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/helpers/crypto.rs @@ -0,0 +1,28 @@ +use cosmwasm_std::{HexBinary, StdResult, StdError}; + +pub fn valid_hash_string(hash_string: &String) -> StdResult<()> { + let hex_res = HexBinary::from_hex(hash_string.as_str()); + if hex_res.is_err() { + return Err(cosmwasm_std::StdError::InvalidHex { msg: hash_string.to_string() }); + } + + let hex_binary = hex_res.unwrap(); + + let decoded = hex_binary.to_array::<32>(); + + if decoded.is_err() { + return Err(cosmwasm_std::StdError::InvalidDataSize { expected: 32, actual: hex_binary.len() as u64 }) + } + Ok(()) +} + +pub fn verify_merkle_root(merkle_root: &String) -> StdResult<()> { + valid_hash_string(merkle_root) +} + +pub fn string_to_byte_slice(string: &String) -> StdResult<[u8; 32]> { + let mut byte_slice = [0; 32]; + hex::decode_to_slice(string, &mut byte_slice) + .map_err(|_| StdError::GenericErr { msg: "Couldn't decode hash string".to_string() })?; + Ok(byte_slice) +} diff --git a/contracts/whitelists/whitelist-merkletree/src/helpers/interface.rs b/contracts/whitelists/whitelist-merkletree/src/helpers/interface.rs new file mode 100644 index 000000000..786a956a8 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/helpers/interface.rs @@ -0,0 +1,26 @@ +use cosmwasm_schema::cw_serde; +use cosmwasm_std::{to_binary, Addr, StdResult, WasmMsg}; +use sg_std::CosmosMsg; + +use crate::msg::ExecuteMsg; + +/// CwTemplateContract is a wrapper around Addr that provides a lot of helpers +/// for working with this. +#[cw_serde] +pub struct CollectionWhitelistContract(pub Addr); + +impl CollectionWhitelistContract { + pub fn addr(&self) -> Addr { + self.0.clone() + } + + pub fn call>(&self, msg: T) -> StdResult { + let msg = to_binary(&msg.into())?; + Ok(WasmMsg::Execute { + contract_addr: self.addr().into(), + msg, + funds: vec![], + } + .into()) + } +} diff --git a/contracts/whitelists/whitelist-merkletree/src/helpers/utils.rs b/contracts/whitelists/whitelist-merkletree/src/helpers/utils.rs new file mode 100644 index 000000000..a6619adb5 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/helpers/utils.rs @@ -0,0 +1,14 @@ +use cosmwasm_std::StdResult; +use url::Url; + +pub fn verify_tree_uri( + tree_uri: &Option +) -> StdResult<()> { + if tree_uri.is_some() { + let res = Url::parse(&tree_uri.as_ref().unwrap()); + if res.is_err() { + return Err(cosmwasm_std::StdError::GenericErr { msg: "Invalid tree uri".to_string() }); + } + } + Ok(()) +} \ No newline at end of file diff --git a/contracts/whitelists/whitelist-merkletree/src/helpers/validators.rs b/contracts/whitelists/whitelist-merkletree/src/helpers/validators.rs new file mode 100644 index 000000000..b5ffe2984 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/helpers/validators.rs @@ -0,0 +1,5 @@ +use cosmwasm_std::{Addr, Api, StdResult}; + +pub fn map_validate(api: &dyn Api, admins: &[String]) -> StdResult> { + admins.iter().map(|addr| api.addr_validate(addr)).collect() +} diff --git a/contracts/whitelists/whitelist-merkletree/src/lib.rs b/contracts/whitelists/whitelist-merkletree/src/lib.rs new file mode 100644 index 000000000..d2bc7fff3 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/lib.rs @@ -0,0 +1,8 @@ +pub mod admin; +pub mod contract; +pub mod error; +pub mod helpers; +pub mod msg; +pub mod state; +pub mod tests; +pub use crate::error::ContractError; diff --git a/contracts/whitelists/whitelist-merkletree/src/msg.rs b/contracts/whitelists/whitelist-merkletree/src/msg.rs new file mode 100644 index 000000000..b995a3be6 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/msg.rs @@ -0,0 +1,136 @@ +use cosmwasm_schema::{cw_serde, QueryResponses}; +use cosmwasm_std::{Coin, CosmosMsg, Empty, Timestamp}; + +#[cw_serde] +pub struct Member { + pub address: String, + pub mint_count: u32, +} + +#[cw_serde] +pub struct InstantiateMsg { + pub merkle_root: String, + pub merkle_tree_uri: Option, + + pub start_time: Timestamp, + pub end_time: Timestamp, + pub mint_price: Coin, + pub per_address_limit: u32, + + pub admins: Vec, + pub admins_mutable: bool, +} + + +#[cw_serde] +pub enum ExecuteMsg { + UpdateStartTime(Timestamp), + UpdateEndTime(Timestamp), + UpdateAdmins { admins: Vec }, + Freeze {}, +} + +#[cw_serde] +pub struct AdminListResponse { + pub admins: Vec, + pub mutable: bool, +} + +#[cw_serde] +pub struct AddMembersMsg { + pub to_add: Vec, +} + +#[cw_serde] +pub struct RemoveMembersMsg { + pub to_remove: Vec, +} + +#[cw_serde] +#[derive(QueryResponses)] +pub enum QueryMsg { + #[returns(HasStartedResponse)] + HasStarted {}, + #[returns(HasEndedResponse)] + HasEnded {}, + #[returns(IsActiveResponse)] + IsActive {}, + #[returns(HasMemberResponse)] + HasMember { member: String, proof_hashes: Vec }, + #[returns(ConfigResponse)] + Config {}, + #[returns(AdminListResponse)] + AdminList {}, + #[returns(CanExecuteResponse)] + CanExecute { + sender: String, + msg: CosmosMsg, + }, + #[returns(MerkleRootResponse)] + MerkleRoot {}, + #[returns(MerkleTreeURIResponse)] + MerkleTreeURI {} +} + + +#[cw_serde] +pub struct HasMemberResponse { + pub has_member: bool, +} + + +#[cw_serde] +pub struct HasEndedResponse { + pub has_ended: bool, +} + +#[cw_serde] +pub struct HasStartedResponse { + pub has_started: bool, +} + +#[cw_serde] +pub struct IsActiveResponse { + pub is_active: bool, +} + +#[cw_serde] +pub struct MintPriceResponse { + pub mint_price: Coin, +} + + +#[cw_serde] +pub struct ConfigResponse { + pub num_members: u32, + pub per_address_limit: u32, + pub member_limit: u32, + pub start_time: Timestamp, + pub end_time: Timestamp, + pub mint_price: Coin, + pub is_active: bool, +} + + +#[cw_serde] +pub struct MerkleRootResponse { + pub merkle_root: String, +} + +#[cw_serde] +pub struct MerkleTreeURIResponse { + pub merkle_tree_uri: Option, +} + +#[cw_serde] +pub enum SudoMsg { + /// Add a new operator + AddOperator { operator: String }, + /// Remove operator + RemoveOperator { operator: String }, +} + +#[cw_serde] +pub struct CanExecuteResponse { + pub can_execute: bool, +} diff --git a/contracts/whitelists/whitelist-merkletree/src/state.rs b/contracts/whitelists/whitelist-merkletree/src/state.rs new file mode 100644 index 000000000..4de3d46ce --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/state.rs @@ -0,0 +1,33 @@ +use cosmwasm_schema::cw_serde; +use cosmwasm_std::{Addr, Coin, Timestamp}; +use cw_storage_plus::Item; + +#[cw_serde] +pub struct Config { + pub start_time: Timestamp, + pub end_time: Timestamp, + pub mint_price: Coin, + pub per_address_limit: u32, +} + +#[cw_serde] +pub struct AdminList { + pub admins: Vec, + pub mutable: bool, +} + +impl AdminList { + pub fn is_admin(&self, addr: impl AsRef) -> bool { + let addr = addr.as_ref(); + self.admins.iter().any(|a| a.as_ref() == addr) + } + + pub fn can_modify(&self, addr: &str) -> bool { + self.mutable && self.is_admin(addr) + } +} + +pub const ADMIN_LIST: Item = Item::new("admin_list"); +pub const CONFIG: Item = Item::new("config"); +pub const MERKLE_ROOT: Item = Item::new("merkle_root"); +pub const MERKLE_TREE_URI: Item = Item::new("merkle_tree_uri"); diff --git a/contracts/whitelists/whitelist-merkletree/src/tests.rs b/contracts/whitelists/whitelist-merkletree/src/tests.rs new file mode 100644 index 000000000..87d3d2733 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/tests.rs @@ -0,0 +1,3 @@ +pub mod unit_tests; +pub mod test_helpers; +pub mod hasher; \ No newline at end of file diff --git a/contracts/whitelists/whitelist-merkletree/src/tests/data/whitelist_medium.txt b/contracts/whitelists/whitelist-merkletree/src/tests/data/whitelist_medium.txt new file mode 100644 index 000000000..866e74599 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/tests/data/whitelist_medium.txt @@ -0,0 +1,704 @@ +stars1qqewfpukwupgfgqqrgg2z4nhzyd8k32ax875ed +stars1qz96xzx2ayzrafkx59rcnufavtnenhvz8x9e9e +stars1qzhtxvreedh2r4ln3gmwygr274lp5l2qku0fx3 +stars1qrh36gnrgttj42xxqpmrehnm6jx2lgj5nk0nj8 +stars1q9xw0yes8w8hxvccvf954cfx9e0qcyj9c2qsdp +stars1qxz96ed5k7v2c2vfmckncyrk7hk5wtyddlwj6x +stars1qg4xepdngw6hg79m7fstyuenv4kfyf8mc6qsyw +stars1qfhpurkhky848wxtvml30m9kpgkk7t5ndc03nj +stars1q2glzcjnxu8r3usulev7uqr0kq2md6k05ns5pf +stars1qvj6xdgtfa3w5n63733wlu4qscenvak03vdcgq +stars1qvmpf9y7g8hqu68f5mq5w9fkdkjkv5jwdjclf0 +stars1qwmuq7wlspvfextwqaqs836wq48nqm3y7wwn3a +stars1q0z44n6687lfz0h0rm8kahrwlx4x656ackvn8y +stars1q0tfewa60enuu8utyjs9w7um58njhd7fpjvryq +stars1q32juajemlzpjxk7r9kjmqf0ytrkvz2l6hnarx +stars1q42852lysecwhfj6pkqypg9guesfxguqd5vqw7 +stars1q4v2xercjnukzpncyedj6gd4jlp4cqjm08yncq +stars1qk9l68ce92pmmvrkkgs6p405892cn2c5paf795 +stars1qkfkmwgc4k86k94gly3swjwfmqkqrxjz4g0fhk +stars1qhj9pxjn0zvm5t6qtq8su7928rqe4cpnvfvxrt +stars1qhh66car28reza2hxmcnf8edm4m8ql2rkyv8w0 +stars1qe86f8rt3hlzsspf7efq3h0c3dlsyfqwll0kt8 +stars1qlv54xtz6ctpycudl0mqjpg8r9yfngs7u4m3me +stars1qlskx96lg53mww2pcc7zfgu30h995tlsqpm6nw +stars1prq3xewt4p7j56a3ttl5k56pfe732n7wjjlnph +stars1p9ddvuhyya0zzdulknglg4ve6tt0e99e0rddmv +stars1pxwf54vafuqyu84ujjevr7xgcws78sppxj6ej0 +stars1pganmyl5ty6xmnxwcyu8azg3n97x2n8lzdrfjy +stars1pfk46h84nmegpj5x3pzruz26tyzjc83lj4paxp +stars1p2ry3vp2l926ak8dzk4atvp9p58v5gga4fqn9c +stars1p2xsvf946temg0pfpsneqef9hn5rutkneg054t +stars1pvjdpz5t23hy7wfv30cj03hhs3rufkpf9fredz +stars1pvcn0jjv2mugdevlue9vj2ks7ryjgtcc9yez0r +stars1p3d5dw44talnv3wadv2cdhkdczqhu2m0xh9sjj +stars1pjd9frrdmupezfyz4c80p2yg84hmasafk44q4e +stars1pngdjrrkn8r0a78s7x0ym5vf2dw52l9a4vvp5q +stars1p59gee55s8gu5j05ejxvr56elv2pewtvrksjlg +stars1pk3lswrmlqmg094csnl2xyh5eeezq843zchcdh +stars1phjay9jyx7wty20qpts2t78eqq22dvaqxlrect +stars1phmy60jrgzhp3kwmr2j7nj4pqpq75avtz9zc6g +stars1pcgfl7m9r2ufldwzasvku05zmwsj7gvycmfud4 +stars1putnfc55293nlchxl42adn026n9n29j2nx2dmh +stars1puvsznn7wlrxkf4ulvfeekg2j8nkmmezaz7qkh +stars1pucq544pjrkjn0watz87f226znl535ze8rkkcx +stars1pagzwa4zga0xv8xy52s07fca9xn6yukc5d2nap +stars1pa6w06zwm0k9t7e4vvzkhern8d98gq8rfnldva +stars1p7k8f0erllcq8hsmxzxmt4we97gwp0aa3gte9a +stars1zzuttewnk3keg6m3xf2n3wxd2h7wkvj7e8py3a +stars1zyrza86atl572x8m4jstve2na0reshhzz6azrs +stars1z9zyhgk59af064gaemclnf396gj9uep0t40yty +stars1z9tc2ln0cak4p4v3xld567gd4rrpxmdrxh035e +stars1zfdn9jpqkr4lcwpxredrxk2425s69cqxzesstm +stars1zfh6ccddln9e4fkwse7fcquvecpnnxyknlp5z0 +stars1zfef3kzsp7u06vgnca4zkjpn9mwx6am9uv7un8 +stars1zf76gztzhm8decuevrs89g5eczjtsnawxtqztn +stars1zvd8c2wk0dup5rxctysa6p0y6ruu0c34np0s8p +stars1zv4p0pu5egxym8c35m9znyjnkxcwjpuyqw2lra +stars1zdaavhnhx8sfdqgtw9ygfxfn304d88lhwnty5c +stars1zs80vefq4c99mwuaxps9m5xl8cng2jvztklhh8 +stars1zskq7uc72mazdxe6tdnm4ezzj46t35sr2utw00 +stars1zjyufmhzchx08l0wy40njjv8gd5yx8zun8n6dc +stars1z5x07m62laz6thm8quanqgvg42gz99s833eaqw +stars1z5ug3xsf39y78tyymaqa5z7xqe45fvzddlft4a +stars1z4ks5f55uhhycekpdu4jcc9y4dl0m4hkxz94vy +stars1zh57mlhkmls5w6zj38whce5xucvrkyx8l5zt5t +stars1z6s786w0upl4nu050tvwzry7lr6xrhxjaewre3 +stars1z6mm2l43mvdfczn0glel7f3q0pc7zvmysc5c0r +stars1zm8epp3rul4lsu47szwmjcuxxa5xekgfhgwprk +stars1zmcghpyk3p3cm34w9l6deja4a7x6eyemnkjfuf +stars1za0lq2t0qpc05vjnc03clfuyy86t8jp867yadu +stars1za5fvc4q0ry8r39v2mhct7n4q5fy0adencppv9 +stars1zaertzj3cuqs0yzw4arglrukph3vyvmr47vlqk +stars1zamu56vu53qrrkwu6043a8yg85dj36ae99gxkr +stars1z7c8hgmjuy9ukg8au4xx8ep2n65x55rqu3ywur +stars1zl54ztksmefhz8unhwxus9q5mspej5nm3jdvfh +stars1rq23n7clfjage3gpah0aq4h6k5k4jxx33c3wht +stars1rpr3l7jcjhunpdxu8ffaxy4qy58r5j7jyjxstt +stars1rpnqch9d08czhmp6u4yxzf4ahqzstlzcw2w2hk +stars1rzh8skn6pfteqvsgzhnwwzl47r7qccyuvehwhw +stars1rrjrg75w7k0r3qv90qp0phemt9plajn5xmx205 +stars1rxxmw75s55lwmqr9z2daat5306mr3fa8gda2xm +stars1rxakrn8x4gwc6wcrpttpz8htjfu43nswn7363l +stars1r8vkcne6rfyey42gqnlxc65kpnga2nqn2s36pr +stars1rfk0tqnc9shwsavrhyw3kdzecstes67vtz4axv +stars1r0mjrsjfprau9rwwxe04hkzfud696n3x5xxgfa +stars1rszvy2pshldm0xgtrtf7xx4jtwvww6yj4cxe7f +stars1rjf699kz55upwy8ggkgnl8r9rv3epavz6jyxz2 +stars1rnzexskwn69tqenqrvvxzlvkmhdfzlvsh26ers +stars1r4xvfn5vm643yqpv76laf2jkrmfwkvxkdaheyp +stars1rk57hh3nsnqre55h44q2zn76f57q39gewxvn0q +stars1rk6lejeurkdjn6cvfx42gpwuhzuf3t20lhddkp +stars1rc28j9jwa8m2v9r8hlgf0zcetzrp3e7ghxqe6v +stars1reugv9xqk4c3wxtw68gtad9pytd2tw0vs44unr +stars1r7d6mkjpwracqdv90rm2kdgewmrr8xwu3j89g8 +stars1rll0jfn2u6waz2vujq4a5rc2rtdct6l8ny03cx +stars1yqtkuh504934wlmpfjhm0ydrd4hu76dqzg84ml +stars1ypq22n8y8aw7jtxux9kx860mnpp8phkv7uj3qq +stars1yphyvxcxcstvcczcqfaj3m9hygs8ccafjr02zk +stars1yzreqd6uzhf5ldp8x9xhgmdhc6r960deta8anu +stars1yz4wmwawc50755s5k44v24cqp607yawmxa7t69 +stars1yrnu76uf7ucjla544jxle9zu553375qnv8fxsl +stars1y97ldlkpvwncxfxd3etmzgwdsl5h8wem237t0r +stars1y9levuleag2t56ucnkz9w5u9hqc8xh04fgpsq3 +stars1yxpl8dgfm2w77wkr9dl70zfa2vyrrrkw6n72xs +stars1yxg3va3h27sfhxv0fxccuxp2fhk5wlqs6wwpgx +stars1y8hxkacd3hkmvu6c3rjrmxzd0l66l0kzsh6y78 +stars1ygvm6wdxv4zgpkhurqaddlvtwherryvm5p3lte +stars1ytcx9kertr27rwmmk7r0upf53kmvsxz7dczvax +stars1y0xvnf9yars5l3lkvpknsqu4a0ympvknw3n62k +stars1yspe6jxj0u7yu853catmcpet804cdfvc6t5z5u +stars1ys3mucsv0nyjr5xkzfnalgx7a8t2vxfssks4sa +stars1yj5rfhr773l59424uyshzwz25dpptfvlqda43d +stars1ykeesr75yf4yga60chpt54a4ynz8rn2fctzflc +stars1yck62x74x8ywjraa7nxq2cf628pnelwmphen8w +stars1y65cpc37ruk3q4pdn7l5shh84n92ftzf2nrg4t +stars1ym0dmpfg6pmgqqf69uq958gaxkpe3ch96dkncw +stars1yuv8fh9hc8808uz6vcq28jcxkk9m7p33fh32pj +stars1ylm75gruqyhfg5dkeh4k53xsfqlumzr2zdrhg3 +stars19qhxqhm5n3fpuu8ujvtt8ymwwvljqg506qmcjy +stars19zstdjvkjw0up0la86scsldxkd4ce50j8ka5tu +stars19rv6wh22f55kng4x2u0sl0rgqws5xew96q8qa7 +stars19y8n0f8t6azwftwvdmu9scztunyhdy07pp7gh9 +stars19yssr677uxtauv8hpfg4t4ystqx4dj9xsqvpfl +stars19gwsl2vft99s6xaxkrrkfgva75eqz5kxdycxlv +stars19fl6v5mgc4gsmdqnzd5weq0arckj4fr0c5u52k +stars19d7d7thrvd6fp9ahjgn4jckwynyydfndtw6cd8 +stars190xqc8jgfkwprkjgen4gpnn7mrr49k2wr2h5g3 +stars190hgapvq5xc2lvsqvr2uzj5gpgmvqtc2ke5mdc +stars19s4eslttt3xkhtn2f23pzjjkqtxmhh5cczm4d7 +stars193tk9u56gu6qyeurhwxugxgwxh3vtcnelh4f9x +stars19nram22wnct4wmqqu57st99lqjzrjsazf4mmnt +stars19njrezvwwrupcmj4g7vxkpfght80l4vf6x9a9w +stars19n5f66m9utezge4khzct2m5kvvd8wj4la24k3w +stars195khh6nr3zsvaxkm53wavkxv46uucdlah2ctfc +stars195lptujc2mqzj5ajtfg2l0x94rcuw655dus4x4 +stars195lfnvs7jeevj6prn5a9ghr563s6tmzlf8uu44 +stars194gc3xp9z9ugxy466uy4fklnljzkzlkctlysge +stars19kdja0sv2v98jus6exdwxv0xt9tv7yhkwxtrk4 +stars19h3q0myc6gpzwessar024vu3tjgpk9ypx6nsv6 +stars19eyk2jyltyc6amdmymed75rt2u3ch265azjj0f +stars19mn3w3zy3q4fgq8fdtdqukfetdrjl52x8dnp63 +stars19uw4j3fyrxj8kputaxvp453633fd6vkhjsv83n +stars19aazmkggrjrqpcrgt8g9fg86f8saunckvm4gd7 +stars197uuwcn0tmcht5tsnv7wh686gknaf8ctrrve2f +stars1977ywqhrn7vffsdax5jlsuk0qstgx5qcu2f5wa +stars1xpd4fsucqs5un6r9fves3c3xg63kgt727jj36w +stars1xpus6rcs04kuck5dpkazayvpqt9qh9swd03ppw +stars1xrnw07pf98czaqcwtp0kg53ddc8khv9gxc6yzr +stars1xrnn65pmk9ersuspvlwn6r2pzphre62c4rceq4 +stars1x9ndq0vvktjjwz5jnaqml00nskk9cetu3329ys +stars1xxzskqu67e3u6xv6zrzhz65jjgums8k3vqvl0r +stars1xxdwlfejjv2ehrcc9f0v6ps2425fsk4q4n644s +stars1xg2amu35nm7egs599xpjsd99g98l5qvs5srhp9 +stars1xfdwgvjm5z4khfa3j6jf7q80l7tt82lmth78ps +stars1x2rutlpugtxllqkn7ehxcu77r8qeydp2gm57tz +stars1xt8yng6mke3l8880m85awf66dquzx25t7fzjgk +stars1xt352n044y3tmxyugun6fv9uahxa23sedpe9ad +stars1xdka5dczhqclc927egfcurc7thvasyus5rq5m2 +stars1xwqsywzaz03zdjq2smysj3hp64fvq26lmmxh0j +stars1xwseskrmnxrvesmad0xtyfvl3lx7xzkklayua3 +stars1x0wkrsrejq7lqs3swdetrkcfep6302u79946vz +stars1xjzkaclgkglwhr8lc5yp3falz7ylh6806hpthw +stars1xjvhpmflhue38mc8j75gqj2h0fds9guxu7h2l3 +stars1xnr7avm20wen3wzjd54rm8rgcx6pkmpmnqjqw7 +stars1xkn622n8u82uxymvjnaul478ywqd96ah66sdd3 +stars1xmckehfvjpwfqm7ngamq6vlj7tum66u9mtvxhr +stars1xuvw6gwyq8l5c7ndrvksjl44xgf9z54kzp0pj8 +stars1xuwl7x8htyl26t7pe3l0x6auj3j9jwd2k26qx5 +stars1xaswt2fwdmscxs9g8k8w5p9v4gjddenh3xkj0t +stars1x7rh09jpdqre77j9pv2ugnqtkm6mga8qlf5kr8 +stars1x7m25qfl2s5pec2dwgqa30nct2u7egnp2h7ut5 +stars188zumy54u8fpwqlk3yd8ektv95jgy99ej6qcnu +stars188y3w6re6ql8xaywl8f0qqepne6hn6edw2qr0d +stars18g2nswmcsyu46qva3y648q6d9m3wwzg7nztv8r +stars182l3d0qu6arwn5auaay85e4gursrlvfj00wqwk +stars18v5q7gqat8ukh040exz8xjmgs8p2ml33ad4gxs +stars18dhtsvjsasz9qfjh7qfnv40zsge5eecumjzau5 +stars18wy4l690my83js0xxjhxjax43e9ct2n6jmqwyp +stars18w9lweuey6c3j475c0luvdcs60y6h8uwf5v9l5 +stars18wm3f6s7yw0f0la09rnczvu9xp8wkkxfx8u05m +stars184cga40kaj6rjv54m5uv3543g3937xuq6nqp0d +stars18c9qdxjfs9erh0w36cpjj2zee7gv5svjtlalpg +stars186jqkv0uffhgc9uu57e2hj2t5fd3pyug23jn3e +stars187rmtucd55v0eqt4qvtvjh6n7rg3wrtl9ws72p +stars1gq0gccj0n95cr9l63499tejcnh2ja6nx3zaxaf +stars1gqn56ztqjjff5v4h4335n7djnd7knqvplhsc98 +stars1gzxfe9ew48txv73lp7g099lk324gqk7zk2t83x +stars1g9epj4scc6h5lgca54xzs7vttqa9xvrlqwt28u +stars1gxr53f9jx5cxn3dmkzr2eq93g05yey30rumryu +stars1g8n34e7h6llfwweuppwr8jw23zx2lkdqakahxx +stars1gf8pk48fkzhj07quvywymqgvzzp6r6c64glm0s +stars1g2x34n25uyxepyk40gsyz0x4ujhqutuchdxa0f +stars1g2mjkrugdjr0h75cwg9ml5r8ynltd4z9pm7dmu +stars1gdc9tp2q3452d06akpyye5mfzgut78eh7aance +stars1g0xluyamawjq5g097qtzm840dcf3unhncw2fgc +stars1g02w5dn5lwqd33eeynprzuswvvqzql8wahdy5l +stars1g0mn967fcq3gclrd6ffjfp2le5l89x58ts66l4 +stars1gk2ckpv9e5xz0mxesw24h05dlq2gah432emswj +stars1gcr8dfp0qurxuddvvy98jw9gn5ku70057erwj9 +stars1galg9em5pnycrnk3syykzxptj0j88utnhz4r4h +stars1fp7lar7valvpajdxealzhaf5julcpvrl348p20 +stars1fxexqgzsk9sjw9t4uee4vppcanr72lh2s8dwgs +stars1fgtezhnxtfsu9g3j3d973p76k8ldxgzmv3s0nv +stars1ff97wc3htemhctfelnkughw6mahy0zra0uw9cj +stars1ftg95ck5ltm639s3x5w9n4kqjgc68d0zzwcw5e +stars1ftj472qd65v8vk5apcr8q6khrzsxy9ftzq2vwe +stars1fdlyv09lnda487agymzeqa6sln64vua7jvl7yt +stars1fsqpmwjk7xp238hshzhvp9qv0dtzru8kavug7g +stars1fjn0vr4dma5crx2rctv6vmfwxx0v0vrdxh3qqh +stars1fnu8j0flhzkvww9ydk77u7fqaa4fltsasrffvf +stars1f5p0fzfze496m2epgjjlut0f04ah2l763crpj5 +stars1f5dlp3ncgcaxn6h20fy4lfqppdc5p5qtrs5z9u +stars1f497lfypmszxd4dnfqc46ude5v3sercrh6049a +stars1f4tfssdyvjuutm4s8w770nhek2f6f7yvt4e78p +stars1f4t5kq57y4destmf70wjfluyqvskvr7d4dkk2c +stars1f4jmpk8qqehxxqg6pze5ytgg4xj68yeyvtdhs2 +stars1fkuqhrc6pwulf3zlu6w5vcjxs5h9tdkrmzz3mh +stars1fh8gf0mt5cs5ukm0fu2r87678694878s6rs2mt +stars1fcjfkaxndx26zua4k6vfca8vnrayt23c0z53qd +stars1f63dtak4cwu5cc3ejx9hmdrx3ss76lgsw7cxvs +stars1f63uwclezkcu7kk6d9s3rtm5254ce2ja6fque7 +stars1f6n89laa7wk224plk48m37y9k3dfn6mv8tfwyh +stars1fapqgamx3c8za8d3z56sydjtjygyu0lyfmfuj7 +stars1f78esqevslsswvl0qk9wzw3tplfygk4e9xqtaa +stars12pk8c2qprdnhm9859vyzryu6qmu2u47psjker0 +stars12pmucez9s8kvmdrpyrz64jc2naggfqc6w68h7q +stars12zdwmrad557jm2dqa9u0yvuxceg0htrcg9xzm5 +stars12zkdh0r2ms03lt40ungcw2v6cga9ntkx8c4yqp +stars12rsvskjh7776yyu5yx0k4sfe5a4pvdsfype6n0 +stars12yf2juf23xe6x4x7cyxu450n52r8yget7d9yak +stars128kzv82fdxx9ywl987e5dwswc02dycrk8njl70 +stars128c9zkcmj9886n722qrtdugmgqhsgpnydnjllg +stars12gjl4rnacuny08vetsk9uteh72qzew483grkt8 +stars122r95x6k0z58y9w6u0pu05jcgka65swz7jg3kv +stars1228jgzwf2mszr3kgq8csu3jkgczvpj2383qzrm +stars122st3vfnqdtfqf6jjzkfcr4grvfsezzgl5zuux +stars12df3jujs7rmrgr4m3ay8dqk55klhl0r252et2s +stars12duth72wczxgzp8kdhsu6ulzu2msshe5fcfnnm +stars12wyh5wdaq7ej0tz5v8nkkgauz8cvlcdfmq0v89 +stars12wdcv2lm6uhyh5f6ytjvh2nlkukrmkdkq20qpp +stars120uyhkaaut99mlckjqs7075600zx56ne3nm7p0 +stars12schuyydm0amrg4460t3dyv57tu9yaga2537vf +stars1245na44eyez5lnvgvwty9c50jpcxpk2sh0ucfk +stars12hrhl7jv3jsdpknm2402c9cr0ksfzpexr6c2h9 +stars12c0yrkvnq7ujtsxtkvtpq3m9azeqzczxya39qa +stars12eqnft0nryx0qp75nhmdawcsv9mdhcejqkqyga +stars12ew4jq3thxauq52yug4c7larpkhgxvk7xsk7xx +stars12usavqwfpsklq6uk7euh0p42fjv2u6m73eqkj8 +stars12akrw6j2ps7szcmw8r75px6qwh6lmt96jxkxus +stars127gu4lwl652p5vurus9kfdzysrwn2wzpnpguuc +stars127hgjjrst9mngejd4l4wprnnppwl6e22wmxuq3 +stars12lntsyltsg9ehjmvawghevcgza6gqr6dwdgd26 +stars1tr38qe2vzejvm64fmpw3runlgj2g8hfxknp0su +stars1trke0jkyzaxjsep2qyya0d4k0jeeem8ysghnnk +stars1tyj3ls8w296a2pjn3ysyrjf9v0q0gfjyzlwns4 +stars1tyud3zvavzauk4rwn59nxu993amcx867vg022y +stars1t83h6eg69qz67fchtt9w9tkpcju27w6p502m2e +stars1tg35xn6jf3h65q40eaymqy45gwtu0rnfygyj9e +stars1tt83xdje9gx99cp8757wjrxzc29nycnq4xnz4a +stars1tvyqehd53swhmaspkmlkhk45w5e4jv48rrdx5v +stars1tvgqvwsf2raywnpxrftul06qsrxwkwwzegud6n +stars1tvcd8welups8wwgj9jxqpt9027eyzatlpa7ctv +stars1tde70wk9hdhfsual2mzfuuserqpwt8lgved758 +stars1t05987dvn0hyn5rfa23hav2nxty6eluhf5r2cj +stars1t3ka3qv9dezr6h8q0nwssgkv605tkg93xhpw5f +stars1tj3jhe269ltdu3mnmuyd37r3yakct9s5gz69p0 +stars1t52793w5rr8z4c7yxwjrqeahrp8cckl29ea68e +stars1tk4hkrse0f8hrmc8avwl6l4kjk973lnwhwxwa2 +stars1thvncfatxukryyceuqxh5fzvxa57sj7q6530t3 +stars1ted047fe3lsqt22uraq5tqvgupkq8uesx8nfn4 +stars1te7z4kxhuf07xvevtcj58z5ddzlxe5wgf00p7g +stars1tuquykffyj70pxnrpp0j7xxwkgdzs7pcm8zu3k +stars1t762uenjgjcz2ys8f3kz3ewjyzf5lfg3qwsntw +stars1vrpuvunffxy2wu8tf26pqwet4e72jc7yg2nty0 +stars1vrml8rkxcstrneqv208wmd9f3yd5uwkwyq3s47 +stars1v9cffh5gws8ut3zr3pk2vjvfq0s4rc9wg784se +stars1v9aagve9r7y0pndxhl45e7u9klrkhz9ve8rmq8 +stars1v8yc8tp0rpp7ghyvna2x5z3pxhuuts70kzpgum +stars1v85m4sxnndwmswtd8jrz3cd2m8u8eegqdxyluz +stars1v84gfxlus9wl3rwel2690rwz078pf24f8n77w7 +stars1v8ezz6fslyd0rcxm9kh4q8zlwehh6q688x4xgq +stars1vgmgn2vlh08zjcehlkawkm68msuawu0kkjgmmr +stars1vv657n2smg5hpw5zd3w9m3p6mkh0ca7kvm8m25 +stars1vdyyajm0tf4jcte06fthhmzz9prq8dxjnym89e +stars1vwzw05aex93dxge6h4556k97xq60phhgrqtwyh +stars1v3y2evk9vrkxdfnn2gxx96r8zjejyr5zhqx5vw +stars1vj8x9l7x8jynnz8cxa99jqsunq8exc2vqpg68f +stars1vjmlnl7zw54tuuacde6udmlptp4nqvflcvxcx0 +stars1v5ft27rre0m3th7etfvm5c8vhw462vh672yd66 +stars1v5k4st3duzftjsrd4m82gwvz8aygcgz8hp0dfu +stars1vkc4cce249te8j96r89lp32jerf4ymrc637x2k +stars1vc0fj5e86nymn8shejs3a2q89mv2yxxay0j3gp +stars1vesgn48a8l7enm892pc4hqngtrl7ygx79f49dl +stars1ve508d2000xrlrnyargztv28gn774daysuawcz +stars1v6umul8nun2xaml2y24zrhwc3gx2lv38azxkgy +stars1vmh3mdsgvk5anml7y9y6ctaunpr7g5lhwrldjc +stars1vae73acff4a4pe4nlz98umv68kw49pajn6zw7n +stars1v7xyjj2we4udmyyy68hhlv5gtamcut7cj0echc +stars1v7w4fs3eq63vfn5xqqh04pzuesj44u9eye5679 +stars1dq4adhy0gt70k5flzx0mvumtk7ljcj28qdpe64 +stars1dy6c2gvg0802ujsnkhcg3f0vuvqwypu3kay4gj +stars1d97ff6fxtexmxlucfyhyh5k9x7ptsp2uptkgs6 +stars1dxy5vd2xe3s48hlwrpy9xeepqzn3jg9h3f39ry +stars1d8v9te0792xwl958zhel30mkydcpmxfvknfp3u +stars1dtwefts0wm5warj9vnjnpqu0hyvuszu5tyrz85 +stars1d3nuvyvggrc20nnr5qhf829hs7jvasra77jqgn +stars1d3c3yegck3h8m3z9ahwurg6j9hwdpy5mk74p6g +stars1dj3e8xd7dfwwrym6najvlsqvma3k3rsfdpdsza +stars1dnwnhal022ak9r3uml3xzjwrzpx0yvhuyec2sf +stars1dnnl0pj4pruwlkkp6gsguhfh88e492jg4pkcxr +stars1d5laq9crcp8welprqf8vq6n5dzv3jqm6hle4nk +stars1dkv08zcepkwvzfhmf2aq0jy2dtqtu0hhe6wwta +stars1dcqe730m5tp0ncv9jrshy0c0h9m5gu27wdqn3n +stars1dezasph998ckm8w9gwtw3xxf6zrxcx63s5m7kr +stars1d62xf3vh777qn8w4xyt9m5z6qwx64rtjefdct6 +stars1dueju5vzuxazdj7ndrs83y72zj05cfjna97797 +stars1wqga4v4nc77zah2n6nc9y0cdsu9hqcv4tjdq64 +stars1wpdrvn7dew5etz9wrk0aqa0pkkul4uq86t82er +stars1wzgva7krp9dcz5wu43epx4te6c9f3mfcr77qjp +stars1w9fe863z9kaqmessfujrpusn794np65eg7gcw7 +stars1w83rmdhrqudkj5qgs0c8lea6ypacp553xgknr6 +stars1wgahmf863takdln7z7shfsw4xwn8tkp0xzdrgv +stars1wwkq6rfs4gfz348hva0yjtr3pwkddmv3c0s40d +stars1wwlrr0w7q73r28w4p27pmzmpraqq384zvww2y3 +stars1w00gh0uxxyny2rcyvur4q07fjq4cmva55vvwen +stars1w074c6wcv794jtj9vn38gr7tu6zhqv48xqe3tp +stars1wnna9nepslju3zrjfvtk5h3e635nft60hkle2w +stars1w4pe2acjnd67u28m9qhu96zgd88cpf7p842pa2 +stars1wh0evrrxrdlph6nl98v9z43555fufy2q677d69 +stars1whht6423accjaswyfxsayhwfqem4e9ppvr7zhh +stars1wcvds63dwqunv398mzqrtlkqz0nq9u9czt77mj +stars1w7dndq5ru7v5yuulavfxw5av9dp5e6gwj3c95d +stars10q0vwkwcftr24yde5lpukfry87qkn8gfkq96sl +stars10yvwsxsxj336rzpg4k9284eqc5al0n0lt4628z +stars1099guh7p6v0ln4sqfcmlcfyrsk70lhm3s6e0dh +stars10xzjakjllexm22qjdn7n5u7ldrr0p7fjkhky5r +stars10gl23phktyakg0jf44e6ufyve6a5ccvt5rzqap +stars10fymphfag7qujputnpkpuam0ennc6lamrvtgum +stars10tdwk0xe8xsp900dq5rngt75ygd06pkqpk7ltx +stars10dukz78udnjn9768z2x8nqzyl75enh999073fw +stars1030ay9mx3yku946tkd46gekw3rnr3n0ukzqy8q +stars10jcd94dw9w2txv3f8xgd3cslz5s3cqu07ttjju +stars10n3xr9hm4fc3e2hxexudhe4ertfyg8wxftlnmz +stars10497yvmd23sv6n39mzqjpkf8cwhgvqytcp3xmf +stars10447kdx9rq75qtwccukfg9sdt70yry9avtyl58 +stars10hfp70p9nucq7grtmasskyut7qt9ezp0xjs6jf +stars10euawmvvt7fw4hdwh0nrk2rgez07zraxuvc0ad +stars10mp4ludc2kh9jgue4tudhytlc6dckgh0cr4kkd +stars10m0586rkuupm4u0w07etzy7hs3s2eh4rf355sd +stars10m0k4a3tudk6mglc9nez5w9yjvgkk9kumktp7x +stars10uz7dmylmdu67htrru65vq2lut8y9y30ljgxyf +stars107x66k8lzvplpf70qshrrzt8fely84chkn6637 +stars10lnxkvncgdxqv8z8aee9pvyf9h8ddcmlzfzg0g +stars10l56qdud5g6qt3pzywy65urm9cle0mx7aur6zd +stars1sqvy2tquz0tqpe3pufyttxswdmxnaqt9ctvsjr +stars1srpn8dtutdyztx28eg5arqw2u657u6rdp95ktl +stars1sr7p3esz5xjsezzwrk6ec5hz2675jr692mzjul +stars1syslr22psalk8qz2m7wh5pz3d6rsz58wsq6kjl +stars1s9kcl7yhmpgdmk3hszu9v0gpw05khcl9r5qafw +stars1sxn7hlcf077y9e0wzja5j29uykywnpnsdrh3yg +stars1s8gv6d23q3p68caf5szyaw5jx2gwaats70f6qc +stars1sgc2wz3khfz2uexmyzx7848ycftphkh78gudad +stars1svfpddvanq0p4ejp0v9myxt5zrfy6mdyxjd29n +stars1sv0d87tm8a70zln2hr6gg4gap6lklmc2re2c8d +stars1swq5s5c8rd3jsz4vxkh9q60d5ejl3ga5ewhftd +stars1swte6fcwcdxyd6hf78ugdj5dv4t7m7e039hel6 +stars1sjf0dc6q5vkrvkhxu65md3xgsex4uqqqzlcre2 +stars1snamxl3mua7kzhfr6e2ycm45t2u4phfecd5cvc +stars1s5f5d6afa7sq9hmx70l9xyxx0m8smgadvd8e7n +stars1sc6jpnyclle0fgqtkx8kwx34kk4nc5ppp2qtjw +stars1sezunc9x6zwqldypxnn26r9mkqvvlr95fx9zsg +stars1su3rkjjkkw5cskw4dmufp2wegk2e203nz8zj0c +stars1sah6yh3jmx8z24jgnytsurqryfrx5sqwuvqd9r +stars1salv3vd0hzm9nh9rhdf2xs6fqvzfrwqz3s69ds +stars13q5caupp27n59fy4q2mar7vp0uqv5jqj56zcrw +stars13p9clkfl0ydfx5k74h2ssr5cznupda79def7pj +stars13fuavrk9q6qaa7a7n4c4nx69yl5qvmvwjw2ty0 +stars13tyh79xevc92layavjgrkag53r8d6h52c34t6d +stars13vtg6907g7gta86unrpc3v2s378rt4pg73jhyh +stars13wdemgle5q3ra3l75lmauhfw72ypjxpqsmgc4n +stars130grss6q59fgcwtalt799tjl68cgqtywa9elqz +stars13stj4dcva0efyew5a9dk2ehp0zqwyv2j0l70uw +stars13svz59q5z7a9vhhj7vkrta52gwxr33hsrdz59g +stars13sl3xa3qk3te7aezh834ueyeeym22ym03kc7lf +stars13j2qpl6szakqln95n7p9ar4q4nruhm83e4jxpy +stars13jawsn574rf3f0u5rhu7e8n6sayx5gkwxsh7aj +stars13nyn5v2mxv8cs6nj0khrxy9wkmw7ry0cuzrvg3 +stars13n3jrz204eva5v0xywxc7lmhnepaz5qx7jq3jw +stars13ne2ssyt4pzpq0qvmddzsxtnh5duu6vjmcxyp6 +stars135hy4g4lqjn4vxeyecy2mqfmu67j9g4sjqqmjl +stars1356tmm42arysptuz82wh9lzclgryx36zqltdcc +stars13kw2c4w98m20xf387vla6tmg2wr35s0833unw4 +stars13hd5qqh4ghxppf890xec0mynxtxye2d3x6pqzd +stars13h5rflg27nn99emf7ecapjf6wr67mgqc20zlqu +stars13cz88wf9cv0vscd3rkmunjl8vjp9amgrfaxx5p +stars13eygl5q6rgt7uhmnef4ddmsjund9v5hpkrwtd2 +stars136lj2p367uyuvpemk6hd8g2tagjmsx9fnsmm86 +stars13mzcw7ezlgzcgpls7xqxpsg5qqsxvp8je5fehz +stars13m6tpcafcayyumyyjn58ul25kpvy40uukzl80p +stars13uscwym07zp2vtcuv62hwvuffxe6nxu58fr5cf +stars13ul82cuykzfly3fps55cdsu56eejr86ndudx4s +stars137p2qrs3qw00c28679pwu4a76md48q8zv75rv9 +stars137vtzhmfslf907w6suuhxxq2at4gmc7vf6ttza +stars137nu6fcxs2c9acfdc4fws3q99kgqc8quvk859m +stars1jzt962czzt3ruwsapec9fzmrm7kcj442vjk36c +stars1jzlxywucspacqdxa76sfurwd29vwzcz23f5v8x +stars1jrmzl2gf05estqtvx6zud40psqet5s8vt8k8dd +stars1jyvxm6h9r8wjml83wfrhh2ycvek589440s7qne +stars1jy7hg7q4mw5kpj5r6xa5akvf7hvtdjuaf8ufr7 +stars1j24l07l9kjnzucgj20wjwxpq6xdumywvmy0qdk +stars1jvm8gy4lgzcrsagxpyhvvxymz982y3j58xg6sr +stars1jdagrdr7lh4j4wqzwzfnheflce2cwwf7943g3x +stars1js8u4v096r9gzhs2meqfxplr8e7dvm5j6wn4q0 +stars1jjqp2kmeqjur48xfnzq52hupn7p6pky4h8mvym +stars1j5z473jelsax74ht74vxfng2jhc0hvrk2vwemn +stars1j52fnrad494smwjp3l7tg4ng96s2kmzd32lpj5 +stars1j50n2mykqfp2flgs6ka4lkp5w4svgmmwvs0u26 +stars1j5e3pfzhg7wcvwas0h4dmfp7q0475evqsakhgv +stars1j4f5azfwc5zzfzr007ue9afu4v0w0akqyevunh +stars1j4dvmypy70uv5gzef2tvj244qlp7p6902h8ydp +stars1jcf8ls24zm20ems0uhmhk0t4f395l9k2kqld7n +stars1jctz6ppudzcvcxmm0wgtndqqugshnmgea0l4hk +stars1jcmp3w363js2f5zczadjzs09lxgpzexnsrtzwt +stars1j6yw6aldlctpaz2na3awsnexle3a8k6z8x9744 +stars1j60wazpcge7yrw5ndd0977vk8kaf0epv9me2cu +stars1ju86mskhp8v9pzg5dh9m7pvpykulr7p7yw2nwz +stars1nzd3nftmyys699gup63nfgjrvthse8c44f4yfe +stars1n8j9xve22sh5arf2kfdtdde46udztadaru8n9f +stars1ngf5jtdaf0m9utz73rpucv88t0yrztfhzc2kwp +stars1nt94upxpc0mvw909te6f4e8w6dqx890smf5yr4 +stars1nwdy6krc9ulf85qdsd6dv5qfhwsu0xkxaw4xwd +stars1n0gj6dqtzldfxq6hpzf33jh5r76lxevydqafeh +stars1ns602u5jqy20jd6sye06xcefyeyg0zzsl2evrf +stars1njszcy8atd0zrv95lka4sr7pknkzxwml36w6kq +stars1njkr20y4d839rp5qfy75dhzf3zddvufwekcu5y +stars1nnhlu7j6r4e2efuaydyvdmqs5plp963e0hmet9 +stars1n5yr7uxk9eza6m29ew7zvrc0zkd5nvweenjcay +stars1n4a7szqm4gu0xegntwy245fjq8tlfh4vppj0e6 +stars1nhu5zp6l686u39aatk9apejk4ydjqclhvapxxn +stars1ncvkjycm5sx30m96aceez4qtjnzel7snvap2sd +stars1nc0sc7dly6c3pqaqua7alkznftad50k0nfxvs5 +stars1ncus6prmh83yf5vwtxaf9qnaksckfk7nv66g7m +stars1neqprx4sd0xrs4snn2q9ccchg6ksva3p0vxcfl +stars1n6rela9ta8c03p3ffgvh6tjaue2uj0c9vyngmv +stars1n6ndqn6fcf5l5qxxfnllu06c3xd92ddfdw5gn5 +stars1nmphggkmjqsdd8h6d7tc8tl6mun9ncrw293hv3 +stars1nugpdejcxhq0ec890xm7nmyg4dn040drj2lmsr +stars1na2e5l0j426nwzh65wgtnqgpfrl6ukm44p3m94 +stars1na625hwgqmxguenksj9l2qet8w5cqqjxze48fk +stars15zm9aj0y805pl0wrgvzjdhxmja09wqhv2d5p3y +stars15ygu8zytjyc5ysymzkxq0vz7jwkuczccnxzqwp +stars1592r5r7dahmzttp290mhfzmhupehz3pl42l4q7 +stars158gffeys5xh8ytf3f7x57yuaajzhm6fa69n08r +stars15gqcm3cfxeln6wl7qtquzkzptwaqjm49us0dfu +stars15gp36gk6jvfupy8rc4segppa38lhm3helm5f8k +stars15f80jvvh8yqldcfvt99jfhq8gf6ykxrj4cxvm0 +stars15fgmeqzqkq2hmqx9er0vj9efnd9fg0fcztg6xx +stars15tk5lzt82dgc637kw9hnnl4l6ynaknzh6nyy2f +stars15taaxc4vk2aphltm5cx9pqzzl3csp5760vjp2t +stars15tlzuc0gnmy7h0h4g383fmjf9u0mhzcpr5vaxs +stars15v3gafftnkk0wdjdw7w2ttlr38ee29aejqn0q2 +stars153h0uedz5yl5h8c9pfm3m0ur44pmc9ucv442r5 +stars1537dd8zyzxaxxaagwtyvm6xds79g3p7drg0ueg +stars1537lngyjntj5u2tpm7spj9g39dqvv6ctrs0xwx +stars153l8ng6puwut2kcjj74fk5wx34jaktckvedaxp +stars15nfa03mcxqgdcnml2v52k6j0mxzp7tj5kddh6n +stars15n2g3rjtepan9c0w8kurvdw92w2dts4a23h0gk +stars1550c0zq7yky2lxane8twg499jw9avlrc7ulf6w +stars154pdsykuqxwarncc28x4pk0feylu2fdhemd4ft +stars1563kd84w5zjexhq3e0q2y0p43m6ykpwyf6dgfu +stars15uelsz703hufd2w94pcrelpr5xlzaw86le3fsk +stars15aqnr23yacf5t4fyxknj47uu3ywdwhccfxc4xd +stars15a0kxrp8tq8g89hxvdzs0g0plv2y8wayayz0pq +stars15alfn8whzay3cvqljmy3ps0sph5sajucrq3k6k +stars157qsf4nkgvynzhrn5n7ktp49apyd9ejh9fmvc0 +stars157z90gd97m5cs2sky7ddenvuvnjr7xypvu8ptw +stars14qjws4e2esheesknc8etf4plgef80r5uvlv9nh +stars14qc4rmffuymfm0l6pzyzn6emw9g348acuqpvmy +stars14zlhzpf0mmd5deqm3fs5ugp4nl5vl2fvgthcqf +stars14rz7gh2yhgklcj5cutryn7d4f9dh6nauspqn5x +stars14yzqd0mn0gsttacz45japvu604t6423sz5zh26 +stars1499yrn5575ynn83df2ugjq4rn2zuhm0tk3lxp5 +stars1489eld60lhzww58nqt59zsvkfqkq4v43eezgm2 +stars14f92xtvwjdf2xuq89quck0ge4q2la9m9c7sqve +stars140su3khdfrwye4x27k5glf4dvuq5h76pc20kju +stars1430sd9ycr45sffsy25a4msy6kn72h8zrtlpz4l +stars144jpt06zkrtymgfp5d8dlsxpvthemru2dnthny +stars14khvd82d582zhns8nun04p8qje03zj364cqs9g +stars1krv9mfpdy8l7k33ec0qwjuwf7a35g52az92wyu +stars1krs9xakfe9fyrgpzn0vlu85n6z4vkvslxza85z +stars1kyq3zf8szckgkkxkksregrawn3jl6peds38tc8 +stars1kx27a6ll50scw45mq9k37h3guez9t9nx60reez +stars1kg7ez2w3a3safteahcwd28pjpmzhw64uttshxm +stars1k0lv87rmzdzkj3farmxd9qp7uv666uvrhedszc +stars1ksgn380e9rt7wqq4x3dfskmm3zzsw5h8ewyjww +stars1ksk94wqq4ez7tzl65caaf27gl990erq7vvcu2p +stars1kskv0xamjlph3sfw4ltkwlphrr5f60gum4q2q5 +stars1k3zhx2vn7s24wnf2456frnc7wcrjnw7whvehev +stars1k3u3s7wpf2y8q7ecg00u8yke4u0gepkwn7z5al +stars1kjqa4ew38sne0a4fqv7hv3ue3rtggdz3xnn3dk +stars1kj9twr72lhezl0jss39faftj55nn5y985km0ku +stars1kj4c7gas48ukkc3xe4qewlks8n96p4z803tu0j +stars1kns0aecxwcnk0jp84ezag9jaayatly6rqduhz2 +stars1kkdnj8042kf0k8ylufx03mcnl449teexevn96v +stars1kk78k7mzsu22mxu20dlyrsmrynnurtxuhgzz7c +stars1khpxk4qq08gc6fzh7rntvhskwe3v3h77yjlym8 +stars1khfrzy6fgpxu6a7lzj7xs43rsmr4r8ty6xf40u +stars1kcpu3d8uxktjv7dskvmeskdav68pjfwlacwruk +stars1k66ngltrgr9eahmf9vc6rxj2jtsc7fpzd59qqs +stars1k6mcyej5ndlv48her7ut3k8nlj8dzmflj5cjx2 +stars1kmtdk9mws9qrghxg5frsq9g0x639evspzytslv +stars1klwtq424ralj3vt7qashqwtg72w0wcprw4ktwt +stars1hp2806xfq9axppemd3m0dmngmz6u7dxu6rshex +stars1hzl2sgk8kcurctkzx95nqw0mxj2vftf96n69yw +stars1h8znd4nq75wkukw2ly4m9vsn0xgyq3nxuf50hy +stars1hf642xvnjur4ccyvpfz46t2hursa46un8lq237 +stars1htykx3lxy839905cfsskkde4mvqqq3e6l7p0aq +stars1hdsmz2kqftgk2ypa5t62aauvl0y3c2nf7tqh76 +stars1hdm6h2qvst5z4au2jrt5yfpn2ptzj33ct80ltc +stars1hwh9dy9tkdsljshzp4aekvu6dcrvhdsmavyuka +stars1hsyn58377tvqk874jhtr87pc5kdv8pz5fnj795 +stars1h3yyg9t596pj0xlnhztneaaepywuegm2zhw7l2 +stars1h3yehm87fcdjjdllvqu4kmarz7e0930wu2djtn +stars1hjnalp093l8kpwm22gmg49kx32lgc5sje4vz33 +stars1hnjjd3v53rsnutsllhtea9kgwqzt8yquy63x4l +stars1h5dh48nsqhuf0z6k5x39gnmmuq58uxzwktfas6 +stars1h43d258fh62977steammadr3fvy4aj062qt5jx +stars1h45kknth53k3fpyqcw34uclqf647qmg4keg3pd +stars1h4c9xy7eyj6gzkfzrl4f52ehl3kddcepce5vta +stars1hc0h2d6w59w6qr8zvetqqkr9z5kjhdmj88ej2e +stars1hmlx0pc5eupsac9axah7ngxn7cm5k4y96m6a9j +stars1huc94kzt6ty9p4dfjghz0a58cyg59r3rwavpy0 +stars1h7xk9sx3nycf8emxfxekvwxyg2zl9us5zktaql +stars1h77j6s545fz2drt7qmsnm8f8rg956gwf9ats75 +stars1hle9vkv2mqrlxzgksgcp7klvfsy003w3xg63tz +stars1crws25dk2zfd6m5g72pznqy7g0ate75x7afhfk +stars1cxy64rcalr20zqzphjz3t0cmauy7p2sqk52lf8 +stars1c8ypchv4dzlz090qh5h8jkmt6fmu4km8gupssg +stars1c8glepz8mc2yqjd8p973tq4pq3xpj2xa9pytfn +stars1cd7ae5dhzxjrjweakmxr3zgza02qp3eur7ay2t +stars1c3u4gpps9sw3w5np2sj6s50gds7cpm2hvwenkr +stars1c3uhgyvzurgezzs3kc0dc2k43jw32cjrdvngkk +stars1cnws7yuwsh34eznhrwcckkn3kl2unqsgx93tg6 +stars1ce2yphfv2hr0kj70dn4l4yk7r2rhhgcfxlnkms +stars1ced7rdsazrzfzf2n39q8saduf38yfkackrxqx6 +stars1cmcnu3azsp694cwc2fxhhxa6s64dz37q6hyah8 +stars1cmu7qqjaepsngntczcdkkgcwc52zere2qqnhke +stars1cuy0z9mwc4n9av7r5x8vc4suqml0870frh47sm +stars1eq5gnv5ktegty6s66m4jqfekesws2uc6w2wnw9 +stars1ephy557hpj00re3e6rn7ajdg3v4u2clq9622kh +stars1ez9tnyhh08myyzshackc5aemwq4fv7gzdqukq9 +stars1ezsfl2pla4cd6caqdrexvwcf36hpqppjxstu7j +stars1err5c2tc8ha6qa42tpvedgk585dpj35576ny29 +stars1eygua0rm6qdxf3kd6yg49mevcs7lgyryjn3m6k +stars1eyskfudz98a3nazsry37jcp75fd6xzkwjlur8t +stars1e99q6yugu8wy7yvm5wy7qgw639kv8ltvtvtc8f +stars1exlp2pnz8cg9t39mx6qzwhr95ru0am998gwyeg +stars1e80zgzxs0cfx5nv2xy0kf3ntlju8lf8wk74kcx +stars1eteq7m2xc7l5qaxu3knprxq2hl43r3ejykp9zh +stars1e06yejry53qj0s6zps5gat79a3q8vs0t9qjlul +stars1ej3tct7uczdpgeeg3lmy44cm7fty5mpfp6rzef +stars1enwqzmtea8c5309xagwv9qqh5j2xf3rjlmev8k +stars1echtjakrrmy7zrjzk727vu5mgevswmr5xjw538 +stars1e68ds5qu20wxjceeaefn3wxxd698kt97288mcg +stars1e65skz5cxtcxseyd3yp9mv7hcemvntdf7h4lnc +stars1eu7p73nq268dsy974830dtak38fqkdus9rkewm +stars1e7ra39kd43wsr9j7stt3jkyexp53z5tzq3cmup +stars16per8t6tqsz6hqd23ff0vpu989e0xmhy2f82hf +stars16z8jrwy5h5fu8g7uc69tywcyp5fgnap5g38ae7 +stars16y87d680ajmjy6t4dnp60ckp5y68ywn0qap7zq +stars16yk2ljku83sys4wqqu5ayt5pjk23d7anj89e3m +stars168qsl9q8ltxhj48lrpwxh3q4wyue2nk8ykc4yq +stars16gv8q27zjwdnll9m99z7sa78hgre888vr49suz +stars16ffhf4evaep33qm8g5ykn2eutyfzdjax0q24l7 +stars16tq0vcl5t9gep0sak7evex32xdqheaxkkde6n2 +stars16t720v9vjht00sgm7u04lmp45lq8y003zqrmve +stars16vznprretrretuy84zv36ukywe6ar9rk2anna9 +stars16vhef5p977ur7qtweewzzd0sytn7ucqrmpj6vs +stars16dgmlh68xdmaf07wlkv85jnfc9zc0xmpeleuas +stars16jpgl2fay40h2gcs6vs6prj3qhwfvc2lx08v6w +stars16n50v45cj07n0w7wsyrsfecq0wds6kcnennxgz +stars1658gljzpwj60f996mmress6sn0mpffgzxsumtd +stars16h2kvscgg8gvw8k69m3egjspjmqldp45wd5q5q +stars16ep8yfsw44g0n3rpjeaet9uv2y0jr5qttw0gxg +stars16mq9lwkz5mu7n45z5ecdtawp37lhcf6cxh52y2 +stars16mgh3jg9ms0mlwjfx57wsk9mjduac04dkdwz9p +stars16mdyr3tpzedtdtz79vul9v6a934cgdyy63j4c2 +stars16mc77te24hgxgt4unn83frynqwh88m365slk82 +stars1mqypstgwxah7mnw2dqh25g9f3qq55zg9g9650z +stars1mqu9kc754svxvsqj9rgqhe905mlagjup30gayr +stars1mpnuj9zx8gfgcqwmml2nnqzyg8zkndlufszmdr +stars1mzc59akvz97fvcyyu5gn663rj9kwfg2nfxu39j +stars1mtpvpwk5h2xvahm9494lwjnwpy8km2dvwqrfva +stars1mtxa2xj0w0vn44vlcyja7jx2kv6dfc5hkt9mps +stars1mtdvpcpfzyldnp4kx9jyn77z6muah4uqlm60kd +stars1md9zaw7gpnrfl2swql6hjvgttjuf6cvkhk20yh +stars1mwk766zec9pulfqjztuk9h8gtyvrgsj9w0rjss +stars1m0k2zscltfl5xecj3g767zq30ylmjyju7recdu +stars1mjt7j5a34yn2085qx5vdg5fgelu4s973y9ddvu +stars1m4x0af6ag4nngskx6u7z5sv84sqtsu4x902rts +stars1m4te7dgnvdlgnph42t5fy36c4lwetn2t74rfz6 +stars1mk8dnkwxfgpuam7jy7xra59r48zgc8wrvfacls +stars1meykgw6zm3fh0lml9tagy5gqy0gmw4dg7nvda6 +stars1m74zj2duq6aqunjz4syec6wtquxygrkpe6dfnc +stars1m7h30ydll7txrdxjmks6kl3p7n3nezgzhm3pq6 +stars1uqyr9999nngfk5l5d3q39wkys6ca0p56qxc0td +stars1uzgnpf4lfkl28mdlkqrtvy990suwnklantvjw3 +stars1ux02hxf36ty3rkj4rlkulnzf0lfjgavqpgtqdd +stars1uvmm26ngcj05dcurr09d2c57k69kprf2r8j46t +stars1udp73k9qtg4q8qwqucgperdzw4n2kt4c6tvpz7 +stars1udhtf5w3lsauvefa65mtsmrthcj388usnqvhls +stars1usd6fxssg5fkm39pwa05trnmvd240fukuswqd9 +stars1uswu5spxn994kqxtfn40xxqpktydppvc8xxcje +stars1usjt2rmec40zzspq9znz6e4sdnadeln87ejpqs +stars1u3x6sp9ncml5hs3rvetd22cwy7gcwk4tpxf6vl +stars1uj8zszllhzky9mh76tknpfer8lmksrta5j0uzq +stars1u57qngz9gm03293qv29c7krge7mgjtn7pfdgq9 +stars1u4sekxjld05shhx5fhy2jlqwevmlkm5nptlmry +stars1uetvgmq68yekkkjnhgsu829hkg245g0xxlm5q8 +stars1u699zz03fxegdulmd7anx05g3apn90h76g0f64 +stars1u697ty53rtccdgrct0r3ac26jxrp6nugs765t3 +stars1u6tvy97qs59e7z258e332m89kkhcenz2hm7qms +stars1u6n0s0yrws9nrjeffn9k7w46xz94zsjqq8a7v2 +stars1uup8gpzrk5wpaw8tu6ml72ur3ag0u6wmlan9sv +stars1uaux0dl3gh40y9czng2eqn2d52uu8afvylv8u7 +stars1u7xwld7jrsj3dh8a7chezj8nj2ac36e8e808ku +stars1u7atmkjfnwqlv3ythx9vq6pld77204dl5jhx9r +stars1aq2qrrr9jqdt6wj32edlazfy64ajt9fvz6f323 +stars1axvx3050n0kw3xygx5v4klhcjnff3m5s0smt52 +stars1axw88ugkakle6g6ma7ev4f30lhzzyfaz3rus5u +stars1agn6f0dsw22zda0kvrpadlspkrudmdlu5krk74 +stars1af7gd83e5q2kv8r72mwrzlw4ay760sfrw8afxn +stars1a2tp5skxegnzfweq7vf8y7mg0jypws4wqkqsky +stars1atyqhztej74h8sfwhc3v2rt78z64cq782urvel +stars1atvzzzac5n676jtxn7046x4cahhtmfvfkctxjf +stars1adr72atmnzzvqlfe574c3qk5s9zxk0l2gq2rz5 +stars1awsjg9e7pj232syxf4cf253u5g0l34p8d0jn4h +stars1a0gz65qczz6ydmtqt58jf97yd9x59anf5eskp8 +stars1as8mhekk6xttwjvpqd7qtgmfrjygldllqcg46n +stars1as5rceuy75rhyec296scexr6whyk078gfuemns +stars1as7t236ykkz5p26r3s3j6dz35uw7lreydcdtx7 +stars1a3edya2cdqsf0uc5seqavq3g2f0fqmg44z2pfe +stars1a4yyte3e67h7f2zyla0kfajj9lev92htshl223 +stars1akez82epks75y3ucyvpgyzm9ewp8ts0w2ud2yz +stars1a6xqyhu6wdvsw7s4v5y5u6nq4qpkms28cmyeqy +stars1a67z7gyczt0npk24xpyy6ufx6l5gu546ah4l3u +stars1aa7j9au42quhjdzhlzv3lfp3va7r5tktpalyrc +stars1al5jrqtmsa7r9l45ansflv52xl45q5phznfhtj +stars1ale4gw8xfaknd0tvjn5e6mv6epuj0la65xhxrx +stars17qf82c3xhuf2gxwam7fp48x657fcyt9arzvyf6 +stars17qdmw794c4t7xlhh47zh7krw8xn0k6usarmg78 +stars17pv2ulmgam09dt7tljty5jq9xeqdmmwa40uw0h +stars17yz4ga0nccmdr8f24nu4mah0s76s6m50ycdsss +stars17ygz3elsqxkysy3cu4eljzu02u5hh6uv9wh7me +stars17ywnzrjgadntmzlazt07lav3049cnr83sv8qh2 +stars17y3wjy5t7cyz30g7d4t2ex5czl5ker9q4xtds5 +stars17yu22yc4kpc5zgy4phtvf96alh40p5ysrghy5f +stars178c2lf6cuuff5kwzusnthwpf9q684vhjzk9p2c +stars17tu87pmm7nqk2msfkstgfa833htckk7z4syzam +stars17v9zsyrd0tnmxn6frppf4erp23v5spdrftjlw0 +stars170x503z95w0nj5ugl2ckr0890x05zss0k0wmm8 +stars17szsxh03v9mqn04jg5dglappsh048d95xexwjl +stars17s6ghz5lu200k3y4kp3p768mq8jm66pvq8v324 +stars17jqs6ugm4xh0n23t8gvylwz8rs2q4cfdta5wu4 +stars17j9rqfx0de7uzdv40z3eg5d9d6yf2se9js2sjp +stars17ezex0ndu2yyyzdxkypgrphjs84hkr9lacrezg +stars17m6nljqlutsk2drwqya6vl2alqwwpg05xtszr0 +stars1775puqg65l7uvz5vuuwdwd2j0kj043zy44epzx +stars1775ufy0v5err0f28rrwvqg5rspwhtg2gaqsfnx +stars1lqy4lxl8tcntkcxfjjwqgxsyme8qd0vqw0hwqm +stars1lz7fqd25rf85qhud0ylkeumtj4pfn7v4cyzjmw +stars1lre3ngcp35jamc5sx7ejnxcp6wff885wduv6sm +stars1l9r5qn20acyhykn4c2d0pn8d44tk0hh42rufda +stars1lxuxlky337wkvt5d60punjyefgsjtl054vg6xe +stars1l8ctju8z8efzug684h7d0efcwzrsd9x4qkkf08 +stars1lfx5twrgkj9at99n5pgeznn57zjza4n5a8uzc7 +stars1lff2vtk36hxrlm35caeqss3vrn3kwz5066um4m +stars1l2wc4s48zcc0yxs7jzqkalyj9fm6s9s0nw7dhn +stars1ltkprklyvt6939jt2kp8c0anys28qrrt5n6aqr +stars1lva7lh77qmejwn3cz8wepp9cp0uxzwx2krt6dm +stars1lwdu3chxu9l4fmvwqckl3zdv9tp99qg69agysz +stars1lj2qrpm7hjggtdkna3gr2wmwh62ad6sjgafunt +stars1ljd6d8quzfn4zev99unxnz5x89frev3vtgy59c +stars1ljkcqnwv7skkz42f8wjvapqjfj5ree25v50uxu +stars1ljle9n0494gxndeskhldf4ljv48umyr9x7c80d +stars1l5nf5vws4h2w8zx9k6xnrwzzlp8e9zjx9vplcd +stars1l46qhgucfdk4lkc6kgjhfp63dsn4awarpa2lxa +stars1lhzdkj754c9g4vz8ec6cr8dlecmj3jyrzuedwx +stars1lhfwumpfgvdng0zquvdje0jdhsms6uh52dg4wj +stars1lh6ruf253fhjykdesvfccy0y0vhjque4uwcey3 +stars1lcfgsnhlgxtq8dklaljz87d4yak666k5g9hlxd +stars1let0chav99tpgt0fmecpjc9qhqztu7xyx5p37a +stars1len4wm8f06qe5c3kxvl6xe2pj36he52gxff7w6 +stars1le77hvu4j64057a9mhdjvq63uaet4ph8qts89u +stars1lm25s78k6jpfq6kgg4lmd7hfukcyyrvxsea8uu +stars1lau9u4ne38ucz9cpe85nvm3sp6w7ngqw7296nh +stars1laajngxl3ppdanmejquf80rpwle0aawnactpax +stars1l7s5a7vp9j7welu48g8ply3eg8mce33ctn3zjs +stars1l7n595wvgxq88pukk5q3y3xgsqfq6cftk92dnf +stars1llxqu33uq0svfqh6n2hkdykxtd9akka80r6hxr +stars1rqd5082y3lxlx04g77s5m8v7f4hq33zcjsgvk6lcadk289xn9grqvn9zjm +stars1rqeychen93f9j72r7jue56g2gvaaqtjl7ule7u09f3ytxtlxhe8s3zhd98 +stars1d0zllscq5ycg3xrqkdjpe77nhtp34m3snwhvf3 +stars1f6cj5c7faa8j9dpfhw4zaqnq7z5plws58f9dv7 \ No newline at end of file diff --git a/contracts/whitelists/whitelist-merkletree/src/tests/data/whitelist_simple.txt b/contracts/whitelists/whitelist-merkletree/src/tests/data/whitelist_simple.txt new file mode 100644 index 000000000..907db6d2e --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/tests/data/whitelist_simple.txt @@ -0,0 +1,4 @@ +stars1ye63jpm474yfrq02nyplrspyw75y82tptsls9t +stars130dxx3nr2ste4fwsum57k3en60wqd76m9pvpsy +stars1x97rgyyudwr29xkauhxuvkgyhsrdxx3tuzr0mj +stars16epdu6c7h8apxrnuu06yzfxflrede0mtu4qqz4 \ No newline at end of file diff --git a/contracts/whitelists/whitelist-merkletree/src/tests/hasher.rs b/contracts/whitelists/whitelist-merkletree/src/tests/hasher.rs new file mode 100644 index 000000000..85669e387 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/tests/hasher.rs @@ -0,0 +1,36 @@ +use rs_merkle::{algorithms::Sha256, Hasher}; + +#[derive(Clone)] +pub struct SortingSha256Hasher {} + +// Default Sha256 doesn't sort left and right which make it impossible to +// compare on the contract side without extra payload +impl Hasher for SortingSha256Hasher { + type Hash = [u8; 32]; + + fn concat_and_hash(left: &Self::Hash, right: Option<&Self::Hash>) -> Self::Hash { + + match right { + Some(right_node) => { + + let mut both = vec![left, right_node]; + both.sort_unstable(); + + // TODO: Optimize this + let mut concatenated: Vec = (*both[0]).into(); + concatenated.append(&mut (*both[1]).into()); + + Self::hash(&concatenated) + } + None => *left, + } + } + + fn hash(data: &[u8]) -> Self::Hash { + Sha256::hash(data) + } + + fn hash_size() -> usize { + Sha256::hash_size() + } +} \ No newline at end of file diff --git a/contracts/whitelists/whitelist-merkletree/src/tests/test_helpers.rs b/contracts/whitelists/whitelist-merkletree/src/tests/test_helpers.rs new file mode 100644 index 000000000..8321aac44 --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/tests/test_helpers.rs @@ -0,0 +1,62 @@ +use std::{fs::File, io::Read}; +use rs_merkle::{MerkleTree, algorithms::Sha256, Hasher}; + +use super::hasher::SortingSha256Hasher; + + + +fn text_from_file(path: &str) -> String { + let mut file = File::open(path).unwrap(); + let mut data = String::new(); + file.read_to_string(&mut data).unwrap(); + data +} + + +pub fn hash_and_build_tree(serialized: &Vec) -> MerkleTree:: { + let leaves: Vec<[u8; 32]> = serialized + .iter() + .map(|x| Sha256::hash(x.as_bytes())) + .collect(); + + MerkleTree::::from_leaves(&leaves) +} + +pub fn tree_from_file(path: &str) -> MerkleTree:: { + let data = text_from_file(path); + + let serialized: Vec = data + .split("\n") + .map(|x| x.to_string()) + .filter(|s| !s.is_empty() && s.len() > 1) + .collect(); + + hash_and_build_tree(&serialized) +} + +pub fn get_merkle_tree_simple(path_prefix: Option) -> MerkleTree:: { + let path = path_prefix.unwrap_or_default() + "src/tests/data/whitelist_simple.txt"; + tree_from_file(path.as_str()) +} + +pub fn get_merkle_tree_medium() -> MerkleTree { + let path = "src/tests/data/whitelist_medium.txt"; + tree_from_file(path) +} + +pub fn get_merkle_tree_large() -> MerkleTree { + let path = "src/tests/data/whitelist_medium.txt"; + let data = text_from_file(path); + + let mut serialized: Vec = data + .split("\n") + .map(|x| x.to_string()) + .filter(|s| !s.is_empty() && s.len() > 1) + .collect(); + + for _ in 0..5 { + serialized.extend(serialized.clone()); + } + + hash_and_build_tree(&serialized) +} \ No newline at end of file diff --git a/contracts/whitelists/whitelist-merkletree/src/tests/unit_tests.rs b/contracts/whitelists/whitelist-merkletree/src/tests/unit_tests.rs new file mode 100644 index 000000000..0469824dc --- /dev/null +++ b/contracts/whitelists/whitelist-merkletree/src/tests/unit_tests.rs @@ -0,0 +1,241 @@ +#[cfg(test)] +mod tests { + use std::vec; + use crate::{ + msg::{InstantiateMsg, ExecuteMsg}, + contract::{instantiate, execute, query_config, query_has_member}, + tests::test_helpers::get_merkle_tree_simple + }; + + use cosmwasm_std::{ + coin, + testing::{mock_dependencies, mock_env, mock_info}, Timestamp, DepsMut, Env, BlockInfo, + }; + use sg_std::{NATIVE_DENOM, GENESIS_MINT_START_TIME}; + + const ADMIN: &str = "admin"; + const UNIT_AMOUNT: u128 = 100_000_000; + + const GENESIS_START_TIME: Timestamp = Timestamp::from_nanos(GENESIS_MINT_START_TIME); + const END_TIME: Timestamp = Timestamp::from_nanos(GENESIS_MINT_START_TIME + 1000); + + + const MERKLE_ROOT: &str = "5ab281bca33c9819e0daa0708d20ff8a25e65de7d1f6659dbdeb1d2050652b80"; + const NON_HEX_MERKLE_ROOT: &str = "5zb281bca33c9819e0daa0708d20ff8a25e65de7d1f6659dbdeb1d2050652b80"; + const NON_32BYTES_MERKLE_ROOT: &str = "5ab281bca33c9819e0daa0708d20ff8a25e65de7d1f6659dbdeb1d2050652b80ab"; + + + fn setup_contract(deps: DepsMut, merkle_root: Option) { + let msg = InstantiateMsg { + merkle_root: merkle_root.unwrap_or(MERKLE_ROOT.to_string()), + merkle_tree_uri: None, + per_address_limit: 1, + start_time: GENESIS_START_TIME, + end_time: END_TIME, + mint_price: coin(UNIT_AMOUNT, NATIVE_DENOM), + admins: vec![ADMIN.to_string()], + admins_mutable: true, + }; + let info = mock_info(ADMIN, &[]); + let res = instantiate(deps, mock_env(), info, msg).unwrap(); + assert_eq!(0, res.messages.len()); + assert_eq!(5, res.attributes.len()); + + } + + fn custom_mock_env() -> Env { + Env { + block: BlockInfo { + height: 55_555, + time: GENESIS_START_TIME.plus_nanos(100), + chain_id: "stargaze-1".to_string(), + }, + ..mock_env() + } + } + + #[test] + fn proper_initialization() { + let mut deps = mock_dependencies(); + setup_contract(deps.as_mut(), None); + } + + #[test] + fn improper_initializations() { + let mut deps = mock_dependencies(); + let env = custom_mock_env(); + + let invalid_msgs: Vec = vec![ + + // invalid merkle root (non hex) + InstantiateMsg { + merkle_root: NON_HEX_MERKLE_ROOT.to_string(), + merkle_tree_uri: None, + per_address_limit: 1, + start_time: GENESIS_START_TIME, + end_time: END_TIME, + mint_price: coin(1, NATIVE_DENOM), + admins: vec![ADMIN.to_string()], + admins_mutable: false, + }, + + // invalid merkle root (non 32 bytes) + InstantiateMsg { + merkle_root: NON_32BYTES_MERKLE_ROOT.to_string(), + merkle_tree_uri: None, + per_address_limit: 1, + start_time: GENESIS_START_TIME, + end_time: END_TIME, + mint_price: coin(1, NATIVE_DENOM), + admins: vec![ADMIN.to_string()], + admins_mutable: false, + }, + + // invalid mint price denom + InstantiateMsg { + merkle_root: MERKLE_ROOT.to_string(), + merkle_tree_uri: None, + per_address_limit: 1, + start_time: GENESIS_START_TIME, + end_time: END_TIME, + mint_price: coin(UNIT_AMOUNT, "not_ustars"), + admins: vec![ADMIN.to_string()], + admins_mutable: false, + }, + + // invalid admin address (MockApi only) (too short) + InstantiateMsg { + merkle_root: MERKLE_ROOT.to_string(), + merkle_tree_uri: None, + per_address_limit: 1, + start_time: GENESIS_START_TIME, + end_time: END_TIME, + mint_price: coin(UNIT_AMOUNT, NATIVE_DENOM), + admins: vec!["A".to_string()], + admins_mutable: false, + }, + + // invalid start time (after end time) + InstantiateMsg { + merkle_root: MERKLE_ROOT.to_string(), + merkle_tree_uri: None, + per_address_limit: 1, + start_time: END_TIME.plus_nanos(1u64), + end_time: END_TIME, + mint_price: coin(UNIT_AMOUNT, NATIVE_DENOM), + admins: vec![ADMIN.to_string()], + admins_mutable: false, + }, + + // invalid start time (before genesis mint start time) + InstantiateMsg { + merkle_root: MERKLE_ROOT.to_string(), + merkle_tree_uri: None, + per_address_limit: 1, + start_time: GENESIS_START_TIME.minus_nanos(1u64), + end_time: END_TIME, + mint_price: coin(UNIT_AMOUNT, NATIVE_DENOM), + admins: vec![ADMIN.to_string()], + admins_mutable: false, + }, + + // invalid start time (before current block time) + InstantiateMsg { + merkle_root: MERKLE_ROOT.to_string(), + merkle_tree_uri: None, + per_address_limit: 1, + start_time: env.block.time.minus_nanos(1u64), + end_time: END_TIME, + mint_price: coin(UNIT_AMOUNT, NATIVE_DENOM), + admins: vec![ADMIN.to_string()], + admins_mutable: false, + }, + + ]; + + let info = mock_info(ADMIN, &[]); + + for msg in invalid_msgs { + instantiate(deps.as_mut(), env.clone(), info.clone(), msg).unwrap_err(); + } + } + + + + #[test] + fn update_start_time() { + let mut deps = mock_dependencies(); + setup_contract(deps.as_mut(), None); + + let msg = ExecuteMsg::UpdateStartTime(Timestamp::from_nanos(GENESIS_MINT_START_TIME - 100)); + let info = mock_info(ADMIN, &[]); + let res = execute(deps.as_mut(), mock_env(), info, msg).unwrap(); + assert_eq!(res.attributes.len(), 3); + let res = query_config(deps.as_ref(), mock_env()).unwrap(); + assert_eq!(res.start_time, GENESIS_START_TIME); + } + + #[test] + fn update_end_time() { + let mut deps = mock_dependencies(); + setup_contract(deps.as_mut(), None); + + let msg = ExecuteMsg::UpdateEndTime(Timestamp::from_nanos(GENESIS_MINT_START_TIME + 100)); + let info = mock_info(ADMIN, &[]); + let res = execute(deps.as_mut(), mock_env(), info, msg).unwrap(); + assert_eq!(res.attributes.len(), 3); + + let msg = ExecuteMsg::UpdateEndTime(Timestamp::from_nanos(GENESIS_MINT_START_TIME - 100)); + let info = mock_info(ADMIN, &[]); + execute(deps.as_mut(), mock_env(), info, msg).unwrap_err(); + } + + #[test] + fn query_membership() { + let mut deps = mock_dependencies(); + + let tree = get_merkle_tree_simple(None); + let root = tree.root_hex(); + + setup_contract(deps.as_mut(), root.clone()); + + let proof = tree.proof(&vec![0]); + let hash_strings = proof.proof_hashes_hex(); + + let user = mock_info("stars1ye63jpm474yfrq02nyplrspyw75y82tptsls9t", &[]); + let res = query_has_member(deps.as_ref(), user.sender.to_string(), hash_strings).unwrap(); + assert!(res.has_member); + + let user = mock_info("stars130dxx3nr2ste4fwsum57k3en60wqd76m9pvpsy", &[]); + let proof = vec![ + "ea930af5025204fc0dda1b69b567b6b41766107d65d46a1acd9725af65604531".to_string(), + "4c0801ba42388ec349cfeae552dfa64271008f37b10c2601e32c0cf2729c0278".to_string(), + ]; + let res = query_has_member(deps.as_ref(), user.sender.to_string(), proof).unwrap(); + assert!(res.has_member); + + let user = mock_info("stars16epdu6c7h8apxrnuu06yzfxflrede0mtu4qqz4", &[]); + let proof = vec![ + "28fc41471ab92238e98664e99671e906cb29c048dd0343f3acf5295e424270e1".to_string(), + "8e9abbdd48390cd7ed2d6f6934b713f7839801716ad8b5ae674c1d682db6de34".to_string(), + ]; + let res = query_has_member(deps.as_ref(), user.sender.to_string(), proof).unwrap(); + assert!(res.has_member); + + + // mismatched proof + let user = mock_info("stars1ye63jpm474yfrq02nyplrspyw75y82tptsls9t", &[]); + let proof = vec![ + "ea930af5025204fc0dda1b69b567b6b41766107d65d46a1acd9725af65604531".to_string(), + "28fc41471ab92238e98664e99671e906cb29c048dd0343f3acf5295e424270e1".to_string(), + ]; + let res = query_has_member(deps.as_ref(), user.sender.to_string(), proof).unwrap(); + assert!(!res.has_member); + + // invalid proof + let user = mock_info("stars1ye63jpm474yfrq02nyplrspyw75y82tptsls9t", &[]); + let proof = vec!["x".to_string(), "x".to_string()]; + let _ = query_has_member(deps.as_ref(), user.sender.to_string(), proof).unwrap_err(); + } + +} \ No newline at end of file diff --git a/test-suite/Cargo.toml b/test-suite/Cargo.toml index a8190e2be..867d077f1 100644 --- a/test-suite/Cargo.toml +++ b/test-suite/Cargo.toml @@ -62,6 +62,10 @@ sg721-nt = { workspace = true } sg-controllers = { workspace = true } cw-ownable = "0.5.1" +vending-minter-merkle-wl = { workspace = true, features = ["library"] } +whitelist-mtree = { workspace = true, features = ["library"] } +rs_merkle = { version = "1.4.1", default-features = false } + [dev-dependencies] serde = { workspace = true } thiserror = { workspace = true } diff --git a/test-suite/src/common_setup.rs b/test-suite/src/common_setup.rs index ce9eef842..4f82d1ce0 100644 --- a/test-suite/src/common_setup.rs +++ b/test-suite/src/common_setup.rs @@ -4,5 +4,6 @@ pub mod helpers; pub mod msg; pub mod setup_accounts_and_block; pub mod setup_collection_whitelist; +pub mod setup_whitelist_merkletree; pub mod setup_minter; pub mod templates; diff --git a/test-suite/src/common_setup/contract_boxes.rs b/test-suite/src/common_setup/contract_boxes.rs index 6e938a5ef..2f5be14a3 100644 --- a/test-suite/src/common_setup/contract_boxes.rs +++ b/test-suite/src/common_setup/contract_boxes.rs @@ -64,6 +64,7 @@ pub fn contract_collection_whitelist() -> Box> Box::new(contract) } + pub fn contract_open_edition_minter() -> Box> { let contract = ContractWrapper::new( open_edition_minter::contract::execute, @@ -139,3 +140,12 @@ pub fn contract_whitelist_immutable() -> Box> { ); Box::new(contract) } + +pub fn contract_whitelist_merkletree() -> Box> { + let contract = ContractWrapper::new( + whitelist_mtree::contract::execute, + whitelist_mtree::contract::instantiate, + whitelist_mtree::contract::query, + ); + Box::new(contract) +} \ No newline at end of file diff --git a/test-suite/src/common_setup/setup_whitelist_merkletree.rs b/test-suite/src/common_setup/setup_whitelist_merkletree.rs new file mode 100644 index 000000000..09ccc77df --- /dev/null +++ b/test-suite/src/common_setup/setup_whitelist_merkletree.rs @@ -0,0 +1,49 @@ +use cosmwasm_std::{coin, Addr, Timestamp}; +use cw_multi_test::Executor; +use sg_multi_test::StargazeApp; +use sg_std::{GENESIS_MINT_START_TIME, NATIVE_DENOM}; +use whitelist_mtree::msg::InstantiateMsg as WhitelistInstantiateMsg; + +use crate::common_setup::contract_boxes::contract_whitelist_merkletree; + +pub const WHITELIST_AMOUNT: u128 = 66_000_000; +const WL_PER_ADDRESS_LIMIT: u32 = 1; + +pub fn setup_whitelist_mtree_contract( + router: &mut StargazeApp, + creator: &Addr, + whitelist_code_id: Option, + denom: Option<&str>, + merkle_root: String +) -> Addr { + let whitelist_code_id = match whitelist_code_id { + Some(value) => value, + None => router.store_code(contract_whitelist_merkletree()), + }; + let denom = match denom { + Some(value) => value, + None => NATIVE_DENOM, + }; + + + let msg = WhitelistInstantiateMsg { + start_time: Timestamp::from_nanos(GENESIS_MINT_START_TIME + 100), + end_time: Timestamp::from_nanos(GENESIS_MINT_START_TIME + 10_000_000), + mint_price: coin(WHITELIST_AMOUNT, denom), + per_address_limit: WL_PER_ADDRESS_LIMIT, + admins: vec![creator.to_string()], + admins_mutable: true, + merkle_root, + merkle_tree_uri: None + }; + router + .instantiate_contract( + whitelist_code_id, + creator.clone(), + &msg, + &[], + "whitelist", + None, + ) + .unwrap() +} diff --git a/test-suite/src/lib.rs b/test-suite/src/lib.rs index 163186710..8747e00b4 100644 --- a/test-suite/src/lib.rs +++ b/test-suite/src/lib.rs @@ -22,3 +22,5 @@ mod vending_minter; mod whitelist; #[cfg(test)] mod whitelist_immutable; +#[cfg(test)] +mod whitelist_merkletree; diff --git a/test-suite/src/whitelist_merkletree.rs b/test-suite/src/whitelist_merkletree.rs new file mode 100644 index 000000000..b90ccf403 --- /dev/null +++ b/test-suite/src/whitelist_merkletree.rs @@ -0,0 +1 @@ +mod tests; \ No newline at end of file diff --git a/test-suite/src/whitelist_merkletree/tests.rs b/test-suite/src/whitelist_merkletree/tests.rs new file mode 100644 index 000000000..6b4013a43 --- /dev/null +++ b/test-suite/src/whitelist_merkletree/tests.rs @@ -0,0 +1 @@ +mod integration_tests; \ No newline at end of file diff --git a/test-suite/src/whitelist_merkletree/tests/integration_tests.rs b/test-suite/src/whitelist_merkletree/tests/integration_tests.rs new file mode 100644 index 000000000..2302694e2 --- /dev/null +++ b/test-suite/src/whitelist_merkletree/tests/integration_tests.rs @@ -0,0 +1,167 @@ +#[cfg(test)] +mod tests { + use cosmwasm_std::{Addr, Timestamp, coin}; + use cw_multi_test::Executor; + use rs_merkle::MerkleTree; + use sg_multi_test::StargazeApp; + use sg_std::{GENESIS_MINT_START_TIME, NATIVE_DENOM}; + + use whitelist_mtree::{ + tests::{hasher::SortingSha256Hasher, test_helpers::hash_and_build_tree}, + msg::* + }; + + use crate::common_setup::contract_boxes::{contract_whitelist_merkletree, custom_mock_app}; + + type Tree = MerkleTree::; + + const CREATOR: &str = "creator"; + const START_TIME: Timestamp = Timestamp::from_nanos(GENESIS_MINT_START_TIME); + const END_TIME: Timestamp = Timestamp::from_nanos(GENESIS_MINT_START_TIME + 1000); + + + fn get_init_address_list_1() -> Vec { + vec![ + "addr0001".to_string(), + "addr0002".to_string(), + "addr0003".to_string(), + "addr0004".to_string(), + "addr0005".to_string(), + ] + } + + fn get_init_address_list_2() -> Vec { + vec![ + "tester".to_string(), + "user".to_string(), + "rando".to_string(), + "human".to_string(), + "bot".to_string(), + ] + } + + fn get_init_address_single_list() -> Vec { + vec!["onlyone".to_string()] + } + + pub fn instantiate_with_root( + app: &mut StargazeApp, + per_address_limit: u32, + merkle_root: String + ) -> Addr { + let msg = InstantiateMsg { + admins: vec![], + admins_mutable: false, + start_time: START_TIME, + end_time: END_TIME, + mint_price: coin(1000000u128, NATIVE_DENOM), + per_address_limit, + merkle_root, + merkle_tree_uri: None + }; + let wl_id = app.store_code(contract_whitelist_merkletree()); + app.instantiate_contract( + wl_id, + Addr::unchecked(CREATOR), + &msg, + &[], + "wl-contract-mtree".to_string(), + None, + ) + .unwrap() + } + + + + pub fn query_admin_list(app: &mut StargazeApp, wl_addr: Addr) { + let res: AdminListResponse = app + .wrap() + .query_wasm_smart(wl_addr, &QueryMsg::AdminList { }) + .unwrap(); + assert_eq!(res.admins.len(), 0); + assert_eq!(res.mutable, false) + } + + pub fn query_includes_address( + app: &mut StargazeApp, + wl_addr: Addr, + addr_to_check: String, + proof_hashes: Vec + ) { + let res: HasMemberResponse = app + .wrap() + .query_wasm_smart( + wl_addr, + &QueryMsg::HasMember { + member: addr_to_check.to_string(), + proof_hashes + } + ) + .unwrap(); + assert!(res.has_member); + } + + pub fn query_per_address_limit(app: &mut StargazeApp, wl_addr: Addr, per_address_limit: u32) { + let config: ConfigResponse = app + .wrap() + .query_wasm_smart(wl_addr, &QueryMsg::Config {}) + .unwrap(); + assert_eq!(config.per_address_limit, per_address_limit); + } + + #[test] + pub fn test_instantiate_with_one_mint() { + let mut app = custom_mock_app(); + let addrs = get_init_address_list_1(); + let per_address_limit = 1; + let tree: Tree = hash_and_build_tree(&addrs); + let wl_addr = instantiate_with_root(&mut app, per_address_limit, tree.root_hex().unwrap()); + + let addr_to_check = addrs[0].clone(); + let proof = tree.proof(&vec![0]); + let proof_hashes = proof.proof_hashes_hex(); + + query_includes_address(&mut app, wl_addr.clone(), addr_to_check, proof_hashes); + // execute_query_checks(&mut app, wl_addr, addrs, per_address_limit, addr_to_check); + query_admin_list(&mut app, wl_addr.clone()); + query_per_address_limit(&mut app, wl_addr, per_address_limit) + } + #[test] + pub fn test_instantiate_with_multiple_mints() { + let mut app = custom_mock_app(); + let addrs = get_init_address_list_2(); + let per_address_limit = 99; + + let tree: Tree = hash_and_build_tree(&addrs); + let wl_addr = instantiate_with_root(&mut app, per_address_limit, tree.root_hex().unwrap()); + let addr_to_check = addrs[1].clone(); + + let proof = tree.proof(&vec![1]); + let proof_hashes = proof.proof_hashes_hex(); + + query_admin_list(&mut app, wl_addr.clone()); + query_includes_address(&mut app, wl_addr.clone(), addr_to_check, proof_hashes); + query_per_address_limit(&mut app, wl_addr, per_address_limit) + } + + #[test] + pub fn test_instantiate_single_list() { + let mut app = custom_mock_app(); + let addrs = get_init_address_single_list(); + let per_address_limit = 5; + + let tree: Tree = hash_and_build_tree(&addrs); + let wl_addr = instantiate_with_root(&mut app, per_address_limit, tree.root_hex().unwrap()); + + let addr_to_check = addrs[0].clone(); + query_admin_list(&mut app, wl_addr.clone()); + + let proof = tree.proof(&vec![0]); + let proof_hashes = proof.proof_hashes_hex(); + + query_includes_address(&mut app, wl_addr.clone(), addr_to_check, proof_hashes); + query_per_address_limit(&mut app, wl_addr, per_address_limit) + } + + +}