From a0b3caaef61a976e57d3e489f5602bf34fabe819 Mon Sep 17 00:00:00 2001 From: Bucur David Date: Tue, 5 Dec 2023 12:48:17 +0200 Subject: [PATCH 01/10] feat: withdraw tokens using withdrawal address Refs: #68 Signed-off-by: Bucur David --- Cargo.lock | 1736 ++++++++++++++++++++++++++++++++++++------- Cargo.toml | 28 +- meta/Cargo.lock | 1328 +++++++++++++++++++++++++++++---- meta/Cargo.toml | 33 +- src/errors.rs | 4 + src/events.rs | 11 + src/lib.rs | 34 +- src/storage.rs | 4 + tests/rust_tests.rs | 158 +++- wasm/Cargo.lock | 129 ++-- wasm/Cargo.toml | 57 +- wasm/src/lib.rs | 98 +-- 12 files changed, 3010 insertions(+), 610 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 15c9f80..9129009 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,15 +12,31 @@ dependencies = [ "regex", ] +[[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 = "ahash" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", + "zerocopy", ] [[package]] @@ -32,6 +48,60 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + +[[package]] +name = "anstream" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" + +[[package]] +name = "anstyle-parse" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3a318f1f38d2418400f8209655bfd825785afd25aa30bb7ba6cc792e4596748" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "anyhow" version = "1.0.69" @@ -61,18 +131,76 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[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 = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" + +[[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 = "bip39" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" +dependencies = [ + "bitcoin_hashes", + "rand", + "rand_core", + "serde", + "unicode-normalization", +] + +[[package]] +name = "bitcoin_hashes" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4" + [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + [[package]] name = "block-buffer" version = "0.9.0" @@ -108,6 +236,12 @@ dependencies = [ "serde", ] +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + [[package]] name = "byteorder" version = "1.4.3" @@ -115,16 +249,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] -name = "cc" -version = "1.0.79" +name = "bytes" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] -name = "cfg-if" -version = "0.1.10" +name = "cc" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-if" @@ -134,40 +268,49 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.1.4" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" +checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" dependencies = [ - "bitflags", + "clap_builder", "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" +dependencies = [ + "anstream", + "anstyle", "clap_lex", - "is-terminal", - "once_cell", "strsim", - "termcolor", ] [[package]] name = "clap_derive" -version = "4.1.0" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", - "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] name = "clap_lex" -version = "0.3.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" -dependencies = [ - "os_str_bytes", -] +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "colored" @@ -186,15 +329,73 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2382f75942f4b3be3690fe4f86365e9c853c1587d6ee58212cebf6e2a9ccd101" +[[package]] +name = "const-oid" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" + +[[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 = "copy_dir" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "543d1dd138ef086e2ff05e3a48cf9da045da2033d16f8538fd76b86cd49b2ca3" +dependencies = [ + "walkdir", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + [[package]] name = "cpufeatures" -version = "0.2.2" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -205,19 +406,44 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-mac" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +dependencies = [ + "generic-array", + "subtle", +] + [[package]] name = "curve25519-dalek" -version = "3.2.1" +version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.6", + "fiat-crypto", + "platforms", + "rustc_version", "subtle", "zeroize", ] +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + [[package]] name = "datanftmint" version = "1.0.0" @@ -226,6 +452,16 @@ dependencies = [ "multiversx-sc-scenario", ] +[[package]] +name = "der" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "digest" version = "0.9.0" @@ -251,20 +487,30 @@ version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" dependencies = [ - "signature", + "signature 1.6.0", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature 2.1.0", ] [[package]] name = "ed25519-dalek" -version = "1.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" dependencies = [ "curve25519-dalek", - "ed25519", - "rand 0.7.3", + "ed25519 2.2.3", "serde", - "sha2 0.9.9", + "sha2 0.10.6", + "subtle", "zeroize", ] @@ -274,31 +520,57 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if", +] + [[package]] name = "endian-type" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" -version = "0.2.8" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "errno-dragonfly", "libc", - "winapi", + "windows-sys 0.52.0", ] [[package]] -name = "errno-dragonfly" -version = "0.1.2" +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "fiat-crypto" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" + +[[package]] +name = "flate2" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ - "cc", - "libc", + "crc32fast", + "miniz_oxide", ] [[package]] @@ -308,24 +580,85 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "generic-array" -version = "0.14.5" +name = "foreign-types" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "typenum", - "version_check", + "foreign-types-shared", ] [[package]] -name = "getrandom" -version = "0.1.16" +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" + +[[package]] +name = "futures-io" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" + +[[package]] +name = "futures-sink" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" + +[[package]] +name = "futures-task" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" + +[[package]] +name = "futures-util" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +dependencies = [ + "futures-core", + "futures-io", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +dependencies = [ + "typenum", + "version_check", ] [[package]] @@ -334,11 +667,17 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.10.2+wasi-snapshot-preview1", ] +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + [[package]] name = "globset" version = "0.4.10" @@ -352,6 +691,25 @@ dependencies = [ "regex", ] +[[package]] +name = "h2" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 2.1.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -360,11 +718,12 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.13.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ "ahash", + "allocator-api2", ] [[package]] @@ -396,64 +755,149 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-literal" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] -name = "ignore" -version = "0.4.20" +name = "hmac" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" dependencies = [ - "globset", - "lazy_static", - "log", - "memchr", - "regex", - "same-file", - "thread_local", - "walkdir", - "winapi-util", + "crypto-mac", + "digest 0.9.0", ] [[package]] -name = "indexmap" -version = "1.9.2" +name = "http" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ - "autocfg", - "hashbrown 0.12.3", + "bytes", + "fnv", + "itoa", ] [[package]] -name = "io-lifetimes" -version = "1.0.5" +name = "http-body" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ - "libc", - "windows-sys", + "bytes", + "http", + "pin-project-lite", ] [[package]] -name = "is-terminal" -version = "0.4.3" +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ - "hermit-abi 0.3.0", - "io-lifetimes", - "rustix", - "windows-sys", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.4.10", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "ignore" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492" +dependencies = [ + "globset", + "lazy_static", + "log", + "memchr", + "regex", + "same-file", + "thread_local", + "walkdir", + "winapi-util", +] + +[[package]] +name = "indexmap" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", ] +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + [[package]] name = "itertools" -version = "0.10.3" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ "either", ] @@ -464,6 +908,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +[[package]] +name = "js-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +dependencies = [ + "wasm-bindgen", +] + [[package]] name = "keccak" version = "0.1.0" @@ -478,15 +931,25 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.139" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "linux-raw-sys" -version = "0.1.4" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" + +[[package]] +name = "lock_api" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] [[package]] name = "log" @@ -494,7 +957,7 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -504,16 +967,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] -name = "memory_units" -version = "0.4.0" +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[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.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +dependencies = [ + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.48.0", +] [[package]] name = "multiversx-chain-scenario-format" -version = "0.19.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d2592a441608937c5aebec6732c38e6097f58de1dc9a64d7dbe98e0ab97a3c0" +checksum = "c57b56954b133e76bfe77e1f20a903983f25fd24d53b28fe9cc9c9e54f374d2f" dependencies = [ "bech32", "hex", @@ -526,35 +1009,38 @@ dependencies = [ [[package]] name = "multiversx-chain-vm" -version = "0.1.7" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090b068fea4a7b3142226293f511e7e510fa3ae5eac6df079adc5b99cd01827e" +checksum = "6d3c6d36157be3a413daef246de14c8c9465bea53b985941593aa741423722ce" dependencies = [ - "bech32", + "bitflags 1.3.2", "ed25519-dalek", "hex", + "hex-literal", "itertools", - "multiversx-chain-scenario-format", - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-chain-vm-executor", "num-bigint", "num-traits", - "rand 0.8.5", + "rand", "rand_seeder", - "serde", - "serde_json", "sha2 0.10.6", "sha3 0.10.6", ] +[[package]] +name = "multiversx-chain-vm-executor" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b59072fa0624b55ae5ae3fa6bfa91515bbeb4ac440214bc4a509e2c8806d6e9f" + [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75218a09f6b77f272f6a74689c0abc6152588674f7aa264368156cd661245c98" +checksum = "f11b51d6a2ab0218585ed58e100c5ac2218de09490fbfc4243b5ecd0ca7f5cbc" dependencies = [ - "bitflags", - "hashbrown 0.13.2", + "bitflags 1.3.2", + "hashbrown 0.14.3", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", @@ -563,75 +1049,137 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7638cb46a0e99c636fd55443ac534ff0a5fad0bd772e1037fbac9a75e04c3c9" +checksum = "327b0ad1c3477cab0d7c84391439ba302238f738ef3c6e1fcd18e247fba84875" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", "num-bigint", - "wee_alloc", ] [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e976002d51367f16140929c10ee695f95dd8d34c150a45db60d3fcd1328a267a" +checksum = "f444038e0043b8eda816b26952479c2aca3c4a643580f4337f71fb362a586db5" dependencies = [ "hex", "proc-macro2", "quote", - "syn", + "syn 1.0.91", ] [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "768007b88e43df8120efa562bf4e79846b97043db92b860877fa3b7e9af5f771" +checksum = "784f0fc505806102fe6f808b368e12fcb13096dd73c5678f09c5663230724d6f" dependencies = [ "hex", "proc-macro2", "quote", "radix_trie", - "syn", + "syn 1.0.91", ] [[package]] name = "multiversx-sc-meta" -version = "0.39.7" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8fc78a71e8ccd4baa3ef5167a352fc514550fc065205a2315e14b435c57f9de" +checksum = "9b3fad2491d11c6edf3fe131696be31743dc568457c013b2c256e56376da294b" dependencies = [ "clap", "colored", "common-path", + "convert_case", + "copy_dir", + "hex", "lazy_static", "multiversx-sc", "pathdiff", + "reqwest", "ruplacer", "rustc_version", "serde", "serde_json", "toml", + "wasmparser 0.116.1", + "wasmprinter", + "zip", ] [[package]] name = "multiversx-sc-scenario" -version = "0.39.7" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1445663553b6d63c8ff01bbd1f7b23212a3a68615a19f128022096c1895680" +checksum = "285a6021a379c069cce06f5b6ba6b562ea63fb1c1fd252b031993e5f32e9e440" dependencies = [ + "base64 0.13.1", + "bech32", + "clap", "colored", "hex", "itertools", + "log", + "multiversx-chain-scenario-format", "multiversx-chain-vm", + "multiversx-chain-vm-executor", + "multiversx-sc", + "multiversx-sc-meta", + "multiversx-sdk", + "num-bigint", "num-traits", "pathdiff", "serde", "serde_json", "sha2 0.10.6", + "tokio", +] + +[[package]] +name = "multiversx-sdk" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baedd8e9f73ddee5a21964cde188397363c50bd43f1c12ee3dde20d15307cff" +dependencies = [ + "anyhow", + "base64 0.13.1", + "bech32", + "bip39", + "ed25519 1.5.2", + "hex", + "hmac", + "itertools", + "pbkdf2", + "pem", + "rand", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "sha2 0.9.9", + "sha3 0.9.1", + "tokio", + "zeroize", +] + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", ] [[package]] @@ -673,6 +1221,25 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi 0.3.0", + "libc", +] + +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.17.0" @@ -686,10 +1253,71 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] -name = "os_str_bytes" -version = "6.4.1" +name = "openssl" +version = "0.10.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45" +dependencies = [ + "bitflags 2.4.1", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.48.5", +] [[package]] name = "pathdiff" @@ -698,49 +1326,83 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" [[package]] -name = "ppv-lite86" -version = "0.2.16" +name = "pbkdf2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "f05894bce6a1ba4be299d0c5f29563e08af2bc18bb7d48313113bed71e904739" +dependencies = [ + "crypto-mac", +] [[package]] -name = "proc-macro-error" -version = "1.0.4" +name = "pem" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", + "base64 0.13.1", ] [[package]] -name = "proc-macro-error-attr" -version = "1.0.4" +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ - "proc-macro2", - "quote", - "version_check", + "der", + "spki", ] +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + +[[package]] +name = "platforms" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" + +[[package]] +name = "ppv-lite86" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" + [[package]] name = "proc-macro2" -version = "1.0.51" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.18" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -755,19 +1417,6 @@ dependencies = [ "nibble_vec", ] -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - [[package]] name = "rand" version = "0.8.5" @@ -775,18 +1424,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.3", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "rand_chacha", + "rand_core", ] [[package]] @@ -796,16 +1435,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.3", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", + "rand_core", ] [[package]] @@ -814,25 +1444,25 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.6", + "getrandom", ] [[package]] -name = "rand_hc" -version = "0.2.0" +name = "rand_seeder" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +checksum = "cf2890aaef0aa82719a50e808de264f9484b74b442e1a3a0e5ee38243ac40bdb" dependencies = [ - "rand_core 0.5.1", + "rand_core", ] [[package]] -name = "rand_seeder" -version = "0.2.3" +name = "redox_syscall" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2890aaef0aa82719a50e808de264f9484b74b442e1a3a0e5ee38243ac40bdb" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "rand_core 0.6.3", + "bitflags 1.3.2", ] [[package]] @@ -852,6 +1482,44 @@ version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +[[package]] +name = "reqwest" +version = "0.11.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +dependencies = [ + "base64 0.21.5", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "system-configuration", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + [[package]] name = "ruplacer" version = "0.8.1" @@ -867,6 +1535,12 @@ dependencies = [ "regex", ] +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + [[package]] name = "rustc_version" version = "0.4.0" @@ -878,16 +1552,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.8" +version = "0.38.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" +checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a" dependencies = [ - "bitflags", + "bitflags 2.4.1", "errno", - "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -906,29 +1579,67 @@ dependencies = [ ] [[package]] -name = "semver" -version = "1.0.7" +name = "schannel" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d65bd28f48be7196d222d95b9243287f48d27aca604e08497513019ff0502cc4" - +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d65bd28f48be7196d222d95b9243287f48d27aca604e08497513019ff0502cc4" + [[package]] name = "serde" -version = "1.0.136" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.136" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -937,6 +1648,39 @@ version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" dependencies = [ + "indexmap 1.9.2", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_repr" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "serde_spanned" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", "itoa", "ryu", "serde", @@ -949,7 +1693,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.9.0", "opaque-debug", @@ -961,7 +1705,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.6", ] @@ -988,18 +1732,72 @@ dependencies = [ "keccak", ] +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + [[package]] name = "signature" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0ea32af43239f0d353a7dd75a22d94c329c8cdaafdcb4c1c1335aa10c298a4a" +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "strsim" version = "0.10.0" @@ -1024,24 +1822,48 @@ dependencies = [ ] [[package]] -name = "synstructure" -version = "0.12.6" +name = "syn" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", - "syn", - "unicode-xid", + "unicode-ident", ] [[package]] -name = "termcolor" -version = "1.2.0" +name = "system-configuration" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "winapi-util", + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tempfile" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys 0.48.0", ] [[package]] @@ -1053,34 +1875,203 @@ dependencies = [ "once_cell", ] +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2 0.5.5", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-macros" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + [[package]] name = "toml" -version = "0.5.9" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ - "indexmap", + "indexmap 2.1.0", "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", ] +[[package]] +name = "toml_datetime" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +dependencies = [ + "indexmap 2.1.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + [[package]] name = "typenum" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + [[package]] name = "unicode-ident" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + [[package]] name = "unicode-xid" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" @@ -1099,10 +2090,13 @@ dependencies = [ ] [[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" +name = "want" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] [[package]] name = "wasi" @@ -1111,15 +2105,115 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] -name = "wee_alloc" -version = "0.4.5" +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.39", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" + +[[package]] +name = "wasmparser" +version = "0.116.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" +dependencies = [ + "indexmap 2.1.0", + "semver", +] + +[[package]] +name = "wasmparser" +version = "0.118.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95ee9723b928e735d53000dec9eae7b07a60e490c85ab54abb66659fc61bfcd9" +dependencies = [ + "indexmap 2.1.0", + "semver", +] + +[[package]] +name = "wasmprinter" +version = "0.2.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d027eb8294904fc715ac0870cebe6b0271e96b90605ee21511e7565c4ce568c" +dependencies = [ + "anyhow", + "wasmparser 0.118.1", +] + +[[package]] +name = "web-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +dependencies = [ + "js-sys", + "wasm-bindgen", ] [[package]] @@ -1155,87 +2249,189 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[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", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] name = "windows-targets" -version = "0.42.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" 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", + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.42.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" [[package]] name = "windows_i686_msvc" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.42.1" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" [[package]] name = "windows_x86_64_msvc" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] -name = "zeroize" -version = "1.3.0" +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[package]] +name = "winnow" +version = "0.5.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +checksum = "0383266b19108dfc6314a56047aa545a1b4d1be60e799b4dbdd407b56402704b" dependencies = [ - "zeroize_derive", + "memchr", ] [[package]] -name = "zeroize_derive" -version = "1.3.2" +name = "winreg" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "zerocopy" +version = "0.7.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d6f15f7ade05d2a4935e34a457b936c23dc70a05cc1d97133dc99e7a3fe0f0e" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbbad221e3f78500350ecbd7dfa4e63ef945c05f4c61cb7f4d3f84cd0bba649b" dependencies = [ "proc-macro2", "quote", - "syn", - "synstructure", + "syn 2.0.39", +] + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" + +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "byteorder", + "crc32fast", + "crossbeam-utils", + "flate2", ] diff --git a/Cargo.toml b/Cargo.toml index 486a728..7ca5611 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,15 +1,13 @@ -[package] -name = "datanftmint" -version = "1.0.0" -edition = "2021" -publish = false -authors = [ "Ovidiu Damian - Itheum","Bucur David - Itheum","Mark Paul - Itheum"] - -[lib] -path = "src/lib.rs" - -[dependencies.multiversx-sc] -version = "0.39.7" - -[dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +[package] +name = "datanftmint" +version = "1.0.0" +edition = "2021" +publish = false +authors = [ "Ovidiu Damian - Itheum","Bucur David - Itheum","Mark Paul - Itheum"] + +[lib] +path = "src/lib.rs" +[dependencies.multiversx-sc] +version = "0.45.1" +[dev-dependencies.multiversx-sc-scenario] +version = "0.45.1" diff --git a/meta/Cargo.lock b/meta/Cargo.lock index 11afd59..dc32cac 100644 --- a/meta/Cargo.lock +++ b/meta/Cargo.lock @@ -12,15 +12,31 @@ dependencies = [ "regex", ] +[[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 = "ahash" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", + "zerocopy", ] [[package]] @@ -32,6 +48,60 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + +[[package]] +name = "anstream" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" + +[[package]] +name = "anstyle-parse" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3a318f1f38d2418400f8209655bfd825785afd25aa30bb7ba6cc792e4596748" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "anyhow" version = "1.0.69" @@ -61,12 +131,39 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[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 = "base64" +version = "0.21.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" + [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + [[package]] name = "bstr" version = "1.2.0" @@ -78,16 +175,28 @@ dependencies = [ ] [[package]] -name = "cc" -version = "1.0.79" +name = "bumpalo" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] -name = "cfg-if" -version = "0.1.10" +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + +[[package]] +name = "cc" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-if" @@ -97,40 +206,49 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.1.4" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" +checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" dependencies = [ - "bitflags", + "clap_builder", "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" +dependencies = [ + "anstream", + "anstyle", "clap_lex", - "is-terminal", - "once_cell", "strsim", - "termcolor", ] [[package]] name = "clap_derive" -version = "4.1.0" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", - "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] name = "clap_lex" -version = "0.3.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" -dependencies = [ - "os_str_bytes", -] +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "colored" @@ -149,6 +267,58 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2382f75942f4b3be3690fe4f86365e9c853c1587d6ee58212cebf6e2a9ccd101" +[[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 = "copy_dir" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "543d1dd138ef086e2ff05e3a48cf9da045da2033d16f8538fd76b86cd49b2ca3" +dependencies = [ + "walkdir", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + [[package]] name = "datanftmint" version = "1.0.0" @@ -165,31 +335,51 @@ dependencies = [ "multiversx-sc-meta", ] +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if", +] + [[package]] name = "endian-type" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" -version = "0.2.8" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "errno-dragonfly", "libc", - "winapi", + "windows-sys 0.52.0", ] [[package]] -name = "errno-dragonfly" -version = "0.1.2" +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "flate2" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ - "cc", - "libc", + "crc32fast", + "miniz_oxide", ] [[package]] @@ -198,6 +388,84 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" + +[[package]] +name = "futures-io" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" + +[[package]] +name = "futures-sink" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" + +[[package]] +name = "futures-task" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" + +[[package]] +name = "futures-util" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +dependencies = [ + "futures-core", + "futures-io", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + [[package]] name = "globset" version = "0.4.10" @@ -212,18 +480,32 @@ dependencies = [ ] [[package]] -name = "hashbrown" -version = "0.12.3" +name = "h2" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] [[package]] name = "hashbrown" -version = "0.13.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ "ahash", + "allocator-api2", ] [[package]] @@ -255,9 +537,90 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-literal" -version = "0.3.4" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "http" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.4.10", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "idna" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] [[package]] name = "ignore" @@ -278,35 +641,19 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.5" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ - "libc", - "windows-sys", + "equivalent", + "hashbrown", ] [[package]] -name = "is-terminal" -version = "0.4.3" +name = "ipnet" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef" -dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix", - "windows-sys", -] +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "itoa" @@ -314,6 +661,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +[[package]] +name = "js-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +dependencies = [ + "wasm-bindgen", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -322,15 +678,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.139" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "linux-raw-sys" -version = "0.1.4" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" [[package]] name = "log" @@ -338,7 +694,7 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -348,19 +704,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] -name = "memory_units" -version = "0.4.0" +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[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.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75218a09f6b77f272f6a74689c0abc6152588674f7aa264368156cd661245c98" +checksum = "f11b51d6a2ab0218585ed58e100c5ac2218de09490fbfc4243b5ecd0ca7f5cbc" dependencies = [ - "bitflags", - "hashbrown 0.13.2", + "bitflags 1.3.2", + "hashbrown", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", @@ -369,58 +745,82 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7638cb46a0e99c636fd55443ac534ff0a5fad0bd772e1037fbac9a75e04c3c9" +checksum = "327b0ad1c3477cab0d7c84391439ba302238f738ef3c6e1fcd18e247fba84875" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", "num-bigint", - "wee_alloc", ] [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e976002d51367f16140929c10ee695f95dd8d34c150a45db60d3fcd1328a267a" +checksum = "f444038e0043b8eda816b26952479c2aca3c4a643580f4337f71fb362a586db5" dependencies = [ "hex", "proc-macro2", "quote", - "syn", + "syn 1.0.86", ] [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "768007b88e43df8120efa562bf4e79846b97043db92b860877fa3b7e9af5f771" +checksum = "784f0fc505806102fe6f808b368e12fcb13096dd73c5678f09c5663230724d6f" dependencies = [ "hex", "proc-macro2", "quote", "radix_trie", - "syn", + "syn 1.0.86", ] [[package]] name = "multiversx-sc-meta" -version = "0.39.7" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8fc78a71e8ccd4baa3ef5167a352fc514550fc065205a2315e14b435c57f9de" +checksum = "9b3fad2491d11c6edf3fe131696be31743dc568457c013b2c256e56376da294b" dependencies = [ "clap", "colored", "common-path", + "convert_case", + "copy_dir", + "hex", "lazy_static", "multiversx-sc", "pathdiff", + "reqwest", "ruplacer", "rustc_version", "serde", "serde_json", "toml", + "wasmparser 0.116.1", + "wasmprinter", + "zip", +] + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", ] [[package]] @@ -463,61 +863,118 @@ dependencies = [ ] [[package]] -name = "once_cell" -version = "1.17.0" +name = "num_cpus" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi 0.3.1", + "libc", +] [[package]] -name = "os_str_bytes" -version = "6.4.1" +name = "object" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ + "memchr", +] [[package]] -name = "pathdiff" -version = "0.2.1" +name = "once_cell" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] -name = "proc-macro-error" -version = "1.0.4" +name = "openssl" +version = "0.10.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45" dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", + "bitflags 2.4.1", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", ] [[package]] -name = "proc-macro-error-attr" -version = "1.0.4" +name = "openssl-macros" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "version_check", + "syn 2.0.39", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", ] +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + [[package]] name = "proc-macro2" -version = "1.0.51" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.15" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -532,6 +989,15 @@ dependencies = [ "nibble_vec", ] +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "regex" version = "1.7.1" @@ -549,6 +1015,44 @@ version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +[[package]] +name = "reqwest" +version = "0.11.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "system-configuration", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + [[package]] name = "ruplacer" version = "0.8.1" @@ -564,6 +1068,12 @@ dependencies = [ "regex", ] +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + [[package]] name = "rustc_version" version = "0.4.0" @@ -575,16 +1085,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.8" +version = "0.38.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" +checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a" dependencies = [ - "bitflags", + "bitflags 2.4.1", "errno", - "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -602,6 +1111,38 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "security-framework" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "1.0.6" @@ -610,22 +1151,22 @@ checksum = "a4a3381e03edd24287172047536f20cabde766e2cd3e65e6b00fb3af51c4f38d" [[package]] name = "serde" -version = "1.0.136" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.136" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -639,12 +1180,62 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "strsim" version = "0.10.0" @@ -663,12 +1254,48 @@ dependencies = [ ] [[package]] -name = "termcolor" -version = "1.2.0" +name = "syn" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ - "winapi-util", + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tempfile" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys 0.48.0", ] [[package]] @@ -680,28 +1307,183 @@ dependencies = [ "once_cell", ] +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "pin-project-lite", + "socket2 0.5.5", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + [[package]] name = "toml" -version = "0.5.8" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ "indexmap", "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", ] +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + [[package]] name = "unicode-ident" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + [[package]] name = "unicode-xid" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" @@ -720,15 +1502,124 @@ dependencies = [ ] [[package]] -name = "wee_alloc" -version = "0.4.5" +name = "want" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.39", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" + +[[package]] +name = "wasmparser" +version = "0.116.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" +dependencies = [ + "indexmap", + "semver", +] + +[[package]] +name = "wasmparser" +version = "0.118.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95ee9723b928e735d53000dec9eae7b07a60e490c85ab54abb66659fc61bfcd9" +dependencies = [ + "indexmap", + "semver", +] + +[[package]] +name = "wasmprinter" +version = "0.2.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d027eb8294904fc715ac0870cebe6b0271e96b90605ee21511e7565c4ce568c" +dependencies = [ + "anyhow", + "wasmparser 0.118.1", +] + +[[package]] +name = "web-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +dependencies = [ + "js-sys", + "wasm-bindgen", ] [[package]] @@ -764,66 +1655,183 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[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", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", ] [[package]] name = "windows-targets" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 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", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" [[package]] name = "windows_i686_gnu" -version = "0.42.1" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.42.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" [[package]] name = "windows_x86_64_gnu" -version = "0.42.1" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" [[package]] name = "windows_x86_64_msvc" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[package]] +name = "winnow" +version = "0.5.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0383266b19108dfc6314a56047aa545a1b4d1be60e799b4dbdd407b56402704b" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "zerocopy" +version = "0.7.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d6f15f7ade05d2a4935e34a457b936c23dc70a05cc1d97133dc99e7a3fe0f0e" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbbad221e3f78500350ecbd7dfa4e63ef945c05f4c61cb7f4d3f84cd0bba649b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "byteorder", + "crc32fast", + "crossbeam-utils", + "flate2", +] diff --git a/meta/Cargo.toml b/meta/Cargo.toml index 4968750..b9e8d08 100644 --- a/meta/Cargo.toml +++ b/meta/Cargo.toml @@ -1,17 +1,16 @@ -[package] -name = "datanftmint-meta" -version = "1.0.0" -edition = "2021" -publish = false -authors = [ "Ovidiu Damian - Itheum","Bucur David - Itheum","Mark Paul - Itheum"] - -[dev-dependencies] - -[dependencies.datanftmint] -path = ".." - -[dependencies.multiversx-sc] -version = "0.39.7" - -[dependencies.multiversx-sc-meta] -version = "0.39.7" +[package] +name = "datanftmint-meta" +version = "1.0.0" +edition = "2021" +publish = false +authors = [ "Ovidiu Damian - Itheum","Bucur David - Itheum","Mark Paul - Itheum"] + +[dev-dependencies] +[dependencies.datanftmint] +path = ".." + +[dependencies.multiversx-sc] +version = "0.45.1" + +[dependencies.multiversx-sc-meta] +version = "0.45.1" diff --git a/src/errors.rs b/src/errors.rs index a401643..f2d2823 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -33,3 +33,7 @@ pub const ERR_ADDRESS_NOT_IN_COLLECTION_FREEZE_LIST: &str = pub const ERR_ADDRESS_IS_IN_COLLECTION_FREEZE_LIST: &str = "Address is in collection freeze list"; pub const ERR_FIELD_IS_EMPTY: &str = "Field is empty"; pub const ERR_TOO_MANY_CHARS: &str = "Too many characters"; +pub const ERR_ONLY_WITHDRAWAL_ADDRESS_CAN_FREEZE: &str = + "Only withdrawal address can withdraw tokens"; +pub const ERR_WITHDRAWAL_ADDRESS_NOT_SET: &str = "Withdrawal address not set"; +pub const ERR_NOT_ENOUGH_FUNDS: &str = "Not enough funds"; \ No newline at end of file diff --git a/src/events.rs b/src/events.rs index cc38394..b52f8d3 100644 --- a/src/events.rs +++ b/src/events.rs @@ -129,4 +129,15 @@ pub trait EventsModule { #[indexed] token: &EgldOrEsdtTokenIdentifier, #[indexed] price: &BigUint, ); + + #[event("setWithdrawalAddress")] + fn set_withdrawal_address_event(&self, #[indexed] address: &ManagedAddress); + + #[event("withdrawTokens")] + fn withdraw_tokens_event( + &self, + #[indexed] address: &ManagedAddress, + #[indexed] token: &EgldOrEsdtTokenIdentifier, + #[indexed] amount: &BigUint, + ); } diff --git a/src/lib.rs b/src/lib.rs index a84518c..c8cbd77 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,7 +7,7 @@ use crate::{ callbacks::CallbackProxy, errors::{ ERR_ALREADY_IN_WHITELIST, ERR_CONTRACT_ALREADY_INITIALIZED, ERR_DATA_STREAM_IS_EMPTY, - ERR_ISSUE_COST, ERR_NOT_IN_WHITELIST, ERR_WHITELIST_IS_EMPTY, ERR_WRONG_AMOUNT_OF_PAYMENT, + ERR_ISSUE_COST, ERR_NOT_IN_WHITELIST, ERR_WHITELIST_IS_EMPTY, ERR_WRONG_AMOUNT_OF_PAYMENT, ERR_ONLY_WITHDRAWAL_ADDRESS_CAN_FREEZE, ERR_WITHDRAWAL_ADDRESS_NOT_SET, ERR_NOT_ENOUGH_FUNDS, }, storage::DataNftAttributes, }; @@ -63,7 +63,7 @@ pub trait DataNftMint: treasury_address: ManagedAddress, ) { require!(self.token_id().is_empty(), ERR_CONTRACT_ALREADY_INITIALIZED); - let issue_cost = self.call_value().egld_value(); + let issue_cost = self.call_value().egld_value().clone_value(); require!( issue_cost == BigUint::from(5u64) * BigUint::from(10u64).pow(16u32), ERR_ISSUE_COST @@ -325,4 +325,34 @@ pub trait DataNftMint: self.set_administrator_event(&administrator); self.administrator().set(&administrator); } + + #[only_owner] + #[endpoint(setWithdrawalAddress)] + fn set_withdrawal_address(&self, withdrawal_address: ManagedAddress) { + self.set_withdrawal_address_event(&withdrawal_address); + self.withdrawal_address().set(&withdrawal_address); + } + + + #[endpoint(withdraw)] // smart contract must be payable to receive royalties + fn withdraw(&self, token_identifier: EgldOrEsdtTokenIdentifier, nonce: u64, amount:BigUint) { + let caller = self.blockchain().get_caller(); + + + require!(!self.withdrawal_address().is_empty(),ERR_WITHDRAWAL_ADDRESS_NOT_SET); + let withdrawal_address = self.withdrawal_address().get(); + require!(caller == withdrawal_address, ERR_ONLY_WITHDRAWAL_ADDRESS_CAN_FREEZE); + + let balance = self.blockchain().get_sc_balance(&token_identifier, nonce); + + self.require_value_is_positive(&amount); + if balance > BigUint::zero() && amount <= balance { + self.send() + .direct(&withdrawal_address, &token_identifier, nonce, &amount); + + self.withdraw_tokens_event(&caller,&token_identifier, &amount); + } else{ + sc_panic!(ERR_NOT_ENOUGH_FUNDS); + } + } } diff --git a/src/storage.rs b/src/storage.rs index d076c3b..1510080 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -25,6 +25,10 @@ pub trait StorageModule { #[storage_mapper("treasury_address")] fn treasury_address(&self) -> SingleValueMapper; + #[view(getWithdrawalAddress)] + #[storage_mapper("withdrawal_address")] + fn withdrawal_address(&self) -> SingleValueMapper; + // Stores the amount of SFTs that have been created #[view(getMintedTokens)] #[storage_mapper("minted_tokens")] diff --git a/tests/rust_tests.rs b/tests/rust_tests.rs index 2388534..64bb29e 100644 --- a/tests/rust_tests.rs +++ b/tests/rust_tests.rs @@ -19,8 +19,9 @@ use multiversx_sc::{ types::{Address, EsdtLocalRole}, }; +use multiversx_sc_scenario::api::SingleTxApi; use multiversx_sc_scenario::multiversx_chain_vm::tx_mock::TxContextRef; -use multiversx_sc_scenario::testing_framework::{BlockchainStateWrapper, ContractObjWrapper}; +use multiversx_sc_scenario::whitebox_legacy::{BlockchainStateWrapper, ContractObjWrapper}; use multiversx_sc_scenario::*; pub const WASM_PATH: &'static str = "../output/datanftmint.wasm"; @@ -57,6 +58,7 @@ where pub first_user_address: Address, pub second_user_address: Address, pub treasury_address: Address, + pub withdrawal_address: Address, } fn setup_contract( @@ -72,6 +74,7 @@ where let second_user_address = blockchain_wrapper.create_user_account(&rust_biguint!(OWNER_EGLD_BALANCE / 100u128)); let owner_address = blockchain_wrapper.create_user_account(&rust_biguint!(OWNER_EGLD_BALANCE)); + let withdrawal_address = blockchain_wrapper.create_user_account(&rust_biguint!(0u64)); let treasury_address = blockchain_wrapper.create_user_account(&rust_biguint!(OWNER_EGLD_BALANCE / 10u128)); let cf_wrapper = blockchain_wrapper.create_sc_account( @@ -102,6 +105,7 @@ where first_user_address, second_user_address, treasury_address, + withdrawal_address, contract_wrapper: cf_wrapper, } } @@ -1526,9 +1530,9 @@ fn mint_nft_ft_test() { &managed_token_id!(SFT_TICKER), 1u64, ); - let attributes = token_data.decode_attributes::>(); + let attributes = token_data.decode_attributes::>(); - let test_attributes: DataNftAttributes = DataNftAttributes { + let test_attributes: DataNftAttributes = DataNftAttributes { creation_time: attributes.creation_time, creator: managed_address!(first_user_address), data_marshal_url: managed_buffer!(DATA_MARSHAL), @@ -1557,9 +1561,9 @@ fn mint_nft_ft_test() { &managed_token_id!(SFT_TICKER), 2u64, ); - let attributes = token_data.decode_attributes::>(); + let attributes = token_data.decode_attributes::>(); - let test_attributes: DataNftAttributes = DataNftAttributes { + let test_attributes: DataNftAttributes = DataNftAttributes { creation_time: attributes.creation_time, creator: managed_address!(first_user_address), data_marshal_url: managed_buffer!(DATA_MARSHAL), @@ -1872,6 +1876,7 @@ fn url_validation_test() { fn privileges_test() { let mut setup = setup_contract(datanftmint::contract_obj); let b_wrapper = &mut setup.blockchain_wrapper; + let owner_address = &setup.owner_address; let user_address = &setup.first_user_address; let second_user_address = &setup.second_user_address; b_wrapper @@ -1947,6 +1952,15 @@ fn privileges_test() { ) .assert_user_error("Address is not privileged"); + b_wrapper + .execute_tx( + &owner_address, + &setup.contract_wrapper, + &rust_biguint!(5u64 * 10u64.pow(16u32)), + |sc| sc.token_id().set_token_id(managed_token_id!(SFT_TICKER)), + ) + .assert_ok(); + b_wrapper .execute_tx( &user_address, @@ -2820,3 +2834,137 @@ fn wipe_function_test() { }) .assert_ok(); } + + +#[test] // Tests the withdrawal endpoint +fn withdraw_test() { + let mut setup = setup_contract(datanftmint::contract_obj); + let owner_address = &setup.owner_address; + let withdrawal_address = &setup.withdrawal_address; + setup + .blockchain_wrapper + .execute_tx( + &setup.owner_address, + &setup.contract_wrapper, + &rust_biguint!(0u64), + |sc| { + sc.init(); + sc.set_royalties_limits(managed_biguint!(1u64), managed_biguint!(2u64)); + sc.set_max_supply(managed_biguint!(21u64)); + sc.set_is_paused(false); + }, + ) + .assert_ok(); + + setup + .blockchain_wrapper + .execute_tx( + &setup.owner_address, + &setup.contract_wrapper, + &rust_biguint!(0u64), + |sc| { + sc.init(); + assert_eq!(sc.min_royalties().get(), managed_biguint!(1u64)); + assert_eq!(sc.max_royalties().get(), managed_biguint!(2u64)); + assert_eq!(sc.max_supply().get(), managed_biguint!(21u64)); + assert_eq!(sc.whitelist_enabled().get(), true); + assert_eq!(sc.is_paused().get(), true); + }, + ) + .assert_ok(); + + + setup.blockchain_wrapper.set_esdt_balance(setup.contract_wrapper.address_ref(), TOKEN_ID, &rust_biguint!(10_000)); + setup.blockchain_wrapper.set_esdt_balance(setup.contract_wrapper.address_ref(), ANOTHER_TOKEN_ID, &rust_biguint!(10_000)); + setup.blockchain_wrapper.set_egld_balance(setup.contract_wrapper.address_ref(), &rust_biguint!(20_000)); + + + + setup.blockchain_wrapper.execute_tx(&setup.first_user_address,&setup.contract_wrapper, &rust_biguint!(0u64), |sc|{ + sc.withdraw(managed_token_id_wrapped!(TOKEN_ID),0u64, managed_biguint!(10_000u64)); + }).assert_user_error("Withdrawal address not set"); + + setup.blockchain_wrapper.execute_tx(owner_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ + sc.set_withdrawal_address(managed_address!(withdrawal_address)); + }).assert_ok(); + + + + setup.blockchain_wrapper.execute_tx(&setup.first_user_address,&setup.contract_wrapper, &rust_biguint!(0u64), |sc|{ + sc.withdraw(managed_token_id_wrapped!(TOKEN_ID),0u64, managed_biguint!(10_000u64)); + }).assert_user_error("Only withdrawal address can withdraw tokens"); + + + setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ + sc.withdraw(managed_token_id_wrapped!(TOKEN_ID), 0u64, managed_biguint!(12_000u64)); + }).assert_user_error("Not enough funds"); + + + + setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ + sc.withdraw(managed_token_id_wrapped!(ANOTHER_TOKEN_ID), 0u64, managed_biguint!(12_000u64)); + }).assert_user_error("Not enough funds"); + + setup.blockchain_wrapper.set_esdt_balance(setup.contract_wrapper.address_ref(), ANOTHER_TOKEN_ID, &rust_biguint!(10_000)); + + setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ + sc.withdraw(managed_token_id_wrapped!(ANOTHER_TOKEN_ID), 0u64, managed_biguint!(12_000u64)); + }).assert_user_error("Not enough funds"); + + + setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ + sc.withdraw(managed_token_id_wrapped!(ANOTHER_TOKEN_ID), 0u64, managed_biguint!(12_000u64)); + }).assert_user_error("Not enough funds"); + + setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ + sc.withdraw(managed_token_id_wrapped!(ANOTHER_TOKEN_ID), 0u64, managed_biguint!(0u64)); + }).assert_user_error("Value must be higher than zero"); + + + setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ + sc.withdraw(managed_token_id_wrapped!(TOKEN_ID), 0u64, managed_biguint!(5_000u64)); + }).assert_ok(); + + + setup.blockchain_wrapper.check_esdt_balance(&setup.contract_wrapper.address_ref(), TOKEN_ID,&rust_biguint!(5_000u64)); + setup.blockchain_wrapper.check_esdt_balance(&setup.contract_wrapper.address_ref(), ANOTHER_TOKEN_ID, &rust_biguint!(10_000u64)); + setup.blockchain_wrapper.check_egld_balance(&setup.contract_wrapper.address_ref(), &rust_biguint!(20_000u64)); + + + setup.blockchain_wrapper.check_esdt_balance(&withdrawal_address, TOKEN_ID, &rust_biguint!(5_000u64)); + setup.blockchain_wrapper.check_esdt_balance(&withdrawal_address, ANOTHER_TOKEN_ID, &rust_biguint!(0u64)); + setup.blockchain_wrapper.check_egld_balance(&withdrawal_address, &rust_biguint!(0u64)); + + + + setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ + sc.withdraw(managed_token_id_wrapped!(TOKEN_ID), 0u64, managed_biguint!(5_000u64)); + }).assert_ok(); + + + setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ + sc.withdraw(managed_token_id_wrapped!(ANOTHER_TOKEN_ID), 0u64, managed_biguint!(10_000u64)); + }).assert_ok(); + + + setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ + sc.withdraw(managed_egld_token_id!(), 0u64, managed_biguint!(20_000u64)); + }).assert_ok(); + + + + + setup.blockchain_wrapper.check_esdt_balance(&setup.contract_wrapper.address_ref(), TOKEN_ID,&rust_biguint!(0u64)); + setup.blockchain_wrapper.check_esdt_balance(&setup.contract_wrapper.address_ref(), ANOTHER_TOKEN_ID, &rust_biguint!(0u64)); + setup.blockchain_wrapper.check_egld_balance(&setup.contract_wrapper.address_ref(), &rust_biguint!(0u64)); + + + setup.blockchain_wrapper.check_esdt_balance(&withdrawal_address, TOKEN_ID, &rust_biguint!(10_000u64)); + setup.blockchain_wrapper.check_esdt_balance(&withdrawal_address, ANOTHER_TOKEN_ID, &rust_biguint!(10_000u64)); + setup.blockchain_wrapper.check_egld_balance(&withdrawal_address, &rust_biguint!(20_000u64)); + + + + + +} diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index 79402ef..d612bfd 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -4,15 +4,22 @@ version = 3 [[package]] name = "ahash" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", + "zerocopy", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "arrayvec" version = "0.7.2" @@ -31,12 +38,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -52,7 +53,7 @@ dependencies = [ [[package]] name = "datanftmint-wasm" -version = "1.0.0" +version = "0.0.0" dependencies = [ "datanftmint", "multiversx-sc-wasm-adapter", @@ -66,11 +67,12 @@ checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" [[package]] name = "hashbrown" -version = "0.13.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ "ahash", + "allocator-api2", ] [[package]] @@ -81,27 +83,15 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-literal" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" - -[[package]] -name = "libc" -version = "0.2.119" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75218a09f6b77f272f6a74689c0abc6152588674f7aa264368156cd661245c98" +checksum = "f11b51d6a2ab0218585ed58e100c5ac2218de09490fbfc4243b5ecd0ca7f5cbc" dependencies = [ "bitflags", "hashbrown", @@ -113,48 +103,46 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7638cb46a0e99c636fd55443ac534ff0a5fad0bd772e1037fbac9a75e04c3c9" +checksum = "327b0ad1c3477cab0d7c84391439ba302238f738ef3c6e1fcd18e247fba84875" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", - "wee_alloc", ] [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e976002d51367f16140929c10ee695f95dd8d34c150a45db60d3fcd1328a267a" +checksum = "f444038e0043b8eda816b26952479c2aca3c4a643580f4337f71fb362a586db5" dependencies = [ "hex", "proc-macro2", "quote", - "syn", + "syn 1.0.86", ] [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "768007b88e43df8120efa562bf4e79846b97043db92b860877fa3b7e9af5f771" +checksum = "784f0fc505806102fe6f808b368e12fcb13096dd73c5678f09c5663230724d6f" dependencies = [ "hex", "proc-macro2", "quote", "radix_trie", - "syn", + "syn 1.0.86", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59f093466105ea4fc5c8ec577830e9af2a7a08aacbbc0dcd104438379455a94c" +checksum = "5afb8b8cc380eabd82dc8f9b02afbab3dce16fc2b5de1dbc601fcfcf261278ba" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -183,18 +171,18 @@ checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.15" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -226,6 +214,23 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "syn" +version = "2.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + [[package]] name = "unicode-xid" version = "0.2.2" @@ -239,35 +244,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] -name = "wee_alloc" -version = "0.4.5" +name = "zerocopy" +version = "0.7.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" +checksum = "7d6f15f7ade05d2a4935e34a457b936c23dc70a05cc1d97133dc99e7a3fe0f0e" dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", + "zerocopy-derive", ] [[package]] -name = "winapi" -version = "0.3.9" +name = "zerocopy-derive" +version = "0.7.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +checksum = "dbbad221e3f78500350ecbd7dfa4e63ef945c05f4c61cb7f4d3f84cd0bba649b" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "proc-macro2", + "quote", + "syn 2.0.39", ] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index bc70db8..32ec7fe 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -1,27 +1,30 @@ -[package] -name = "datanftmint-wasm" -version = "1.0.0" -edition = "2021" -publish = false -authors = [ "Ovidiu Damian - Itheum","Bucur David - Itheum","Mark Paul - Itheum"] - -[lib] -crate-type = [ "cdylib",] - -[workspace] -members = [ ".",] - -[dev-dependencies] - -[profile.release] -codegen-units = 1 -opt-level = "z" -lto = true -debug = false -panic = "abort" - -[dependencies.datanftmint] -path = ".." - -[dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" \ No newline at end of file +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "datanftmint-wasm" +version = "0.0.0" +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" + +[dependencies.datanftmint] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.45.1" + +[workspace] +members = ["."] diff --git a/wasm/src/lib.rs b/wasm/src/lib.rs index 15f62b8..3973788 100644 --- a/wasm/src/lib.rs +++ b/wasm/src/lib.rs @@ -1,16 +1,19 @@ -// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. +// Code generated by the multiversx-sc build system. DO NOT EDIT. //////////////////////////////////////////////////// ////////////////// AUTO-GENERATED ////////////////// //////////////////////////////////////////////////// // Init: 1 -// Endpoints: 40 +// Endpoints: 43 // Async Callback: 1 -// Total number of exported functions: 42 +// Total number of exported functions: 45 #![no_std] -#![feature(alloc_error_handler, lang_items)] + +// Configuration that works with rustc < 1.73.0. +// TODO: Recommended rustc version: 1.73.0 or newer. +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); @@ -18,46 +21,51 @@ multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { datanftmint ( - initializeContract - setLocalRoles - mint - burn - setTreasuryAddress - setIsPaused - setAntiSpamTax - setWhiteListEnabled - setWhiteListSpots - removeWhiteListSpots - setMintTimeLimit - setRoyaltiesLimits - setMaxSupply - setAdministrator - getTokenId - getTreasuryAddress - getMintedTokens - getAntiSpamTax - getIsPaused - getMaxRoyalties - getMinRoyalties - getMaxSupply - getMintedPerAddress - mintTimeLimit - lastMintTime - getWhiteList - getCollectionFrozenList - getSftsFrozenForAddress - getFrozenCount - isWhiteListEnabled - rolesAreSet - getAdministrator - getUserDataOut - pause - unpause - freeze - unfreeze - freezeSingleNFT - unFreezeSingleNFT - wipeSingleNFT - callBack + init => init + initializeContract => initialize_contract + setLocalRoles => set_local_roles + mint => mint_token + burn => burn_token + setTreasuryAddress => set_treasury_address + setIsPaused => set_is_paused + setAntiSpamTax => set_anti_spam_tax + setWhiteListEnabled => set_whitelist_enabled + setWhiteListSpots => set_whitelist_spots + removeWhiteListSpots => remove_whitelist_spots + setMintTimeLimit => set_mint_time_limit + setRoyaltiesLimits => set_royalties_limits + setMaxSupply => set_max_supply + setAdministrator => set_administrator + setWithdrawalAddress => set_withdrawal_address + withdraw => withdraw + getTokenId => token_id + getTreasuryAddress => treasury_address + getWithdrawalAddress => withdrawal_address + getMintedTokens => minted_tokens + getAntiSpamTax => anti_spam_tax + getIsPaused => is_paused + getMaxRoyalties => max_royalties + getMinRoyalties => min_royalties + getMaxSupply => max_supply + getMintedPerAddress => minted_per_address + mintTimeLimit => mint_time_limit + lastMintTime => last_mint_time + getWhiteList => whitelist + getCollectionFrozenList => frozen_addresses_for_collection + getSftsFrozenForAddress => frozen_sfts_per_address + getFrozenCount => frozen_count + isWhiteListEnabled => whitelist_enabled + rolesAreSet => roles_are_set + getAdministrator => administrator + getUserDataOut => get_user_data_out + pause => pause_collection + unpause => unpause_collection + freeze => freeze_collection_for_address + unfreeze => unfreeze_collection_for_address + freezeSingleNFT => freeze_single_token_for_address + unFreezeSingleNFT => unfreeze_single_token_for_address + wipeSingleNFT => wipe_single_token_for_address ) } + +multiversx_sc_wasm_adapter::async_callback! { datanftmint } From 997a1cff619cf955c3f59bb48379e1c235242e15 Mon Sep 17 00:00:00 2001 From: Bucur David Date: Mon, 11 Dec 2023 11:58:09 +0200 Subject: [PATCH 02/10] fix: verison bump, typo fix and require method abstraction Refs: #68 Signed-off-by: Bucur David --- Cargo.lock | 2 +- Cargo.toml | 2 +- meta/Cargo.lock | 4 ++-- meta/Cargo.toml | 2 +- src/errors.rs | 6 +++--- src/lib.rs | 20 +++++++++++--------- src/requirements.rs | 9 ++++++++- wasm/Cargo.lock | 2 +- 8 files changed, 28 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9129009..9ef99cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -446,7 +446,7 @@ dependencies = [ [[package]] name = "datanftmint" -version = "1.0.0" +version = "1.1.0" dependencies = [ "multiversx-sc", "multiversx-sc-scenario", diff --git a/Cargo.toml b/Cargo.toml index 7ca5611..ad89a81 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "datanftmint" -version = "1.0.0" +version = "1.1.0" edition = "2021" publish = false authors = [ "Ovidiu Damian - Itheum","Bucur David - Itheum","Mark Paul - Itheum"] diff --git a/meta/Cargo.lock b/meta/Cargo.lock index dc32cac..4719309 100644 --- a/meta/Cargo.lock +++ b/meta/Cargo.lock @@ -321,14 +321,14 @@ dependencies = [ [[package]] name = "datanftmint" -version = "1.0.0" +version = "1.1.0" dependencies = [ "multiversx-sc", ] [[package]] name = "datanftmint-meta" -version = "1.0.0" +version = "1.1.0" dependencies = [ "datanftmint", "multiversx-sc", diff --git a/meta/Cargo.toml b/meta/Cargo.toml index b9e8d08..a1b07e2 100644 --- a/meta/Cargo.toml +++ b/meta/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "datanftmint-meta" -version = "1.0.0" +version = "1.1.0" edition = "2021" publish = false authors = [ "Ovidiu Damian - Itheum","Bucur David - Itheum","Mark Paul - Itheum"] diff --git a/src/errors.rs b/src/errors.rs index f2d2823..e7631da 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -33,7 +33,7 @@ pub const ERR_ADDRESS_NOT_IN_COLLECTION_FREEZE_LIST: &str = pub const ERR_ADDRESS_IS_IN_COLLECTION_FREEZE_LIST: &str = "Address is in collection freeze list"; pub const ERR_FIELD_IS_EMPTY: &str = "Field is empty"; pub const ERR_TOO_MANY_CHARS: &str = "Too many characters"; -pub const ERR_ONLY_WITHDRAWAL_ADDRESS_CAN_FREEZE: &str = +pub const ERR_ONLY_WITHDRAWAL_ADDRESS_CAN_WITHDRAW: &str = "Only withdrawal address can withdraw tokens"; -pub const ERR_WITHDRAWAL_ADDRESS_NOT_SET: &str = "Withdrawal address not set"; -pub const ERR_NOT_ENOUGH_FUNDS: &str = "Not enough funds"; \ No newline at end of file +pub const ERR_WITHDRAWAL_ADDRESS_NOT_SET: &str = "Withdrawal address not set"; +pub const ERR_NOT_ENOUGH_FUNDS: &str = "Not enough funds"; diff --git a/src/lib.rs b/src/lib.rs index c8cbd77..fb94f23 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,7 +7,8 @@ use crate::{ callbacks::CallbackProxy, errors::{ ERR_ALREADY_IN_WHITELIST, ERR_CONTRACT_ALREADY_INITIALIZED, ERR_DATA_STREAM_IS_EMPTY, - ERR_ISSUE_COST, ERR_NOT_IN_WHITELIST, ERR_WHITELIST_IS_EMPTY, ERR_WRONG_AMOUNT_OF_PAYMENT, ERR_ONLY_WITHDRAWAL_ADDRESS_CAN_FREEZE, ERR_WITHDRAWAL_ADDRESS_NOT_SET, ERR_NOT_ENOUGH_FUNDS, + ERR_ISSUE_COST, ERR_NOT_ENOUGH_FUNDS, ERR_NOT_IN_WHITELIST, ERR_WHITELIST_IS_EMPTY, + ERR_WITHDRAWAL_ADDRESS_NOT_SET, ERR_WRONG_AMOUNT_OF_PAYMENT, }, storage::DataNftAttributes, }; @@ -333,16 +334,17 @@ pub trait DataNftMint: self.withdrawal_address().set(&withdrawal_address); } - #[endpoint(withdraw)] // smart contract must be payable to receive royalties - fn withdraw(&self, token_identifier: EgldOrEsdtTokenIdentifier, nonce: u64, amount:BigUint) { + fn withdraw(&self, token_identifier: EgldOrEsdtTokenIdentifier, nonce: u64, amount: BigUint) { let caller = self.blockchain().get_caller(); - - require!(!self.withdrawal_address().is_empty(),ERR_WITHDRAWAL_ADDRESS_NOT_SET); + require!( + !self.withdrawal_address().is_empty(), + ERR_WITHDRAWAL_ADDRESS_NOT_SET + ); let withdrawal_address = self.withdrawal_address().get(); - require!(caller == withdrawal_address, ERR_ONLY_WITHDRAWAL_ADDRESS_CAN_FREEZE); - + self.require_is_withdrawal_address(&caller); + let balance = self.blockchain().get_sc_balance(&token_identifier, nonce); self.require_value_is_positive(&amount); @@ -350,8 +352,8 @@ pub trait DataNftMint: self.send() .direct(&withdrawal_address, &token_identifier, nonce, &amount); - self.withdraw_tokens_event(&caller,&token_identifier, &amount); - } else{ + self.withdraw_tokens_event(&caller, &token_identifier, &amount); + } else { sc_panic!(ERR_NOT_ENOUGH_FUNDS); } } diff --git a/src/requirements.rs b/src/requirements.rs index ec8a4d1..aebbae9 100644 --- a/src/requirements.rs +++ b/src/requirements.rs @@ -1,7 +1,7 @@ use crate::errors::{ ERR_FIELD_IS_EMPTY, ERR_MAX_ROYALTIES_TOO_HIGH, ERR_MAX_SUPPLY_EXCEEDED, ERR_MINTING_AND_BURNING_NOT_ALLOWED, ERR_MIN_ROYALTIES_BIGGER_THAN_MAX_ROYALTIES, - ERR_NOT_PRIVILEGED, ERR_NOT_URL, ERR_NOT_WHITELISTED, + ERR_NOT_PRIVILEGED, ERR_NOT_URL, ERR_NOT_WHITELISTED, ERR_ONLY_WITHDRAWAL_ADDRESS_CAN_WITHDRAW, ERR_ROYALTIES_ARE_BIGGER_THAN_MAX_ROYALTIES, ERR_ROYALTIES_ARE_SMALLER_THAN_MIN_ROYALTIES, ERR_SUPPLY_HIGHER_THAN_ZERO, ERR_TOKEN_NOT_ISSUED, ERR_TOO_MANY_CHARS, ERR_URL_INVALID_CHARACTERS, ERR_URL_IS_EMPTY, ERR_URL_TOO_BIG, ERR_URL_TOO_SMALL, @@ -129,4 +129,11 @@ pub trait RequirementsModule: crate::storage::StorageModule { fn require_token_issued(&self) { require!(!self.token_id().is_empty(), ERR_TOKEN_NOT_ISSUED); } + + fn require_is_withdrawal_address(&self, address: &ManagedAddress) { + require!( + &self.withdrawal_address().get() == address, + ERR_ONLY_WITHDRAWAL_ADDRESS_CAN_WITHDRAW + ); + } } diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index d612bfd..242eba8 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -46,7 +46,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "datanftmint" -version = "1.0.0" +version = "1.1.0" dependencies = [ "multiversx-sc", ] From 11dcca212b7c26fb89b1665f2162d4a2d2b4fdc7 Mon Sep 17 00:00:00 2001 From: Bucur David Date: Mon, 11 Dec 2023 12:02:18 +0200 Subject: [PATCH 03/10] refactor: require method abstraction Refs: #68 Signed-off-by: Bucur David --- src/lib.rs | 5 +---- src/requirements.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fb94f23..ab4de96 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -338,10 +338,7 @@ pub trait DataNftMint: fn withdraw(&self, token_identifier: EgldOrEsdtTokenIdentifier, nonce: u64, amount: BigUint) { let caller = self.blockchain().get_caller(); - require!( - !self.withdrawal_address().is_empty(), - ERR_WITHDRAWAL_ADDRESS_NOT_SET - ); + self.require_withdrawal_address_is_set(); let withdrawal_address = self.withdrawal_address().get(); self.require_is_withdrawal_address(&caller); diff --git a/src/requirements.rs b/src/requirements.rs index aebbae9..e6c1ab3 100644 --- a/src/requirements.rs +++ b/src/requirements.rs @@ -5,7 +5,7 @@ use crate::errors::{ ERR_ROYALTIES_ARE_BIGGER_THAN_MAX_ROYALTIES, ERR_ROYALTIES_ARE_SMALLER_THAN_MIN_ROYALTIES, ERR_SUPPLY_HIGHER_THAN_ZERO, ERR_TOKEN_NOT_ISSUED, ERR_TOO_MANY_CHARS, ERR_URL_INVALID_CHARACTERS, ERR_URL_IS_EMPTY, ERR_URL_TOO_BIG, ERR_URL_TOO_SMALL, - ERR_VALUE_MUST_BE_POSITIVE, ERR_WAIT_MORE_TIME, + ERR_VALUE_MUST_BE_POSITIVE, ERR_WAIT_MORE_TIME, ERR_WITHDRAWAL_ADDRESS_NOT_SET, }; multiversx_sc::imports!(); @@ -32,6 +32,13 @@ pub trait RequirementsModule: crate::storage::StorageModule { require!(is_mint_ready, ERR_MINTING_AND_BURNING_NOT_ALLOWED); } + fn require_withdrawal_address_is_set(&self) { + require!( + !self.withdrawal_address().is_empty(), + ERR_WITHDRAWAL_ADDRESS_NOT_SET + ); + } + // Checks whether the address trying to mint is allowed to do so fn require_minting_is_allowed(&self, address: &ManagedAddress, current_time: u64) { let last_mint_time = self.last_mint_time(address).get(); From ebcd9d40352c4251a22df57d8716114ea7635bfa Mon Sep 17 00:00:00 2001 From: Bucur David Date: Mon, 11 Dec 2023 12:02:44 +0200 Subject: [PATCH 04/10] refactor: remove unused import Signed-off-by: Bucur David --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index ab4de96..21a9b6c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,7 +8,7 @@ use crate::{ errors::{ ERR_ALREADY_IN_WHITELIST, ERR_CONTRACT_ALREADY_INITIALIZED, ERR_DATA_STREAM_IS_EMPTY, ERR_ISSUE_COST, ERR_NOT_ENOUGH_FUNDS, ERR_NOT_IN_WHITELIST, ERR_WHITELIST_IS_EMPTY, - ERR_WITHDRAWAL_ADDRESS_NOT_SET, ERR_WRONG_AMOUNT_OF_PAYMENT, + ERR_WRONG_AMOUNT_OF_PAYMENT, }, storage::DataNftAttributes, }; From 3a840ed9704e88cc7f633e842052d95014ed07db Mon Sep 17 00:00:00 2001 From: Bucur David Date: Mon, 11 Dec 2023 19:50:25 +0200 Subject: [PATCH 05/10] refactor: version bump Refs: #68 Signed-off-by: Bucur David --- Cargo.lock | 2 +- Cargo.toml | 2 +- meta/Cargo.toml | 2 +- wasm/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9ef99cd..a0632a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -446,7 +446,7 @@ dependencies = [ [[package]] name = "datanftmint" -version = "1.1.0" +version = "2.0.0" dependencies = [ "multiversx-sc", "multiversx-sc-scenario", diff --git a/Cargo.toml b/Cargo.toml index ad89a81..43fa087 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "datanftmint" -version = "1.1.0" +version = "2.0.0" edition = "2021" publish = false authors = [ "Ovidiu Damian - Itheum","Bucur David - Itheum","Mark Paul - Itheum"] diff --git a/meta/Cargo.toml b/meta/Cargo.toml index a1b07e2..43595c7 100644 --- a/meta/Cargo.toml +++ b/meta/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "datanftmint-meta" -version = "1.1.0" +version = "2.0.0" edition = "2021" publish = false authors = [ "Ovidiu Damian - Itheum","Bucur David - Itheum","Mark Paul - Itheum"] diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index 32ec7fe..e65f91a 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -6,7 +6,7 @@ [package] name = "datanftmint-wasm" -version = "0.0.0" +version = "2.0.0" edition = "2021" publish = false From 55a38035ac7a6424b1ae137ee0d17e5a01f32739 Mon Sep 17 00:00:00 2001 From: Bucur David Date: Wed, 13 Dec 2023 10:03:06 +0200 Subject: [PATCH 06/10] feat: add snippets and upldate readme Refs: #68 Signed-off-by: Bucur David --- README.md | 43 ++++++++++++++++++++++++++++++--- interaction/devnet.snippets.sh | 41 +++++++++++++++++++++++++++++++ interaction/mainnet.snippets.sh | 42 ++++++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bd52f6b..ccd60fe 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,22 @@ Call structure: "setAdministrator" + "@" + administrator hex encoded. Example: "setAdministrator@afb9aa109340a83cdb2129635b060a3a2d67ba2659ad86bf6ef49f948c43572c" +#### setWithdrawalAddress + +```rust + #[endpoint(setWithdrawalAddress)] + fn set_withdrawal_address( + &self, + withdrawal_address: ManagedAddress + ); +``` + +Endpoint that sets the withdrawal address. The withdrawal address is the address that will receive the funds from the smart contract. + +Call structure: "setWithdrawalAddress" + "@" + withdrawal_address hex encoded. + +Example: "setWithdrawalAddress@afb9aa109340a83cdb2129635b060a3a2d67ba2659ad86bf6ef49f948c43572c" + ### Owner and administrator endpoints #### freezeSingleNFT @@ -381,6 +397,25 @@ Call structure: "ESDTTransfer" + "@" + NFT-FT token identifier hex encoded + "@" Example: "ESDTNFTTransfer@4e465446542d373736336637@01@1e@00000000000000000500c72532eb1c8f5e32034b46b5041babade020fdefd5fd@6275726e" +### withdrawal address endpoints + +#### withdraw + +```rust + #[endpoint(withdraw)] + fn withdraw(&self, + token_identifier: &EgldOrEsdtTokenIdentifier, + nonce: u64, + amount: BigUint + ); +``` + +Endpoint that allows the withdrawal address to withdraw funds from the smart contract. The endpoint takes as arguments the token identifier, the nonce of the token and the amount to withdraw. + +Call structure: "withdraw" + "@" + token_identifier hex encoded + "@" + nonce hex encoded + "@" + amount hex encoded. + +Example: "withdraw@4e465446542d373736336637@00@91b77e5e5d9a0000" + ### Views #### getUserDataOut @@ -427,7 +462,7 @@ cargo clean cargo build ``` -- The above should all work without any errors, next you can successfully run the following command to build via mxpy: `mxpy contract build` +- The above should all work without any errors, next you can successfully run the following command to build via mxpy: `mxpy contract build` - mxpy may ask you to install `nodejs` and `wasm-opt` to optimize the build, if so then follow instructions given by mxpy and do this - You can now run the tests. See "How to test" section below - You can now update code as needed @@ -480,16 +515,17 @@ After using that, to deploy one can simply use: After deployment, one can interact with the smart contract and test its functionality. To do so, one can use the interaction snippets already presented above. More explanations can be found about the snippets inside the devnet.snippets file. ### Mainnet Deployment (via Reproducible Builds) + - After the security audit has passed the Mainnet deployment need to be verified to match the version that was audited. This guarantee is given via [Reproducible Builds](https://docs.multiversx.com/developers/reproducible-contract-builds/#how-to-run-a-reproducible-build-using-mxpy) **Step 1 (Final build + Code Hash):** + - Be in the latest `main` branch. On the commit that was audited. Update the cargo.toml files with the correct version. This should match the version we use in our requirements files (i.e Notion). e.g. 1.0.0. you need to update the `cargo.toml` files in the root folder, wasm folder and meta folder. - In the `cargo.toml` files make sure you set the correct `edition`. i.e. edition = "2021" - As the `cargo.toml` files has been updated. Build locally as normal. i.e. see "how to build" above and also run tests as per "how to test". This will reflect the `cargo.toml` update in the linked cargo.lock files and produces the final local meta build files to keep the final github check-in and version tagging perfect. - **Step 2 (Final build + Code Hash):** Once the main commit is locked in, we can then produce the code hash and build to deploy to devnet 1st (for final testing) and then to mainnet (after sending the code hash to the auditor) @@ -505,7 +541,7 @@ This process may take some time. After it's done you should see "Docker build ra You can then share the auditor the code hash. The auditor will follow the same steps and compare the code hash with yours. If they match, we will be good to go! -Note that "output-docker" folder should not be check-into GIT. +Note that "output-docker" folder should not be check-into GIT. **Step 4 (Send Code Hash to auditor to verify against devnet and give us all final clear):** We should have got this final clear in Step 2, but we still do a final check here. @@ -516,7 +552,6 @@ We should have got this final clear in Step 2, but we still do a final check her **Step 6 (Deploy SC to Mainnet):** - ## Contributing Feel free the contact the development team if you wish to contribute or if you have any questions. If you find any issues, please report them in the Issues sections of the repository. You can also create your own pull requests which will be analyzed by the team. diff --git a/interaction/devnet.snippets.sh b/interaction/devnet.snippets.sh index ca8b466..d62531b 100644 --- a/interaction/devnet.snippets.sh +++ b/interaction/devnet.snippets.sh @@ -366,6 +366,47 @@ setAdministrator(){ --send || return } + +setWithdrawalAddress(){ + # $1 = address + + address="0x$(mxpy wallet bech32 --decode ${1})" + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --pem=${WALLET} \ + --gas-limit=3000000 \ + --function "setWithdrawalAddress" \ + --arguments $address \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --send || return + +} + + +withdraw(){ + # $1 = token identifier + # $2 = nonce + # $3 = amount + + token_identifier="0x$(echo -n ${1} | xxd -p -u | tr -d '\n')" + nonce=${2} + amount=${3} + + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --pem=${WALLET} \ + --gas-limit=3000000 \ + --function "withdraw" \ + --arguments $token_identifier $nonce $amount \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --send || return +} + + mintTokenUsingEsdt(){ # $1 = amount of esdt to send # $2 = name diff --git a/interaction/mainnet.snippets.sh b/interaction/mainnet.snippets.sh index 804ac1c..35474e2 100644 --- a/interaction/mainnet.snippets.sh +++ b/interaction/mainnet.snippets.sh @@ -355,6 +355,48 @@ setAdministratorMainnet(){ --send || return } + +setWithdrawalAddressMainnet(){ + # $1 = address + + address="0x$(mxpy wallet bech32 --decode ${1})" + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=6000000 \ + --function "setWithdrawalAddress" \ + --arguments $address \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +} + + + +withdrawMainnet(){ + # $1 = token identifier + # $2 = nonce + # $3 = amount + + token_identifier="0x$(echo -n ${1} | xxd -p -u | tr -d '\n')" + nonce=${2} + amount=${3} + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=6000000 \ + --function "withdraw" \ + --arguments $token_identifier $nonce $amount \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +} + + mintTokenUsingEsdtMainnet(){ # $1 = amount of esdt to send # $2 = name From 0e38d8fa17b4f44aadb49637190c3087dadb4c01 Mon Sep 17 00:00:00 2001 From: Bucur David Date: Thu, 14 Dec 2023 08:14:38 +0200 Subject: [PATCH 07/10] fix: url check method ugprade to fix 'Memory allocation forbidden' Refs: #68 Signed-off-by: Bucur David --- src/requirements.rs | 31 +++-- tests/rust_tests.rs | 325 +++++++++++++++++++++++++++++++++----------- 2 files changed, 263 insertions(+), 93 deletions(-) diff --git a/src/requirements.rs b/src/requirements.rs index e6c1ab3..c6a8753 100644 --- a/src/requirements.rs +++ b/src/requirements.rs @@ -97,19 +97,24 @@ pub trait RequirementsModule: crate::storage::StorageModule { // Checks whether the URL passed is valid (characters, starts with https://) fn require_url_is_valid(&self, url: &ManagedBuffer) { - let url_length = url.len(); - let starts_with: &[u8] = b"https://"; - self.require_url_is_adequate_length(url); - let url_vec = url.to_boxed_bytes().into_vec(); - for i in 0..starts_with.len() { - require!(url_vec[i] == starts_with[i], ERR_NOT_URL); - } - for i in 0..url_length { - require!( - url_vec[i] > 32 && url_vec[i] < 127, - ERR_URL_INVALID_CHARACTERS - ) - } + // Define a closure to perform the URL validation + let validation_closure = |url_bytes: &[u8]| { + let starts_with: &[u8] = b"https://"; + + for i in 0..starts_with.len() { + require!(url_bytes[i] == starts_with[i], ERR_NOT_URL); + } + + for i in 0..url_bytes.len() { + require!( + url_bytes[i] > 32 && url_bytes[i] < 127, + ERR_URL_INVALID_CHARACTERS + ) + } + }; + + // Use the with_buffer_contents function to apply the closure + url.with_buffer_contents(validation_closure); } // Checks whether the URL passed has a valid length diff --git a/tests/rust_tests.rs b/tests/rust_tests.rs index 64bb29e..e360716 100644 --- a/tests/rust_tests.rs +++ b/tests/rust_tests.rs @@ -1843,7 +1843,7 @@ fn url_validation_test() { b_wrapper .execute_query(&setup.contract_wrapper, |sc| { - sc.require_url_is_valid(&managed_buffer!(&[ + sc.require_url_is_adequate_length(&managed_buffer!(&[ SFT_TICKER, DATA_MARSHAL, DATA_STREAM, @@ -2835,12 +2835,11 @@ fn wipe_function_test() { .assert_ok(); } - #[test] // Tests the withdrawal endpoint fn withdraw_test() { let mut setup = setup_contract(datanftmint::contract_obj); let owner_address = &setup.owner_address; - let withdrawal_address = &setup.withdrawal_address; + let withdrawal_address = &setup.withdrawal_address; setup .blockchain_wrapper .execute_tx( @@ -2873,98 +2872,264 @@ fn withdraw_test() { ) .assert_ok(); + setup.blockchain_wrapper.set_esdt_balance( + setup.contract_wrapper.address_ref(), + TOKEN_ID, + &rust_biguint!(10_000), + ); + setup.blockchain_wrapper.set_esdt_balance( + setup.contract_wrapper.address_ref(), + ANOTHER_TOKEN_ID, + &rust_biguint!(10_000), + ); + setup + .blockchain_wrapper + .set_egld_balance(setup.contract_wrapper.address_ref(), &rust_biguint!(20_000)); - setup.blockchain_wrapper.set_esdt_balance(setup.contract_wrapper.address_ref(), TOKEN_ID, &rust_biguint!(10_000)); - setup.blockchain_wrapper.set_esdt_balance(setup.contract_wrapper.address_ref(), ANOTHER_TOKEN_ID, &rust_biguint!(10_000)); - setup.blockchain_wrapper.set_egld_balance(setup.contract_wrapper.address_ref(), &rust_biguint!(20_000)); - - - - setup.blockchain_wrapper.execute_tx(&setup.first_user_address,&setup.contract_wrapper, &rust_biguint!(0u64), |sc|{ - sc.withdraw(managed_token_id_wrapped!(TOKEN_ID),0u64, managed_biguint!(10_000u64)); - }).assert_user_error("Withdrawal address not set"); - - setup.blockchain_wrapper.execute_tx(owner_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ - sc.set_withdrawal_address(managed_address!(withdrawal_address)); - }).assert_ok(); - - - - setup.blockchain_wrapper.execute_tx(&setup.first_user_address,&setup.contract_wrapper, &rust_biguint!(0u64), |sc|{ - sc.withdraw(managed_token_id_wrapped!(TOKEN_ID),0u64, managed_biguint!(10_000u64)); - }).assert_user_error("Only withdrawal address can withdraw tokens"); - - - setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ - sc.withdraw(managed_token_id_wrapped!(TOKEN_ID), 0u64, managed_biguint!(12_000u64)); - }).assert_user_error("Not enough funds"); - - - - setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ - sc.withdraw(managed_token_id_wrapped!(ANOTHER_TOKEN_ID), 0u64, managed_biguint!(12_000u64)); - }).assert_user_error("Not enough funds"); - - setup.blockchain_wrapper.set_esdt_balance(setup.contract_wrapper.address_ref(), ANOTHER_TOKEN_ID, &rust_biguint!(10_000)); - - setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ - sc.withdraw(managed_token_id_wrapped!(ANOTHER_TOKEN_ID), 0u64, managed_biguint!(12_000u64)); - }).assert_user_error("Not enough funds"); - - - setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ - sc.withdraw(managed_token_id_wrapped!(ANOTHER_TOKEN_ID), 0u64, managed_biguint!(12_000u64)); - }).assert_user_error("Not enough funds"); - - setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ - sc.withdraw(managed_token_id_wrapped!(ANOTHER_TOKEN_ID), 0u64, managed_biguint!(0u64)); - }).assert_user_error("Value must be higher than zero"); - - - setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ - sc.withdraw(managed_token_id_wrapped!(TOKEN_ID), 0u64, managed_biguint!(5_000u64)); - }).assert_ok(); - - - setup.blockchain_wrapper.check_esdt_balance(&setup.contract_wrapper.address_ref(), TOKEN_ID,&rust_biguint!(5_000u64)); - setup.blockchain_wrapper.check_esdt_balance(&setup.contract_wrapper.address_ref(), ANOTHER_TOKEN_ID, &rust_biguint!(10_000u64)); - setup.blockchain_wrapper.check_egld_balance(&setup.contract_wrapper.address_ref(), &rust_biguint!(20_000u64)); - - - setup.blockchain_wrapper.check_esdt_balance(&withdrawal_address, TOKEN_ID, &rust_biguint!(5_000u64)); - setup.blockchain_wrapper.check_esdt_balance(&withdrawal_address, ANOTHER_TOKEN_ID, &rust_biguint!(0u64)); - setup.blockchain_wrapper.check_egld_balance(&withdrawal_address, &rust_biguint!(0u64)); - + setup + .blockchain_wrapper + .execute_tx( + &setup.first_user_address, + &setup.contract_wrapper, + &rust_biguint!(0u64), + |sc| { + sc.withdraw( + managed_token_id_wrapped!(TOKEN_ID), + 0u64, + managed_biguint!(10_000u64), + ); + }, + ) + .assert_user_error("Withdrawal address not set"); + setup + .blockchain_wrapper + .execute_tx( + owner_address, + &setup.contract_wrapper, + &rust_biguint!(0u64), + |sc| { + sc.set_withdrawal_address(managed_address!(withdrawal_address)); + }, + ) + .assert_ok(); - setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ - sc.withdraw(managed_token_id_wrapped!(TOKEN_ID), 0u64, managed_biguint!(5_000u64)); - }).assert_ok(); + setup + .blockchain_wrapper + .execute_tx( + &setup.first_user_address, + &setup.contract_wrapper, + &rust_biguint!(0u64), + |sc| { + sc.withdraw( + managed_token_id_wrapped!(TOKEN_ID), + 0u64, + managed_biguint!(10_000u64), + ); + }, + ) + .assert_user_error("Only withdrawal address can withdraw tokens"); + setup + .blockchain_wrapper + .execute_tx( + withdrawal_address, + &setup.contract_wrapper, + &rust_biguint!(0u64), + |sc| { + sc.withdraw( + managed_token_id_wrapped!(TOKEN_ID), + 0u64, + managed_biguint!(12_000u64), + ); + }, + ) + .assert_user_error("Not enough funds"); - setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ - sc.withdraw(managed_token_id_wrapped!(ANOTHER_TOKEN_ID), 0u64, managed_biguint!(10_000u64)); - }).assert_ok(); + setup + .blockchain_wrapper + .execute_tx( + withdrawal_address, + &setup.contract_wrapper, + &rust_biguint!(0u64), + |sc| { + sc.withdraw( + managed_token_id_wrapped!(ANOTHER_TOKEN_ID), + 0u64, + managed_biguint!(12_000u64), + ); + }, + ) + .assert_user_error("Not enough funds"); + setup.blockchain_wrapper.set_esdt_balance( + setup.contract_wrapper.address_ref(), + ANOTHER_TOKEN_ID, + &rust_biguint!(10_000), + ); - setup.blockchain_wrapper.execute_tx(withdrawal_address, &setup.contract_wrapper, &rust_biguint!(0u64),|sc|{ - sc.withdraw(managed_egld_token_id!(), 0u64, managed_biguint!(20_000u64)); - }).assert_ok(); + setup + .blockchain_wrapper + .execute_tx( + withdrawal_address, + &setup.contract_wrapper, + &rust_biguint!(0u64), + |sc| { + sc.withdraw( + managed_token_id_wrapped!(ANOTHER_TOKEN_ID), + 0u64, + managed_biguint!(12_000u64), + ); + }, + ) + .assert_user_error("Not enough funds"); + setup + .blockchain_wrapper + .execute_tx( + withdrawal_address, + &setup.contract_wrapper, + &rust_biguint!(0u64), + |sc| { + sc.withdraw( + managed_token_id_wrapped!(ANOTHER_TOKEN_ID), + 0u64, + managed_biguint!(12_000u64), + ); + }, + ) + .assert_user_error("Not enough funds"); + setup + .blockchain_wrapper + .execute_tx( + withdrawal_address, + &setup.contract_wrapper, + &rust_biguint!(0u64), + |sc| { + sc.withdraw( + managed_token_id_wrapped!(ANOTHER_TOKEN_ID), + 0u64, + managed_biguint!(0u64), + ); + }, + ) + .assert_user_error("Value must be higher than zero"); - - setup.blockchain_wrapper.check_esdt_balance(&setup.contract_wrapper.address_ref(), TOKEN_ID,&rust_biguint!(0u64)); - setup.blockchain_wrapper.check_esdt_balance(&setup.contract_wrapper.address_ref(), ANOTHER_TOKEN_ID, &rust_biguint!(0u64)); - setup.blockchain_wrapper.check_egld_balance(&setup.contract_wrapper.address_ref(), &rust_biguint!(0u64)); + setup + .blockchain_wrapper + .execute_tx( + withdrawal_address, + &setup.contract_wrapper, + &rust_biguint!(0u64), + |sc| { + sc.withdraw( + managed_token_id_wrapped!(TOKEN_ID), + 0u64, + managed_biguint!(5_000u64), + ); + }, + ) + .assert_ok(); + setup.blockchain_wrapper.check_esdt_balance( + &setup.contract_wrapper.address_ref(), + TOKEN_ID, + &rust_biguint!(5_000u64), + ); + setup.blockchain_wrapper.check_esdt_balance( + &setup.contract_wrapper.address_ref(), + ANOTHER_TOKEN_ID, + &rust_biguint!(10_000u64), + ); + setup.blockchain_wrapper.check_egld_balance( + &setup.contract_wrapper.address_ref(), + &rust_biguint!(20_000u64), + ); - setup.blockchain_wrapper.check_esdt_balance(&withdrawal_address, TOKEN_ID, &rust_biguint!(10_000u64)); - setup.blockchain_wrapper.check_esdt_balance(&withdrawal_address, ANOTHER_TOKEN_ID, &rust_biguint!(10_000u64)); - setup.blockchain_wrapper.check_egld_balance(&withdrawal_address, &rust_biguint!(20_000u64)); + setup.blockchain_wrapper.check_esdt_balance( + &withdrawal_address, + TOKEN_ID, + &rust_biguint!(5_000u64), + ); + setup.blockchain_wrapper.check_esdt_balance( + &withdrawal_address, + ANOTHER_TOKEN_ID, + &rust_biguint!(0u64), + ); + setup + .blockchain_wrapper + .check_egld_balance(&withdrawal_address, &rust_biguint!(0u64)); + setup + .blockchain_wrapper + .execute_tx( + withdrawal_address, + &setup.contract_wrapper, + &rust_biguint!(0u64), + |sc| { + sc.withdraw( + managed_token_id_wrapped!(TOKEN_ID), + 0u64, + managed_biguint!(5_000u64), + ); + }, + ) + .assert_ok(); + setup + .blockchain_wrapper + .execute_tx( + withdrawal_address, + &setup.contract_wrapper, + &rust_biguint!(0u64), + |sc| { + sc.withdraw( + managed_token_id_wrapped!(ANOTHER_TOKEN_ID), + 0u64, + managed_biguint!(10_000u64), + ); + }, + ) + .assert_ok(); + setup + .blockchain_wrapper + .execute_tx( + withdrawal_address, + &setup.contract_wrapper, + &rust_biguint!(0u64), + |sc| { + sc.withdraw(managed_egld_token_id!(), 0u64, managed_biguint!(20_000u64)); + }, + ) + .assert_ok(); + setup.blockchain_wrapper.check_esdt_balance( + &setup.contract_wrapper.address_ref(), + TOKEN_ID, + &rust_biguint!(0u64), + ); + setup.blockchain_wrapper.check_esdt_balance( + &setup.contract_wrapper.address_ref(), + ANOTHER_TOKEN_ID, + &rust_biguint!(0u64), + ); + setup + .blockchain_wrapper + .check_egld_balance(&setup.contract_wrapper.address_ref(), &rust_biguint!(0u64)); + setup.blockchain_wrapper.check_esdt_balance( + &withdrawal_address, + TOKEN_ID, + &rust_biguint!(10_000u64), + ); + setup.blockchain_wrapper.check_esdt_balance( + &withdrawal_address, + ANOTHER_TOKEN_ID, + &rust_biguint!(10_000u64), + ); + setup + .blockchain_wrapper + .check_egld_balance(&withdrawal_address, &rust_biguint!(20_000u64)); } From 982591953bbd1c176ab457f9ab5f10107cdb8fa5 Mon Sep 17 00:00:00 2001 From: Bucur David Date: Thu, 14 Dec 2023 12:41:01 +0200 Subject: [PATCH 08/10] fix: check url length inside the url is valid Signed-off-by: Bucur David --- src/requirements.rs | 1 + tests/rust_tests.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/requirements.rs b/src/requirements.rs index c6a8753..01331d8 100644 --- a/src/requirements.rs +++ b/src/requirements.rs @@ -98,6 +98,7 @@ pub trait RequirementsModule: crate::storage::StorageModule { // Checks whether the URL passed is valid (characters, starts with https://) fn require_url_is_valid(&self, url: &ManagedBuffer) { // Define a closure to perform the URL validation + self.require_url_is_adequate_length(url); let validation_closure = |url_bytes: &[u8]| { let starts_with: &[u8] = b"https://"; diff --git a/tests/rust_tests.rs b/tests/rust_tests.rs index e360716..c6c7d2b 100644 --- a/tests/rust_tests.rs +++ b/tests/rust_tests.rs @@ -1837,13 +1837,13 @@ fn url_validation_test() { b_wrapper .execute_query(&setup.contract_wrapper, |sc| { - sc.require_url_is_adequate_length(&managed_buffer!(b"https://to.sm")); + sc.require_url_is_valid(&managed_buffer!(b"https://to.sm")); }) .assert_user_error("URL length is too small"); b_wrapper .execute_query(&setup.contract_wrapper, |sc| { - sc.require_url_is_adequate_length(&managed_buffer!(&[ + sc.require_url_is_valid(&managed_buffer!(&[ SFT_TICKER, DATA_MARSHAL, DATA_STREAM, From ca20e159e0709e2065df50aeb3ee0c4e6c210ab9 Mon Sep 17 00:00:00 2001 From: Mark Paul Date: Thu, 14 Dec 2023 21:58:27 +1100 Subject: [PATCH 09/10] v2.0 intial merge and local build and deploy and run tests on devnet. docs updates along with version bumps missed on feature branch. Issue detected with into_vec method during onchain runtime and push coming in next --- README.md | 26 ++++++---- interaction/devnet.snippets.sh | 87 ++++++++++++++++----------------- interaction/mainnet.snippets.sh | 85 ++++++++++++++++---------------- meta/Cargo.lock | 4 +- wasm/Cargo.lock | 2 +- wasm/Cargo.toml | 2 +- 6 files changed, 102 insertions(+), 104 deletions(-) diff --git a/README.md b/README.md index ccd60fe..69009a5 100644 --- a/README.md +++ b/README.md @@ -448,12 +448,13 @@ Main view of the contract. Receives an address and a token identifier as argumen This smart contract aims to offer the Elrond community an audited NFT minter smart contract that is easy to use, well documented and secure. -### Setting up dev environment (project development bootstrap) + how to build +### Setting up dev environment (project development bootstrap) + how to build (and upgrade) -- Uses `multiversx-sc-* 0.39.4` SDK libs (see Cargo.toml) -- Building requires minimum **mxpy 6.1.1** (newer version should also work but devs used 6.1.1). Check version using `mxpy --version` -- To build the project, requires minimum Rust version `1.69.0-nightly`. Check your Rust version by running `rustc --version`. To update your Rust, run `rustup update`. To set to nightly run `rustup default nightly` (devs used 1.69.0-nightly) +- Uses `multiversx-sc-* 0.39.4` (starting v2.0.0, we used 0.45.1) SDK libs (see Cargo.toml) +- Building requires minimum **mxpy 6.1.1** (starting v2.0.0, we used mxpy 8.1.2). Check version using `mxpy --version` +- To build the project, requires minimum Rust version `1.69.0-nightly` (staring v2.0.0, we used 1.75.0-nightly). Check your Rust version by running `rustc --version`. To update your Rust, run `rustup update`. To set to nightly run `rustup default nightly` - After you make sure you have the minimum Rust version you can then begin development. After you clone repo and before you run build, deploy or run the tests - follow these steps (most likely only needed the 1st time) +- [Upgrades] Note that when we upgrade smart contract, we should again follow the steps below too as lib version may have changed (but for upgrade I skipped the rustup default nightly cmd and did the others) ``` rustup default nightly @@ -480,15 +481,18 @@ The Smart Contract is structured in 6 files: ### How to test -Prior to running the below, make sure you check section called **Setting up dev environment (project development bootstrap)** above and your dev environment is configured correctly. You also need to run `mxpy contract build` (requires you to be online with internet connection) prior to running tests. - The tests are located in the tests folder, in the rust_tests file. In order to run the tests one can use the command: ```shell - cargo test --package datanftmint --test rust_tests -- --nocapture + cargo test --package datanftmint --test blackbox_tests -- --nocapture // [NOT DONE YET] + cargo test --package datanftmint --test whitebox_tests -- --nocapture // [NOT DONE YET] + + cargo test --package datanftmint --test rust_tests -- --nocapture // [OLD WAY, will work!] ``` -Another way of running the tests is by using the rust-analyzer extension in Visual Studio Code, which is also very helpful for Elrond Smart Contract development. If one has the extension installed, they can go open and go to the top of the rust_tests file and click the Run Tests button. +- Note that in Oct 2023 we moved the Claim contract to blackbox and whitebox testing as recommended by the multiversX dev docs. We have HAVE NOT upgraded this yet for this smart contract so you need to use the OLD WAY + +Another way of running the tests is by using the rust-analyzer extension in Visual Studio Code, which is also very helpful for MultiversX Smart Contract development. If one has the extension installed, they can go open and go to the top of the rust_tests file and click the Run Tests button. Note: In order to run the tests, one has to use the rust nightly version. One can switch to the nightly version by using: @@ -529,7 +533,7 @@ After deployment, one can interact with the smart contract and test its function **Step 2 (Final build + Code Hash):** Once the main commit is locked in, we can then produce the code hash and build to deploy to devnet 1st (for final testing) and then to mainnet (after sending the code hash to the auditor) -1. Make sure your mxpy version is >= 6. +1. Make sure your mxpy version is >= 6 (starting v2.0.0, we used mxpy 8.1.2). 2. If Cargo.lock is in gitignore, remove it, build the contract and make a new commit. Otherwise this step can be skipped. (see Step 1 and repeat if needed) 3. Run the following in the root of the repository (run the latest Docker client in your computer. Used `Docker Desktop 4.18.0 (104112) on MacOX 12.6`): @@ -537,6 +541,8 @@ Once the main commit is locked in, we can then produce the code hash and build t Note that if you already have a output-docker from a previous build and deploy then delete this folder. +Also note that if you are upgrading you may need to use a newer docker `sdk-rust-contract-builder` version. You can see the tags here https://hub.docker.com/r/multiversx/sdk-rust-contract-builder/tags. Starting v2.0.0, we used v5.3.0 for the build to upgrade to. We tested this on devnet before doing it on mainnet. + This process may take some time. After it's done you should see "Docker build ran successfully!". An output-docker folder will be created containing the WASM files built in a reproducible way and artifacts.json containing the code hash of the WASM files. You can then share the auditor the code hash. The auditor will follow the same steps and compare the code hash with yours. If they match, we will be good to go! @@ -550,7 +556,7 @@ We should have got this final clear in Step 2, but we still do a final check her **Step 6 (Tag the commit in the main branch of Github with the version that was deployed. e.g. 1.0.0):** -**Step 6 (Deploy SC to Mainnet):** +**Step 7 (Deploy SC to Mainnet):** ## Contributing diff --git a/interaction/devnet.snippets.sh b/interaction/devnet.snippets.sh index 1950b1d..290f92d 100644 --- a/interaction/devnet.snippets.sh +++ b/interaction/devnet.snippets.sh @@ -2,7 +2,7 @@ PROXY=https://devnet-gateway.multiversx.com CHAIN_ID="D" WALLET="./wallet.pem" -USER="../wallet2.pem" +USER="./wallet2.pem" ADDRESS=$(mxpy data load --key=address-devnet) DEPLOY_TRANSACTION=$(mxpy data load --key=deployTransaction-devnet) @@ -90,9 +90,7 @@ initializeContract(){ --send || return } - -setLocalRoles() -{ +setLocalRoles(){ mxpy --verbose contract call ${ADDRESS} \ --recall-nonce \ --pem=${WALLET} \ @@ -384,47 +382,6 @@ setAdministrator(){ --send || return } - -setWithdrawalAddress(){ - # $1 = address - - address="0x$(mxpy wallet bech32 --decode ${1})" - - mxpy --verbose contract call ${ADDRESS} \ - --recall-nonce \ - --pem=${WALLET} \ - --gas-limit=3000000 \ - --function "setWithdrawalAddress" \ - --arguments $address \ - --proxy ${PROXY} \ - --chain ${CHAIN_ID} \ - --send || return - -} - - -withdraw(){ - # $1 = token identifier - # $2 = nonce - # $3 = amount - - token_identifier="0x$(echo -n ${1} | xxd -p -u | tr -d '\n')" - nonce=${2} - amount=${3} - - - mxpy --verbose contract call ${ADDRESS} \ - --recall-nonce \ - --pem=${WALLET} \ - --gas-limit=3000000 \ - --function "withdraw" \ - --arguments $token_identifier $nonce $amount \ - --proxy ${PROXY} \ - --chain ${CHAIN_ID} \ - --send || return -} - - mintTokenUsingEsdt(){ # $1 = amount of esdt to send # $2 = name @@ -504,4 +461,42 @@ getUserDataOut(){ --proxy ${PROXY} \ --function 'getUserDataOut' \ --arguments $address $token_identifier -} \ No newline at end of file +} + +# v2.0.0 +setWithdrawalAddress(){ + # $1 = address + + address="0x$(mxpy wallet bech32 --decode ${1})" + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --pem=${WALLET} \ + --gas-limit=10000000 \ + --function "setWithdrawalAddress" \ + --arguments $address \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --send || return + +} + +withdraw(){ + # $1 = token identifier + # $2 = nonce + # $3 = amount + + token_identifier="0x$(echo -n ${1} | xxd -p -u | tr -d '\n')" + nonce=${2} + amount=${3} + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --pem=${USER} \ + --gas-limit=10000000 \ + --function "withdraw" \ + --arguments $token_identifier $nonce $amount \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --send || return +} diff --git a/interaction/mainnet.snippets.sh b/interaction/mainnet.snippets.sh index 9ebcd1a..1e21a9c 100644 --- a/interaction/mainnet.snippets.sh +++ b/interaction/mainnet.snippets.sh @@ -53,7 +53,7 @@ upgrade(){ } # if you interact without calling deploy(), then you need to 1st run this to restore the vars from data -restoreDeployDataLedgerMainnet() { +restoreDeployDataLedgerMainnet(){ TRANSACTION=$(mxpy data parse --file="./interaction/deploy-mainnet.interaction.json" --expression="data['emittedTransactionHash']") ADDRESS=$(mxpy data parse --file="./interaction/deploy-mainnet.interaction.json" --expression="data['contractAddress']") @@ -382,48 +382,6 @@ setAdministratorMainnet(){ --send || return } - -setWithdrawalAddressMainnet(){ - # $1 = address - - address="0x$(mxpy wallet bech32 --decode ${1})" - - mxpy --verbose contract call ${ADDRESS} \ - --recall-nonce \ - --gas-limit=6000000 \ - --function "setWithdrawalAddress" \ - --arguments $address \ - --proxy ${PROXY} \ - --chain ${CHAIN_ID} \ - --ledger \ - --ledger-address-index 0 \ - --send || return -} - - - -withdrawMainnet(){ - # $1 = token identifier - # $2 = nonce - # $3 = amount - - token_identifier="0x$(echo -n ${1} | xxd -p -u | tr -d '\n')" - nonce=${2} - amount=${3} - - mxpy --verbose contract call ${ADDRESS} \ - --recall-nonce \ - --gas-limit=6000000 \ - --function "withdraw" \ - --arguments $token_identifier $nonce $amount \ - --proxy ${PROXY} \ - --chain ${CHAIN_ID} \ - --ledger \ - --ledger-address-index 0 \ - --send || return -} - - mintTokenUsingEsdtMainnet(){ # $1 = amount of esdt to send # $2 = name @@ -505,4 +463,43 @@ getUserDataOutMainnet(){ --proxy ${PROXY} \ --function 'getUserDataOut' \ --arguments $address $token_identifier -} \ No newline at end of file +} + +# v2.0.0 +setWithdrawalAddressMainnet(){ + # $1 = address + + address="0x$(mxpy wallet bech32 --decode ${1})" + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=10000000 \ + --function "setWithdrawalAddress" \ + --arguments $address \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +} + +withdrawMainnet(){ + # $1 = token identifier + # $2 = nonce + # $3 = amount + + token_identifier="0x$(echo -n ${1} | xxd -p -u | tr -d '\n')" + nonce=${2} + amount=${3} + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=10000000 \ + --function "withdraw" \ + --arguments $token_identifier $nonce $amount \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +} diff --git a/meta/Cargo.lock b/meta/Cargo.lock index 4719309..cc80c92 100644 --- a/meta/Cargo.lock +++ b/meta/Cargo.lock @@ -321,14 +321,14 @@ dependencies = [ [[package]] name = "datanftmint" -version = "1.1.0" +version = "2.0.0" dependencies = [ "multiversx-sc", ] [[package]] name = "datanftmint-meta" -version = "1.1.0" +version = "2.0.0" dependencies = [ "datanftmint", "multiversx-sc", diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index 242eba8..ad5d1e1 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -46,7 +46,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "datanftmint" -version = "1.1.0" +version = "2.0.0" dependencies = [ "multiversx-sc", ] diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index e65f91a..32ec7fe 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -6,7 +6,7 @@ [package] name = "datanftmint-wasm" -version = "2.0.0" +version = "0.0.0" edition = "2021" publish = false From e8145639b03069119d9ede723cbbb7d3779d0641 Mon Sep 17 00:00:00 2001 From: Mark Paul Date: Fri, 15 Dec 2023 09:29:25 +1100 Subject: [PATCH 10/10] v2.0 simple code refactor to move comment --- src/requirements.rs | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/requirements.rs b/src/requirements.rs index 01331d8..377e1e3 100644 --- a/src/requirements.rs +++ b/src/requirements.rs @@ -97,21 +97,22 @@ pub trait RequirementsModule: crate::storage::StorageModule { // Checks whether the URL passed is valid (characters, starts with https://) fn require_url_is_valid(&self, url: &ManagedBuffer) { - // Define a closure to perform the URL validation - self.require_url_is_adequate_length(url); - let validation_closure = |url_bytes: &[u8]| { - let starts_with: &[u8] = b"https://"; - - for i in 0..starts_with.len() { - require!(url_bytes[i] == starts_with[i], ERR_NOT_URL); - } - - for i in 0..url_bytes.len() { - require!( - url_bytes[i] > 32 && url_bytes[i] < 127, - ERR_URL_INVALID_CHARACTERS - ) - } + self.require_url_is_adequate_length(url); + + // Define a closure to perform the URL validation + let validation_closure = |url_bytes: &[u8]| { + let starts_with: &[u8] = b"https://"; + + for i in 0..starts_with.len() { + require!(url_bytes[i] == starts_with[i], ERR_NOT_URL); + } + + for i in 0..url_bytes.len() { + require!( + url_bytes[i] > 32 && url_bytes[i] < 127, + ERR_URL_INVALID_CHARACTERS + ) + } }; // Use the with_buffer_contents function to apply the closure