diff --git a/cosmwasm-contracts/marketing/.cargo/config.toml b/cosmwasm-contracts/marketing/.cargo/config.toml new file mode 100644 index 0000000000..9354fae229 --- /dev/null +++ b/cosmwasm-contracts/marketing/.cargo/config.toml @@ -0,0 +1,4 @@ +[alias] +wasm = "build --target wasm32-unknown-unknown --release --lib" +wasm-debug = "build --target wasm32-unknown-unknown --lib" +schema = "run schema" diff --git a/cosmwasm-contracts/marketing/Cargo.lock b/cosmwasm-contracts/marketing/Cargo.lock new file mode 100644 index 0000000000..14d26e5305 --- /dev/null +++ b/cosmwasm-contracts/marketing/Cargo.lock @@ -0,0 +1,891 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bnum" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56953345e39537a3e18bdaeba4cb0c58a78c1f61f361dc0fa7c5c7340ae87c5f" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "const_panic" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7782af8f90fe69a4bb41e460abe1727d493403d8b2cc43201a3a3e906b24379f" + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "cosmwasm-crypto" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f862b355f7e47711e0acfe6af92cb3fd8fd5936b66a9eaa338b51edabd1e77d" +dependencies = [ + "digest 0.10.7", + "ed25519-zebra", + "k256", + "rand_core 0.6.4", + "thiserror", +] + +[[package]] +name = "cosmwasm-derive" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd85de6467cd1073688c86b39833679ae6db18cf4771471edd9809f15f1679f1" +dependencies = [ + "syn 1.0.109", +] + +[[package]] +name = "cosmwasm-schema" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b4cd28147a66eba73720b47636a58097a979ad8c8bfdb4ed437ebcbfe362576" +dependencies = [ + "cosmwasm-schema-derive", + "schemars", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cosmwasm-schema-derive" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9acd45c63d41bc9b16bc6dc7f6bd604a8c2ad29ce96c8f3c96d7fc8ef384392e" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "cosmwasm-std" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2685c2182624b2e9e17f7596192de49a3f86b7a0c9a5f6b25c1df5e24592e836" +dependencies = [ + "base64", + "bech32", + "bnum", + "cosmwasm-crypto", + "cosmwasm-derive", + "derivative", + "forward_ref", + "hex", + "schemars", + "serde", + "serde-json-wasm", + "sha2 0.10.8", + "static_assertions", + "thiserror", +] + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "cw-storage-plus" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5ff29294ee99373e2cd5fd21786a3c0ced99a52fec2ca347d565489c61b723c" +dependencies = [ + "cosmwasm-std", + "schemars", + "serde", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "dyn-clone" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek", + "hashbrown 0.12.3", + "hex", + "rand_core 0.6.4", + "serde", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "forward_ref" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8cbd1169bd7b4a0a20d92b9af7a7e0422888bd38a6f5ec29c1fd8c1558a272e" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "indexmap" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "k256" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2 0.10.8", + "signature", +] + +[[package]] +name = "konst" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50a0ba6de5f7af397afff922f22c149ff605c766cd3269cf6c1cd5e466dbe3b9" +dependencies = [ + "const_panic", + "konst_kernel", + "konst_proc_macros", + "typewit", +] + +[[package]] +name = "konst_kernel" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be0a455a1719220fd6adf756088e1c69a85bf14b6a9e24537a5cc04f503edb2b" +dependencies = [ + "typewit", +] + +[[package]] +name = "konst_proc_macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e28ab1dc35e09d60c2b8c90d12a9a8d9666c876c10a3739a3196db0103b6043" + +[[package]] +name = "libc" +version = "0.2.158" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" + +[[package]] +name = "marketing" +version = "0.1.0" +dependencies = [ + "base64", + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus", + "schemars", + "serde", + "sylvia", + "thiserror", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "schemars" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1eee588578aff73f856ab961cd2f79e36bc45d7ded33a7562adba4667aecc0e" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 2.0.77", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "serde" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-cw-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75d32da6b8ed758b7d850b6c3c08f1d7df51a4df3cb201296e63e34a78e99d4" +dependencies = [ + "serde", +] + +[[package]] +name = "serde-json-wasm" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e9213a07d53faa0b8dd81e767a54a8188a242fdb9be99ab75ec576a774bfdd7" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "serde_json" +version = "1.0.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "sylvia" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f358d505f46900e55154f028f18811961ebb58f7a92954ec03086ffb2b26cf51" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "konst", + "schemars", + "serde", + "serde-cw-value", + "serde-json-wasm", + "sylvia-derive", +] + +[[package]] +name = "sylvia-derive" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bed182fb775d756fdfe7e87174a4e43f1c446c8f9aff1de38a2165dd04b7d805" +dependencies = [ + "convert_case", + "proc-macro-crate", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "typewit" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fb9ae6a3cafaf0a5d14c2302ca525f9ae8e07a0f0e6949de88d882c37a6e24" +dependencies = [ + "typewit_proc_macros", +] + +[[package]] +name = "typewit_proc_macros" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36a83ea2b3c704935a01b4642946aadd445cea40b10935e3f8bd8052b8193d6" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-segmentation" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/cosmwasm-contracts/marketing/Cargo.toml b/cosmwasm-contracts/marketing/Cargo.toml new file mode 100644 index 0000000000..4b0caf8027 --- /dev/null +++ b/cosmwasm-contracts/marketing/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "marketing" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +crate-type = ["cdylib", "rlib"] + +[dependencies] +schemars = "0.8.12" +cosmwasm-std = "1.3.1" +cosmwasm-schema = "1.3.1" +cw-storage-plus = "1.1.0" +serde = "1.0.180" +sylvia = "0.7.0" +thiserror = "1.0.44" +base64 = "0.21.7" diff --git a/cosmwasm-contracts/marketing/src/bin/schema.rs b/cosmwasm-contracts/marketing/src/bin/schema.rs new file mode 100644 index 0000000000..74ef290505 --- /dev/null +++ b/cosmwasm-contracts/marketing/src/bin/schema.rs @@ -0,0 +1,10 @@ +use cosmwasm_schema::write_api; +use marketing::contract::{ContractExecMsg, ContractQueryMsg, InstantiateMsg}; + +fn main() { + write_api! { + instantiate: InstantiateMsg, + execute: ContractExecMsg, + query: ContractQueryMsg, + } +} diff --git a/cosmwasm-contracts/marketing/src/contract.rs b/cosmwasm-contracts/marketing/src/contract.rs new file mode 100644 index 0000000000..aba3a5c681 --- /dev/null +++ b/cosmwasm-contracts/marketing/src/contract.rs @@ -0,0 +1,295 @@ + +use cosmwasm_std::{attr,Addr, + Response, StdResult +}; +use cosmwasm_schema::cw_serde; +use crate::error::ContractError; +use cw_storage_plus::{Item, Map}; +use sylvia::{types::{ExecCtx, InstantiateCtx, QueryCtx},contract, entry_points}; + + +#[cw_serde] +pub struct Banner { + image: String, + url: String, +} + +#[cw_serde] +pub struct Action { + label: String, + url: String, +} + +#[cw_serde] +pub struct News { + title: String, + subtitle: String, + text: String, + image: String, + actions: Option, +} + +#[cw_serde] +pub struct MarketingCollectionPreview { + address: String, + image_uri: String, + collection_name: String, + creator_name: String, + twitter_url: String, + secondary_during_mint: bool, +} + +#[cw_serde] +pub struct Config { + pub admin_addr: Addr, +} + +pub struct MarketingContract { + pub(crate) config: Item<'static, Config>, + pub(crate) banners: Map<'static, u64, Banner>, + pub(crate) news: Map<'static, u64, News>, + pub(crate) upcoming_collections: Map<'static, u64, MarketingCollectionPreview>, + pub(crate) live_collections: Map<'static, u64, MarketingCollectionPreview>, + pub(crate) highlighted_collections: Map<'static, u64, MarketingCollectionPreview>, +} + +#[entry_points] +#[contract] +#[error(ContractError)] +impl MarketingContract { + pub const fn new() -> Self { + Self { + config: Item::new("config"), + banners: Map::new("banners"), + news: Map::new("news"), + upcoming_collections: Map::new("upcoming_collections"), + live_collections: Map::new("live_collections"), + highlighted_collections: Map::new("highlighted_collections"), + } + } + + #[msg(instantiate)] + pub fn instantiate(&self, ctx: InstantiateCtx + , config: Config + , banners: Vec + , news: Vec + , upcoming_collections: Vec + , live_collections: Vec + , highlighted_collections: Vec + ) -> StdResult { + self.config.save(ctx.deps.storage, &config)?; + for (index, banner) in banners.into_iter().enumerate() { + self.banners.save(ctx.deps.storage, index as u64, &banner)?; + } + for (index, news_item) in news.into_iter().enumerate() { + self.news.save(ctx.deps.storage, index as u64, &news_item)?; + } + for (index, upcoming_collection) in upcoming_collections.into_iter().enumerate() { + self.upcoming_collections.save(ctx.deps.storage, index as u64, &upcoming_collection)?; + } + for (index, live_collection) in live_collections.into_iter().enumerate() { + self.live_collections.save(ctx.deps.storage, index as u64, &live_collection)?; + } + for (index, highlighted_collection) in highlighted_collections.into_iter().enumerate() { + self.highlighted_collections.save(ctx.deps.storage, index as u64, &highlighted_collection)?; + } + Ok(Response::default()) + } + + #[msg(exec)] + // Only the admin can execute it + pub fn update_config( + &self, + ctx: ExecCtx, + admin_addr: Option, + ) -> Result { + let attributes = vec![attr("action", "update_config")]; + self.config.update(ctx.deps.storage, |mut config| { + // Permission check + if ctx.info.sender != config.admin_addr { + return Err(ContractError::Unauthorized); + } + // Validate and save the new admin_addr in config + if let Some(admin_addr) = admin_addr { + config.admin_addr = ctx.deps.api.addr_validate(admin_addr.as_str())?; + } + + Ok(config) + })?; + + Ok(Response::new().add_attributes(attributes)) + } + + #[msg(exec)] + // Only the admin can execute it + pub fn update_banners( + &self, + ctx: ExecCtx, + banners: Vec, + ) -> Result { + let attributes = vec![attr("action", "update_banners")]; + let config = self.config.load(ctx.deps.storage)?; + // Permission check + if ctx.info.sender != config.admin_addr { + return Err(ContractError::Unauthorized); + } + // Replace all banners with the new ones + self.banners.clear(ctx.deps.storage); + for (index, banner) in banners.into_iter().enumerate() { + self.banners.save(ctx.deps.storage, index as u64, &banner)?; + } + + Ok(Response::new().add_attributes(attributes)) + } + + #[msg(exec)] + // Only the admin can execute it + pub fn update_news( + &self, + ctx: ExecCtx, + news: Vec, + ) -> Result { + let attributes = vec![attr("action", "update_news")]; + let config = self.config.load(ctx.deps.storage)?; + // Permission check + if ctx.info.sender != config.admin_addr { + return Err(ContractError::Unauthorized); + } + // Replace all news with the new ones + self.news.clear(ctx.deps.storage); + for (index, news_item) in news.into_iter().enumerate() { + self.news.save(ctx.deps.storage, index as u64, &news_item)?; + } + + Ok(Response::new().add_attributes(attributes)) + } + + #[msg(exec)] + // Only the admin can execute it + pub fn update_live_collections( + &self, + ctx: ExecCtx, + live_collections: Vec, + ) -> Result { + let attributes = vec![attr("action", "update_live_collections")]; + let config = self.config.load(ctx.deps.storage)?; + // Permission check + if ctx.info.sender != config.admin_addr { + return Err(ContractError::Unauthorized); + } + // Replace all live_collections with the new ones + self.live_collections.clear(ctx.deps.storage); + for (index, live_collection) in live_collections.into_iter().enumerate() { + self.live_collections.save(ctx.deps.storage, index as u64, &live_collection)?; + } + + Ok(Response::new().add_attributes(attributes)) + } + + #[msg(exec)] + // Only the admin can execute it + pub fn update_upcoming_collections( + &self, + ctx: ExecCtx, + upcoming_collections: Vec, + ) -> Result { + let attributes = vec![attr("action", "update_upcoming_collections")]; + let config = self.config.load(ctx.deps.storage)?; + // Permission check + if ctx.info.sender != config.admin_addr { + return Err(ContractError::Unauthorized); + } + // Replace all upcoming_collections with the new ones + self.upcoming_collections.clear(ctx.deps.storage); + for (index, upcoming_collection) in upcoming_collections.into_iter().enumerate() { + self.upcoming_collections.save(ctx.deps.storage, index as u64, &upcoming_collection)?; + } + + Ok(Response::new().add_attributes(attributes)) + } + + #[msg(exec)] + // Only the admin can execute it + pub fn update_highlighted_collections( + &self, + ctx: ExecCtx, + highlighted_collections: Vec, + ) -> Result { + let attributes = vec![attr("action", "update_highlighted_collections")]; + let config = self.config.load(ctx.deps.storage)?; + // Permission check + if ctx.info.sender != config.admin_addr { + return Err(ContractError::Unauthorized); + } + // Replace all highlighted_collections with the new ones + self.highlighted_collections.clear(ctx.deps.storage); + for (index, highlighted_collection) in highlighted_collections.into_iter().enumerate() { + self.highlighted_collections.save(ctx.deps.storage, index as u64, &highlighted_collection)?; + } + + Ok(Response::new().add_attributes(attributes)) + } + + #[msg(query)] + pub fn get_config(&self, ctx: QueryCtx) -> StdResult { + let config = self.config.load(ctx.deps.storage)?; + Ok(config) + } + + #[msg(query)] + pub fn get_banners(&self, ctx: QueryCtx) -> StdResult> { + let banners: Vec = self + .banners + .range(ctx.deps.storage, None, None, cosmwasm_std::Order::Ascending) + .map(|item| item.map(|(_, banner)| banner)) + .collect::>>()?; + + Ok(banners) + } + + #[msg(query)] + pub fn get_news(&self, ctx: QueryCtx) -> StdResult> { + let news: Vec = self + .news + .range(ctx.deps.storage, None, None, cosmwasm_std::Order::Ascending) + .map(|item| item.map(|(_, news_item)| news_item)) + .collect::>>()?; + + Ok(news) + } + + #[msg(query)] + pub fn get_live_collections(&self, ctx: QueryCtx) -> StdResult> { + let live_collections: Vec = self + .live_collections + .range(ctx.deps.storage, None, None, cosmwasm_std::Order::Ascending) + .map(|item| item.map(|(_, live_collection)| live_collection)) + .collect::>>()?; + + Ok(live_collections) + } + + #[msg(query)] + pub fn get_upcoming_collections(&self, ctx: QueryCtx) -> StdResult> { + let upcoming_collections: Vec = self + .upcoming_collections + .range(ctx.deps.storage, None, None, cosmwasm_std::Order::Ascending) + .map(|item| item.map(|(_, upcoming_collection)| upcoming_collection)) + .collect::>>()?; + + Ok(upcoming_collections) + } + + #[msg(query)] + pub fn get_highlighted_collections(&self, ctx: QueryCtx) -> StdResult> { + let highlighted_collections: Vec = self + .highlighted_collections + .range(ctx.deps.storage, None, None, cosmwasm_std::Order::Ascending) + .map(|item| item.map(|(_, highlighted_collection)| highlighted_collection)) + .collect::>>()?; + + Ok(highlighted_collections) + } +} + + diff --git a/cosmwasm-contracts/marketing/src/error.rs b/cosmwasm-contracts/marketing/src/error.rs new file mode 100644 index 0000000000..d0d8dbb8e0 --- /dev/null +++ b/cosmwasm-contracts/marketing/src/error.rs @@ -0,0 +1,56 @@ +use cosmwasm_std::{DivideByZeroError, OverflowError, StdError}; +use thiserror::Error; + +#[derive(Error, Debug, PartialEq)] +pub enum ContractError { + #[error("{0}")] + Std(#[from] StdError), + + #[error("{0}")] + Overflow(#[from] OverflowError), + + #[error("{0}")] + DivideByZero(#[from] DivideByZeroError), + + #[error("{0}")] + DecodeError(#[from] base64::DecodeError), + + #[error("{0}")] + ParseIntError(#[from] std::num::ParseIntError), + + #[error("Channel already exists.")] + ChannelExists, + + #[error("This address does not own a channel.")] + UnknownChannelAddress, + + #[error("Channel does not exist.")] + ChannelNotFound, + + #[error("Membership kind does not exists.")] + MembershipKindNotFound, + + #[error("Unauthorized.")] + Unauthorized, + + #[error("Invalid token ID.")] + InvalidTokenId, + + #[error("Nft not found.")] + NftNotFound, + + #[error("Cannot transfer to self.")] + CannotTransferToSelf, + + #[error("Invalid funds.")] + InvalidFunds, + + #[error("Serialization error.")] + SerializationError, + + #[error("Internal error.")] + InternalError, + + #[error("No changes.")] + NoChanges, +} diff --git a/cosmwasm-contracts/marketing/src/lib.rs b/cosmwasm-contracts/marketing/src/lib.rs new file mode 100644 index 0000000000..5c639a809f --- /dev/null +++ b/cosmwasm-contracts/marketing/src/lib.rs @@ -0,0 +1,2 @@ +pub mod contract; +pub mod error; \ No newline at end of file