diff --git a/Cargo.lock b/Cargo.lock index 60f615f584..a1930f29a5 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,9 +16,9 @@ dependencies = [ name = "abi-tester" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-meta", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -26,15 +26,15 @@ name = "abi-tester-meta" version = "0.0.0" dependencies = [ "abi-tester", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "adder" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -45,7 +45,7 @@ dependencies = [ "clap", "multiversx-sc-snippets", "serde", - "toml 0.7.6", + "toml 0.7.8", ] [[package]] @@ -53,7 +53,24 @@ name = "adder-meta" version = "0.0.0" dependencies = [ "adder", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", +] + +[[package]] +name = "addercaller" +version = "0.0.0" +dependencies = [ + "multiversx-sc 0.41.3", + "multiversx-sc-scenario 0.41.3", + "num-bigint", +] + +[[package]] +name = "addercaller-meta" +version = "0.0.0" +dependencies = [ + "addercaller", + "multiversx-sc-meta 0.41.3", ] [[package]] @@ -95,9 +112,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.4" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" +checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" dependencies = [ "memchr", ] @@ -107,8 +124,8 @@ name = "alloc-features" version = "0.0.0" dependencies = [ "esdt-system-sc-mock", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -116,14 +133,14 @@ name = "alloc-features-meta" version = "0.0.0" dependencies = [ "alloc-features", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "anstream" -version = "0.5.0" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", @@ -135,15 +152,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -159,9 +176,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "2.1.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys", @@ -219,9 +236,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.2" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "base64ct" @@ -234,9 +251,9 @@ name = "basic-features" version = "0.0.0" dependencies = [ "esdt-system-sc-mock", - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -247,7 +264,7 @@ dependencies = [ "clap", "multiversx-sc-snippets", "serde", - "toml 0.7.6", + "toml 0.7.8", ] [[package]] @@ -255,7 +272,7 @@ name = "basic-features-meta" version = "0.0.0" dependencies = [ "basic-features", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -268,8 +285,8 @@ checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" name = "benchmark-common" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -277,8 +294,8 @@ name = "big-float-features" version = "0.0.0" dependencies = [ "esdt-system-sc-mock", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -286,7 +303,7 @@ name = "big-float-features-meta" version = "0.0.0" dependencies = [ "big-float-features", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -296,8 +313,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" dependencies = [ "bitcoin_hashes", - "rand", - "rand_core", + "rand 0.8.5", + "rand_core 0.6.4", "serde", "unicode-normalization", ] @@ -349,9 +366,9 @@ checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" name = "bonding-curve-contract" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -359,14 +376,14 @@ name = "bonding-curve-contract-meta" version = "0.0.0" dependencies = [ "bonding-curve-contract", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "bstr" -version = "1.6.0" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +checksum = "4c2f7349907b712260e64b0afe2f84692af14a454be26187d9df565c7f69266a" dependencies = [ "memchr", "serde", @@ -376,8 +393,8 @@ dependencies = [ name = "builtin-func-features" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -385,26 +402,26 @@ name = "builtin-func-features-meta" version = "0.0.0" dependencies = [ "builtin-func-features", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "bzip2" @@ -427,6 +444,40 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "callee" +version = "0.0.0" +dependencies = [ + "multiversx-sc 0.41.3", + "multiversx-sc-scenario 0.41.3", + "num-bigint", +] + +[[package]] +name = "callee-meta" +version = "0.0.0" +dependencies = [ + "callee", + "multiversx-sc-meta 0.41.3", +] + +[[package]] +name = "caller" +version = "0.0.0" +dependencies = [ + "multiversx-sc 0.41.3", + "multiversx-sc-scenario 0.41.3", + "num-bigint", +] + +[[package]] +name = "caller-meta" +version = "0.0.0" +dependencies = [ + "caller", + "multiversx-sc-meta 0.41.3", +] + [[package]] name = "cc" version = "1.0.83" @@ -447,9 +498,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" name = "check-pause" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", "num-bigint", ] @@ -458,15 +509,15 @@ name = "check-pause-meta" version = "0.0.0" dependencies = [ "check-pause", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "child" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -474,8 +525,8 @@ name = "child-meta" version = "0.0.0" dependencies = [ "child", - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -490,38 +541,36 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.0" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d5f1946157a96594eb2d2c10eb7ad9a2b27518cb3000209dec700c35df9197d" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.4.0" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78116e32a042dd73c2901f0dc30790d20ff3447f3e3472fad359e8c3d282bcd6" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" dependencies = [ "anstream", "anstyle", "clap_lex", - "once_cell", "strsim", ] [[package]] name = "clap_derive" -version = "4.4.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -561,7 +610,7 @@ dependencies = [ "forwarder", "forwarder-queue", "forwarder-raw", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", "promises-features", "proxy-test-first", "proxy-test-second", @@ -647,8 +696,8 @@ name = "crowdfunding-erc20" version = "0.0.0" dependencies = [ "erc20", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -656,7 +705,7 @@ name = "crowdfunding-erc20-meta" version = "0.0.0" dependencies = [ "crowdfunding-erc20", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -664,8 +713,8 @@ name = "crowdfunding-esdt" version = "0.0.0" dependencies = [ "hex", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "num-bigint", "num-traits", ] @@ -675,15 +724,15 @@ name = "crowdfunding-esdt-meta" version = "0.0.0" dependencies = [ "crowdfunding-esdt", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "crypto-bubbles" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -691,7 +740,7 @@ name = "crypto-bubbles-meta" version = "0.0.0" dependencies = [ "crypto-bubbles", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -718,8 +767,8 @@ dependencies = [ name = "crypto-zombies" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -727,14 +776,27 @@ name = "crypto-zombies-meta" version = "0.0.0" dependencies = [ "crypto-zombies", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "curve25519-dalek" -version = "4.0.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f711ade317dd348950a9910f81c5947e3d8907ebd2b83f76203ff1807e6a2bc2" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" dependencies = [ "cfg-if", "cpufeatures", @@ -755,7 +817,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -778,7 +840,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -789,7 +851,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -832,8 +894,8 @@ dependencies = [ name = "digital-cash" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -841,7 +903,7 @@ name = "digital-cash-meta" version = "0.0.0" dependencies = [ "digital-cash", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -863,16 +925,30 @@ dependencies = [ "signature 2.1.0", ] +[[package]] +name = "ed25519-dalek" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek 3.2.0", + "ed25519 1.5.3", + "rand 0.7.3", + "serde", + "sha2 0.9.9", + "zeroize", +] + [[package]] name = "ed25519-dalek" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ - "curve25519-dalek", + "curve25519-dalek 4.1.1", "ed25519 2.2.2", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "zeroize", ] @@ -886,8 +962,8 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" name = "empty" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "num-bigint", ] @@ -896,7 +972,7 @@ name = "empty-meta" version = "0.0.0" dependencies = [ "empty", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -932,7 +1008,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -959,8 +1035,8 @@ name = "erc1155" version = "0.0.0" dependencies = [ "erc1155-user-mock", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -968,8 +1044,8 @@ name = "erc1155-marketplace" version = "0.0.0" dependencies = [ "erc1155", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -977,7 +1053,7 @@ name = "erc1155-marketplace-meta" version = "0.0.0" dependencies = [ "erc1155-marketplace", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -985,15 +1061,15 @@ name = "erc1155-meta" version = "0.0.0" dependencies = [ "erc1155", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "erc1155-user-mock" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1001,15 +1077,15 @@ name = "erc1155-user-mock-meta" version = "0.0.0" dependencies = [ "erc1155-user-mock", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "erc20" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1017,15 +1093,15 @@ name = "erc20-meta" version = "0.0.0" dependencies = [ "erc20", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "erc721" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1033,14 +1109,14 @@ name = "erc721-meta" version = "0.0.0" dependencies = [ "erc721", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "errno" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480" dependencies = [ "errno-dragonfly", "libc", @@ -1062,8 +1138,8 @@ name = "esdt-contract-pair" version = "0.0.0" dependencies = [ "first-contract", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "second-contract", ] @@ -1071,8 +1147,8 @@ dependencies = [ name = "esdt-system-sc-mock" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1080,15 +1156,15 @@ name = "esdt-system-sc-mock-meta" version = "0.0.0" dependencies = [ "esdt-system-sc-mock", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "esdt-transfer-with-fee" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1096,15 +1172,15 @@ name = "esdt-transfer-with-fee-meta" version = "0.0.0" dependencies = [ "esdt-transfer-with-fee", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "factorial" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1112,35 +1188,35 @@ name = "factorial-meta" version = "0.0.0" dependencies = [ "factorial", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "factory-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "order-book-factory", ] [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fiat-crypto" -version = "0.1.20" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" +checksum = "d0870c84016d4b481be5c9f323c24f65e31e901ae618f0e80f4308fb00de1d2d" [[package]] name = "first-contract" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1148,8 +1224,8 @@ name = "first-contract-meta" version = "0.0.0" dependencies = [ "first-contract", - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1196,8 +1272,8 @@ dependencies = [ name = "formatted-message-features" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1205,15 +1281,15 @@ name = "formatted-message-features-meta" version = "0.0.0" dependencies = [ "formatted-message-features", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "forwarder" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "vault", ] @@ -1222,15 +1298,15 @@ name = "forwarder-meta" version = "0.0.0" dependencies = [ "forwarder", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "forwarder-queue" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "multiversx-sc-wasm-adapter", "vault", ] @@ -1240,15 +1316,15 @@ name = "forwarder-queue-meta" version = "0.0.0" dependencies = [ "forwarder-queue", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "forwarder-raw" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1256,16 +1332,16 @@ name = "forwarder-raw-meta" version = "0.0.0" dependencies = [ "forwarder-raw", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "fractional-nfts" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1273,7 +1349,7 @@ name = "fractional-nfts-meta" version = "0.0.0" dependencies = [ "fractional-nfts", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1332,7 +1408,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -1375,6 +1451,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + [[package]] name = "getrandom" version = "0.2.10" @@ -1383,7 +1470,7 @@ checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] @@ -1441,9 +1528,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" [[package]] name = "heck" @@ -1462,9 +1549,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -1619,12 +1706,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.1", ] [[package]] @@ -1646,7 +1733,7 @@ dependencies = [ "multiversx-sc-snippets", "promises-features", "serde", - "toml 0.7.6", + "toml 0.7.8", "vault", ] @@ -1662,7 +1749,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi 0.3.3", "rustix", "windows-sys", ] @@ -1713,7 +1800,7 @@ dependencies = [ name = "kitty" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "random", ] @@ -1723,8 +1810,8 @@ version = "0.0.0" dependencies = [ "kitty", "kitty-ownership", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1732,7 +1819,7 @@ name = "kitty-auction-meta" version = "0.0.0" dependencies = [ "kitty-auction", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1740,8 +1827,8 @@ name = "kitty-genetic-alg" version = "0.0.0" dependencies = [ "kitty", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "random", ] @@ -1750,7 +1837,7 @@ name = "kitty-genetic-alg-meta" version = "0.0.0" dependencies = [ "kitty-genetic-alg", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1759,8 +1846,8 @@ version = "0.0.0" dependencies = [ "kitty", "kitty-genetic-alg", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "random", ] @@ -1769,15 +1856,15 @@ name = "kitty-ownership-meta" version = "0.0.0" dependencies = [ "kitty-ownership", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "large-storage" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1785,7 +1872,7 @@ name = "large-storage-meta" version = "0.0.0" dependencies = [ "large-storage", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1796,17 +1883,17 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "linked-list-repeat" version = "0.0.0" dependencies = [ "benchmark-common", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1814,21 +1901,21 @@ name = "linked-list-repeat-meta" version = "0.0.0" dependencies = [ "linked-list-repeat", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "45786cec4d5e54a224b15cb9f06751883103a27c19c93eda09b0b4f5f08fefac" [[package]] name = "local-esdt-and-nft" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1836,7 +1923,7 @@ name = "local-esdt-and-nft-meta" version = "0.0.0" dependencies = [ "local-esdt-and-nft", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1860,8 +1947,8 @@ name = "lottery-erc20" version = "0.0.0" dependencies = [ "erc20", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1869,15 +1956,15 @@ name = "lottery-erc20-meta" version = "0.0.0" dependencies = [ "lottery-erc20", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "lottery-esdt" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1885,7 +1972,7 @@ name = "lottery-esdt-meta" version = "0.0.0" dependencies = [ "lottery-esdt", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1893,8 +1980,8 @@ name = "managed-map-features" version = "0.0.0" dependencies = [ "esdt-system-sc-mock", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1902,7 +1989,7 @@ name = "managed-map-features-meta" version = "0.0.0" dependencies = [ "managed-map-features", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1910,8 +1997,8 @@ name = "map-repeat" version = "0.0.0" dependencies = [ "benchmark-common", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1919,14 +2006,14 @@ name = "map-repeat-meta" version = "0.0.0" dependencies = [ "map-repeat", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "mime" @@ -1950,7 +2037,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys", ] @@ -1958,8 +2045,8 @@ dependencies = [ name = "multi-contract-features" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1967,7 +2054,7 @@ name = "multi-contract-features-meta" version = "0.0.0" dependencies = [ "multi-contract-features", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1977,9 +2064,9 @@ dependencies = [ "adder", "factorial", "hex", - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", "multiversx-wegld-swap-sc", "num-bigint", "num-traits", @@ -1992,10 +2079,10 @@ dependencies = [ "clap", "multisig", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", "multiversx-sc-snippets", "serde", - "toml 0.7.6", + "toml 0.7.8", ] [[package]] @@ -2003,7 +2090,22 @@ name = "multisig-meta" version = "0.0.0" dependencies = [ "multisig", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", +] + +[[package]] +name = "multiversx-chain-scenario-format" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d2592a441608937c5aebec6732c38e6097f58de1dc9a64d7dbe98e0ab97a3c0" +dependencies = [ + "bech32", + "hex", + "num-bigint", + "num-traits", + "serde", + "serde_json", + "sha3 0.9.1", ] [[package]] @@ -2019,21 +2121,44 @@ dependencies = [ "sha3 0.9.1", ] +[[package]] +name = "multiversx-chain-vm" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212ddb5a9199f5d94d873a30126fb24b9a80383af748911c5dea71595f39a5c7" +dependencies = [ + "bech32", + "ed25519-dalek 1.0.1", + "hex", + "itertools", + "multiversx-chain-scenario-format 0.19.1", + "multiversx-sc 0.41.3", + "multiversx-sc-meta 0.41.3", + "num-bigint", + "num-traits", + "rand 0.8.5", + "rand_seeder", + "serde", + "serde_json", + "sha2 0.10.8", + "sha3 0.10.8", +] + [[package]] name = "multiversx-chain-vm" version = "0.5.2" dependencies = [ "bitflags 1.3.2", - "ed25519-dalek", + "ed25519-dalek 2.0.0", "hex", "hex-literal", "itertools", "multiversx-chain-vm-executor", "num-bigint", "num-traits", - "rand", + "rand 0.8.5", "rand_seeder", - "sha2 0.10.7", + "sha2 0.10.8", "sha3 0.10.8", ] @@ -2059,9 +2184,9 @@ name = "multiversx-price-aggregator-sc" version = "0.43.4" dependencies = [ "arrayvec", - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -2069,8 +2194,22 @@ name = "multiversx-price-aggregator-sc-meta" version = "0.0.0" dependencies = [ "multiversx-price-aggregator-sc", - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", +] + +[[package]] +name = "multiversx-sc" +version = "0.41.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfbe80ec68fedf299dd65469f8999cf3c0f884ffa497122428f08303bcb8b884" +dependencies = [ + "bitflags 1.3.2", + "hashbrown 0.13.2", + "hex-literal", + "multiversx-sc-codec 0.17.2", + "multiversx-sc-derive 0.41.3", + "num-traits", ] [[package]] @@ -2080,20 +2219,43 @@ dependencies = [ "bitflags 1.3.2", "hashbrown 0.13.2", "hex-literal", - "multiversx-sc-codec", - "multiversx-sc-derive", + "multiversx-sc-codec 0.18.1", + "multiversx-sc-derive 0.43.4", "num-traits", ] +[[package]] +name = "multiversx-sc-codec" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d70ea458247d263b7e9fdfb207530b6a530546247139c162450e515c013a18" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive 0.17.2", + "num-bigint", +] + [[package]] name = "multiversx-sc-codec" version = "0.18.1" dependencies = [ "arrayvec", - "multiversx-sc-codec-derive", + "multiversx-sc-codec-derive 0.18.1", "num-bigint", ] +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad6920f80fda67fc60fd51aaa9f83ec7e069470f60a068c81205f9da5d05a30" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "multiversx-sc-codec-derive" version = "0.18.1" @@ -2104,6 +2266,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "multiversx-sc-derive" +version = "0.41.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c2b87d817f2176bf1830bef938884f24267516c334a377e71a96bc18ebb09c1" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn 1.0.109", +] + [[package]] name = "multiversx-sc-derive" version = "0.43.4" @@ -2115,6 +2290,27 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "multiversx-sc-meta" +version = "0.41.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a027febbf84d887b429699cf8cbe2a9d1776d26dee7359d9b7afdc3407e57da0" +dependencies = [ + "clap", + "colored", + "common-path", + "convert_case", + "hex", + "lazy_static", + "multiversx-sc 0.41.3", + "pathdiff", + "ruplacer", + "rustc_version", + "serde", + "serde_json", + "toml 0.5.11", +] + [[package]] name = "multiversx-sc-meta" version = "0.43.4" @@ -2127,7 +2323,7 @@ dependencies = [ "copy_dir", "hex", "lazy_static", - "multiversx-sc", + "multiversx-sc 0.43.4", "pathdiff", "reqwest", "ruplacer", @@ -2146,7 +2342,24 @@ dependencies = [ name = "multiversx-sc-modules" version = "0.43.4" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", +] + +[[package]] +name = "multiversx-sc-scenario" +version = "0.41.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0466020f9dcceaeb5ffe293e07c1eb43d81395170267e1b77445063bf17279cc" +dependencies = [ + "colored", + "hex", + "itertools", + "multiversx-chain-vm 0.3.3", + "num-traits", + "pathdiff", + "serde", + "serde_json", + "sha2 0.10.8", ] [[package]] @@ -2160,18 +2373,18 @@ dependencies = [ "hex", "itertools", "log", - "multiversx-chain-scenario-format", - "multiversx-chain-vm", + "multiversx-chain-scenario-format 0.20.0", + "multiversx-chain-vm 0.5.2", "multiversx-chain-vm-executor", - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", "multiversx-sdk", "num-bigint", "num-traits", "pathdiff", "serde", "serde_json", - "sha2 0.10.7", + "sha2 0.10.8", "tokio", ] @@ -2184,7 +2397,7 @@ dependencies = [ "futures", "hex", "log", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", "multiversx-sdk", "tokio", ] @@ -2193,7 +2406,7 @@ dependencies = [ name = "multiversx-sc-wasm-adapter" version = "0.43.4" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", ] [[package]] @@ -2210,7 +2423,7 @@ dependencies = [ "itertools", "pbkdf2 0.9.0", "pem", - "rand", + "rand 0.8.5", "reqwest", "serde", "serde_json", @@ -2225,17 +2438,17 @@ dependencies = [ name = "multiversx-wegld-swap-sc" version = "0.43.4" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "multiversx-wegld-swap-sc-meta" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", "multiversx-wegld-swap-sc", ] @@ -2245,7 +2458,7 @@ version = "0.0.0" dependencies = [ "bech32", "hex", - "multiversx-sc", + "multiversx-sc 0.43.4", "num-bigint", "num-traits", ] @@ -2272,15 +2485,15 @@ dependencies = [ name = "nft-minter" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "nft-minter-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "nft-minter", ] @@ -2288,15 +2501,15 @@ dependencies = [ name = "nft-storage-prepay" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "nft-storage-prepay-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "nft-storage-prepay", ] @@ -2304,16 +2517,16 @@ dependencies = [ name = "nft-subscription" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "nft-subscription-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "nft-subscription", ] @@ -2349,9 +2562,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] @@ -2362,15 +2575,15 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi 0.3.3", "libc", ] [[package]] name = "object" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] @@ -2389,11 +2602,11 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.56" +version = "0.10.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729b745ad4a5575dd06a3e1af1414bd330ee561c01b3899eb584baeaa8def17e" +checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "cfg-if", "foreign-types", "libc", @@ -2410,7 +2623,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -2421,9 +2634,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.91" +version = "0.9.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" +checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" dependencies = [ "cc", "libc", @@ -2435,23 +2648,23 @@ dependencies = [ name = "order-book-factory" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "order-book-pair" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "pair-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "order-book-pair", ] @@ -2459,15 +2672,15 @@ dependencies = [ name = "panic-message-features" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "panic-message-features-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "panic-message-features", ] @@ -2476,16 +2689,16 @@ name = "parent" version = "0.0.0" dependencies = [ "child", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "parent-meta" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", "parent", ] @@ -2519,7 +2732,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" dependencies = [ "base64ct", - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -2539,15 +2752,15 @@ checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" name = "payable-features" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "payable-features-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "payable-features", ] @@ -2569,7 +2782,7 @@ dependencies = [ "digest 0.10.7", "hmac 0.12.1", "password-hash", - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] @@ -2589,9 +2802,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project-lite" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -2603,15 +2816,15 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" name = "ping-pong-egld" version = "0.0.2" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "ping-pong-egld-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "ping-pong-egld", ] @@ -2633,9 +2846,9 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "platforms" -version = "3.0.2" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" +checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" [[package]] name = "ppv-lite86" @@ -2645,9 +2858,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "5b1106fec09662ec6dd98ccac0f81cef56984d0b49f75c92d8cbad76e20c005c" dependencies = [ "unicode-ident", ] @@ -2656,8 +2869,8 @@ dependencies = [ name = "promises-features" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "vault", ] @@ -2665,7 +2878,7 @@ dependencies = [ name = "promises-features-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "promises-features", ] @@ -2674,15 +2887,15 @@ name = "proxy-pause" version = "0.0.0" dependencies = [ "check-pause", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "proxy-pause-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "proxy-pause", ] @@ -2691,15 +2904,15 @@ name = "proxy-test-first" version = "0.0.0" dependencies = [ "hex-literal", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "proxy-test-first-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "proxy-test-first", ] @@ -2707,15 +2920,15 @@ dependencies = [ name = "proxy-test-second" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "proxy-test-second-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "proxy-test-second", ] @@ -2724,15 +2937,15 @@ name = "queue-repeat" version = "0.0.0" dependencies = [ "benchmark-common", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "queue-repeat-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "queue-repeat", ] @@ -2755,6 +2968,19 @@ 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" @@ -2762,8 +2988,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[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", ] [[package]] @@ -2773,7 +3009,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[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", ] [[package]] @@ -2782,7 +3027,16 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.10", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", ] [[package]] @@ -2791,22 +3045,22 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf2890aaef0aa82719a50e808de264f9484b74b442e1a3a0e5ee38243ac40bdb" dependencies = [ - "rand_core", + "rand_core 0.6.4", ] [[package]] name = "random" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", ] [[package]] name = "recursive-caller" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "vault", ] @@ -2814,7 +3068,7 @@ dependencies = [ name = "recursive-caller-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "recursive-caller", ] @@ -2829,9 +3083,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.3" +version = "1.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff" dependencies = [ "aho-corasick", "memchr", @@ -2841,9 +3095,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.6" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" dependencies = [ "aho-corasick", "memchr", @@ -2852,17 +3106,17 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "reqwest" -version = "0.11.20" +version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", "bytes", "encoding_rs", "futures-core", @@ -2883,6 +3137,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "system-configuration", "tokio", "tokio-native-tls", "tower-service", @@ -2897,28 +3152,27 @@ dependencies = [ name = "rewards-distribution" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "rewards-distribution-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "rewards-distribution", ] [[package]] name = "ruplacer" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1001b63b19333d7a462006c7d281a43ce5c1b3c44cd2a9696ab54b8e9aa7e388" +checksum = "58a26a1b15ff113d31d139357f7422708312978ed69cd5dd47e36d1b80b7eaf3" dependencies = [ "Inflector", "anyhow", - "atty", "clap", "colored", "ignore", @@ -2929,15 +3183,15 @@ dependencies = [ name = "rust-snippets-generator-test" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "rust-snippets-generator-test-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "rust-snippets-generator-test", ] @@ -2949,8 +3203,8 @@ dependencies = [ "basic-features", "forwarder", "hex", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "num-bigint", "num-traits", "vault", @@ -2960,7 +3214,7 @@ dependencies = [ name = "rust-testing-framework-tester-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "rust-testing-framework-tester", ] @@ -2981,9 +3235,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.8" +version = "0.38.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +checksum = "f25469e9ae0f3d0047ca8b93fc56843f38e6774f0914a107ff8b41be8be8e0b7" dependencies = [ "bitflags 2.4.0", "errno", @@ -3026,16 +3280,16 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" name = "second-contract" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "second-contract-meta" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", "second-contract", ] @@ -3066,68 +3320,68 @@ dependencies = [ name = "seed-nft-minter" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "seed-nft-minter-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "seed-nft-minter", ] [[package]] name = "semver" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" [[package]] name = "send-tx-repeat" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "send-tx-repeat-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "send-tx-repeat", ] [[package]] name = "serde" -version = "1.0.186" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f5db24220c009de9bd45e69fb2938f4b6d2df856aa9304ce377b3180f83b7c1" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.186" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad697f7e0b65af4983a4ce8f56ed5b357e8d3c36651bf6a7e13639c17b8e670" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.2", "itoa", "ryu", "serde", @@ -3141,7 +3395,7 @@ checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -3170,23 +3424,23 @@ name = "set-repeat" version = "0.0.0" dependencies = [ "benchmark-common", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "set-repeat-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "set-repeat", ] [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -3208,9 +3462,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -3265,15 +3519,15 @@ name = "single-value-repeat" version = "0.0.0" dependencies = [ "benchmark-common", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "single-value-repeat-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "single-value-repeat", ] @@ -3288,9 +3542,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "socket2" @@ -3304,9 +3558,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" dependencies = [ "libc", "windows-sys", @@ -3326,15 +3580,15 @@ dependencies = [ name = "str-repeat" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "str-repeat-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "str-repeat", ] @@ -3363,15 +3617,36 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "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.0" @@ -3387,31 +3662,82 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" dependencies = [ "winapi-util", ] +[[package]] +name = "test-adder" +version = "0.0.0" +dependencies = [ + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", + "num-bigint", +] + +[[package]] +name = "test-adder-meta" +version = "0.0.0" +dependencies = [ + "multiversx-sc-meta 0.43.4", + "test-adder", +] + +[[package]] +name = "test-testapi" +version = "0.0.0" +dependencies = [ + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", + "num-bigint", +] + +[[package]] +name = "test-testapi-meta" +version = "0.0.0" +dependencies = [ + "multiversx-sc-meta 0.43.4", + "test-testapi", +] + +[[package]] +name = "test_multisig" +version = "0.0.0" +dependencies = [ + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", + "num-bigint", +] + +[[package]] +name = "test_multisig-meta" +version = "0.0.0" +dependencies = [ + "multiversx-sc-meta 0.43.4", + "test_multisig", +] + [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -3426,9 +3752,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.27" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb39ee79a6d8de55f48f2293a830e040392f1c5f16e336bdd1788cd0aadce07" +checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" dependencies = [ "deranged", "serde", @@ -3437,9 +3763,9 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "tinyvec" @@ -3460,15 +3786,15 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" name = "token-release" version = "0.0.1" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "token-release-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "token-release", ] @@ -3486,7 +3812,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.3", + "socket2 0.5.4", "tokio-macros", "windows-sys", ] @@ -3499,7 +3825,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -3514,9 +3840,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" dependencies = [ "bytes", "futures-core", @@ -3538,9 +3864,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" dependencies = [ "serde", "serde_spanned", @@ -3559,11 +3885,11 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.14" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.2", "serde", "serde_spanned", "toml_datetime", @@ -3600,9 +3926,9 @@ dependencies = [ name = "transfer-role-features" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", "vault", ] @@ -3610,7 +3936,7 @@ dependencies = [ name = "transfer-role-features-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "transfer-role-features", ] @@ -3622,9 +3948,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" @@ -3634,9 +3960,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -3655,9 +3981,9 @@ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -3668,17 +3994,17 @@ dependencies = [ name = "use-module" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "use-module-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "use-module", ] @@ -3692,15 +4018,15 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" name = "vault" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "vault-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "vault", ] @@ -3715,15 +4041,15 @@ name = "vec-repeat" version = "0.0.0" dependencies = [ "benchmark-common", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "vec-repeat-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "vec-repeat", ] @@ -3735,9 +4061,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", @@ -3752,6 +4078,12 @@ dependencies = [ "try-lock", ] +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -3779,7 +4111,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", "wasm-bindgen-shared", ] @@ -3813,7 +4145,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3826,19 +4158,19 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasmparser" -version = "0.113.2" +version = "0.113.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0d44fab0bd78404e352f3399324eef76516a4580b52bc9031c60f064e98f3" +checksum = "286049849b5a5bd09a8773171be96824afabffc7cc3df6caaf33a38db6cd07ae" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.2", "semver", ] [[package]] name = "wasmprinter" -version = "0.2.67" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6615a5587149e753bf4b93f90fa3c3f41c88597a7a2da72879afcabeda9648f" +checksum = "537030718ce76e985896e91fe2cac77c1913c8dccd46eaf8ab1a4cd56d824cc3" dependencies = [ "anyhow", "wasmparser", @@ -3872,9 +4204,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -3953,9 +4285,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.15" +version = "0.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +checksum = "037711d82167854aff2018dfd193aa0fef5370f456732f0d5a0c59b0f1b4b907" dependencies = [ "memchr", ] @@ -3975,6 +4307,20 @@ name = "zeroize" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] [[package]] name = "zip" diff --git a/Cargo.toml b/Cargo.toml index ef92a8a7b9..7c3e5928d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -175,4 +175,17 @@ members = [ "contracts/feature-tests/rust-testing-framework-tester/meta", "contracts/feature-tests/use-module", "contracts/feature-tests/use-module/meta", + + "contracts/foundry/addercaller", + "contracts/foundry/addercaller/meta", + "contracts/foundry/callee", + "contracts/foundry/callee/meta", + "contracts/foundry/caller", + "contracts/foundry/caller/meta", + "contracts/foundry/foundrylike", + "contracts/foundry/foundrylike/meta", + "contracts/foundry/test_multisig", + "contracts/foundry/test_multisig/meta", + "contracts/foundry/test_testapi", + "contracts/foundry/test_testapi/meta", ] diff --git a/contracts/foundry/addercaller/.gitignore b/contracts/foundry/addercaller/.gitignore new file mode 100644 index 0000000000..2c76bc983e --- /dev/null +++ b/contracts/foundry/addercaller/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +*/target/ + +# The mxpy output +/output*/ diff --git a/contracts/foundry/addercaller/Cargo.toml b/contracts/foundry/addercaller/Cargo.toml new file mode 100644 index 0000000000..f8a1720718 --- /dev/null +++ b/contracts/foundry/addercaller/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "addercaller" +version = "0.0.0" +authors = [ "you",] +edition = "2018" +publish = false + +[lib] +path = "src/addercaller.rs" + +[dev-dependencies] +num-bigint = "0.4.2" + +[dependencies.multiversx-sc] +version = "0.41.1" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.41.1" diff --git a/contracts/foundry/addercaller/meta/Cargo.toml b/contracts/foundry/addercaller/meta/Cargo.toml new file mode 100644 index 0000000000..e58b36087c --- /dev/null +++ b/contracts/foundry/addercaller/meta/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "addercaller-meta" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[dev-dependencies] + +[dependencies.addercaller] +path = ".." + +[dependencies.multiversx-sc-meta] +version = "0.41.1" diff --git a/contracts/foundry/addercaller/meta/src/main.rs b/contracts/foundry/addercaller/meta/src/main.rs new file mode 100644 index 0000000000..6cbc3497bd --- /dev/null +++ b/contracts/foundry/addercaller/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/contracts/foundry/addercaller/multiversx.json b/contracts/foundry/addercaller/multiversx.json new file mode 100644 index 0000000000..7365539625 --- /dev/null +++ b/contracts/foundry/addercaller/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/contracts/foundry/addercaller/scenarios/addercaller.scen.json b/contracts/foundry/addercaller/scenarios/addercaller.scen.json new file mode 100644 index 0000000000..79cef24783 --- /dev/null +++ b/contracts/foundry/addercaller/scenarios/addercaller.scen.json @@ -0,0 +1,178 @@ +{ + "name": "addercaller", + "comment": "add then check", + "gasSchedule": "v3", + "steps": [ + { + "step": "setState", + "accounts": { + "address:owner": { + "nonce": "1", + "balance": "100000", + "esdt": { + "str:MYESDT": "200" + } + } + }, + "newAddresses": [ + { + "creatorAddress": "address:owner", + "creatorNonce": "1", + "newAddress": "sc:adder" + }, + { + "creatorAddress": "address:owner", + "creatorNonce": "2", + "newAddress": "sc:addercaller" + } + ] + }, + { + "step": "scDeploy", + "id": "deploy adder", + "tx": { + "from": "address:owner", + "contractCode": "file:../../myadder/output/adder.wasm", + "arguments": [ + "5" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scDeploy", + "id": "deploy addercaller", + "tx": { + "from": "address:owner", + "contractCode": "file:../output/addercaller.wasm", + "arguments": [ + "sc:adder" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "call adder", + "tx": { + "from": "address:owner", + "to": "sc:adder", + "function": "add", + "value": "1000", + "arguments": [ + "3" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["8"], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "call addercaller egld", + "tx": { + "from": "address:owner", + "to": "sc:addercaller", + "function": "call_adder", + "value": "1000", + "arguments": [ + "4" + ], + "gasLimit": "15,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["12", "str:added"], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "call addercaller esdt", + "tx": { + "from": "address:owner", + "to": "sc:addercaller", + "function": "call_adder_esdt", + "esdtValue": [ + { + "tokenIdentifier": "str:MYESDT", + "value": "30" + } + ], + "arguments": [ + "5" + ], + "gasLimit": "15,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["17", "str:added-esdt"], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "checkState", + "accounts": { + "address:owner": { + "nonce": "*", + "balance": "98000", + "storage": {}, + "code": "", + "esdt": { + "str:MYESDT": "170" + } + }, + "sc:adder": { + "nonce": "0", + "balance": "1030", + "storage": { + "str:sum": "17" + }, + "code": "file:../../myadder/output/adder.wasm", + "esdt": { + "str:MYESDT": "20" + } + }, + "sc:addercaller": { + "nonce": "0", + "balance": "970", + "storage": { + "str:dest": "sc:adder" + }, + "code": "file:../output/addercaller.wasm", + "esdt": { + "str:MYESDT": "10" + } + } + } + } + ] +} \ No newline at end of file diff --git a/contracts/foundry/addercaller/scenarios/addercaller_out_of_funds.scen.json b/contracts/foundry/addercaller/scenarios/addercaller_out_of_funds.scen.json new file mode 100644 index 0000000000..503fe897b9 --- /dev/null +++ b/contracts/foundry/addercaller/scenarios/addercaller_out_of_funds.scen.json @@ -0,0 +1,69 @@ +{ + "name": "addercaller", + "comment": "add then check", + "gasSchedule": "v3", + "steps": [ + { + "step": "setState", + "accounts": { + "address:owner": { + "nonce": "1", + "balance": "100000", + "esdt": { + "str:MYESDT": "200" + } + } + }, + "newAddresses": [ + { + "creatorAddress": "address:owner", + "creatorNonce": "1", + "newAddress": "sc:adder" + } + ] + }, + { + "step": "scDeploy", + "id": "deploy adder", + "tx": { + "from": "address:owner", + "contractCode": "file:../../myadder/output/adder.wasm", + "arguments": [ + "5" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "call adder: insufficient EGLD balance", + "tx": { + "from": "address:owner", + "to": "sc:adder", + "function": "add", + "value": "1000000", + "arguments": [ + "3" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "7", + "message": "*", + "logs": "*", + "gas": "*", + "refund": "*" + } + } + ] +} \ No newline at end of file diff --git a/contracts/foundry/addercaller/src/addercaller.rs b/contracts/foundry/addercaller/src/addercaller.rs new file mode 100644 index 0000000000..058cbcc71a --- /dev/null +++ b/contracts/foundry/addercaller/src/addercaller.rs @@ -0,0 +1,65 @@ +// A smart contract to test transfer & execute functions +// Initialize the contract with the address of the adder +// The endpoints `call_adder` and `call_adder_esdt` accepts +// tokens in EGLD and ESDT and performs transfer & execute +// to the adder's `add` endpoint. + +#![no_std] + +multiversx_sc::imports!(); + +/// One of the simplest smart contracts possible, +/// it holds a single variable in storage, which anyone can increment. +#[multiversx_sc::contract] +pub trait AdderCaller { + #[storage_mapper("dest")] + fn dest(&self) -> SingleValueMapper; + + #[init] + fn init(&self, dest: &ManagedAddress) { + self.dest().set(dest); + } + + #[endpoint] + #[payable("EGLD")] + fn call_adder(&self, value: BigUint) -> ManagedBuffer { + let mut arg_buffer = ManagedArgBuffer::new(); + arg_buffer.push_arg(value); + + let result = self.send_raw().direct_egld_execute( + &self.dest().get(), + &BigUint::from(30u32), + 5000000, + &ManagedBuffer::from(b"add"), + &arg_buffer, + ); + + match result { + Result::Err(e) => sc_panic!(e), + Result::Ok(_) => ManagedBuffer::from("added"), + } + } + + #[endpoint] + #[payable("MYESDT")] + fn call_adder_esdt(&self, value: BigUint) -> ManagedBuffer { + let mut arg_buffer = ManagedArgBuffer::new(); + arg_buffer.push_arg(value); + + let result = self.send_raw().transfer_esdt_execute( + &self.dest().get(), + &TokenIdentifier::from_esdt_bytes(b"MYESDT"), + &BigUint::from(20u32), + 5000000, + &ManagedBuffer::from(b"add"), + &arg_buffer, + ); + + match result { + Result::Err(e) => sc_panic!(e), + Result::Ok(_) => ManagedBuffer::from("added-esdt"), + } + } +} + +// diff --git a/contracts/foundry/addercaller/wasm/Cargo.lock b/contracts/foundry/addercaller/wasm/Cargo.lock new file mode 100644 index 0000000000..dbef86f558 --- /dev/null +++ b/contracts/foundry/addercaller/wasm/Cargo.lock @@ -0,0 +1,272 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addercaller" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "addercaller-wasm" +version = "0.0.0" +dependencies = [ + "addercaller", + "multiversx-sc-wasm-adapter", +] + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if 1.0.0", + "once_cell", + "version_check", +] + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" + +[[package]] +name = "libc" +version = "0.2.145" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc86cde3ff845662b8f4ef6cb50ea0e20c524eb3d29ae048287e06a1b3fa6a81" + +[[package]] +name = "memory_units" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" + +[[package]] +name = "multiversx-sc" +version = "0.41.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "842795458f7aa56ca04191993628980987baa8558357f708a93514c1b2e9948a" +dependencies = [ + "bitflags", + "hashbrown", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7638cb46a0e99c636fd55443ac534ff0a5fad0bd772e1037fbac9a75e04c3c9" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "wee_alloc", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e976002d51367f16140929c10ee695f95dd8d34c150a45db60d3fcd1328a267a" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.41.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99390a0cc0406e86993772bdf16c6be4e990117f939df94a6a6e2f89d18c4983" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.41.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70852439508cfbbc1d92f11210f76c8c1ca2a8869fe8cbd316c2a82518c58249" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "nibble_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" + +[[package]] +name = "proc-macro2" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4ec6d5fe0b140acb27c9a0444118cf55bfbb4e0b259739429abb4521dd67c16" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type", + "nibble_vec", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wee_alloc" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "memory_units", + "winapi", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[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/contracts/foundry/addercaller/wasm/Cargo.toml b/contracts/foundry/addercaller/wasm/Cargo.toml new file mode 100644 index 0000000000..7ff3a911a4 --- /dev/null +++ b/contracts/foundry/addercaller/wasm/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "addercaller-wasm" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[lib] +crate-type = [ "cdylib",] + +[workspace] +members = [ ".",] + +[dev-dependencies] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" + +[dependencies.addercaller] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.41.1" diff --git a/contracts/foundry/addercaller/wasm/src/lib.rs b/contracts/foundry/addercaller/wasm/src/lib.rs new file mode 100644 index 0000000000..28c0e7e012 --- /dev/null +++ b/contracts/foundry/addercaller/wasm/src/lib.rs @@ -0,0 +1,26 @@ +// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 2 +// Async Callback (empty): 1 +// Total number of exported functions: 4 + +#![no_std] +#![feature(lang_items)] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + addercaller + ( + call_adder + call_adder_esdt + ) +} + +multiversx_sc_wasm_adapter::empty_callback! {} diff --git a/contracts/foundry/callee/.gitignore b/contracts/foundry/callee/.gitignore new file mode 100644 index 0000000000..2c76bc983e --- /dev/null +++ b/contracts/foundry/callee/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +*/target/ + +# The mxpy output +/output*/ diff --git a/contracts/foundry/callee/Cargo.toml b/contracts/foundry/callee/Cargo.toml new file mode 100644 index 0000000000..e95f50054e --- /dev/null +++ b/contracts/foundry/callee/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "callee" +version = "0.0.0" +authors = [ "you",] +edition = "2018" +publish = false + +[lib] +path = "src/callee.rs" + +[dev-dependencies] +num-bigint = "0.4.2" + +[dependencies.multiversx-sc] +version = "0.41.2" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.41.2" diff --git a/contracts/foundry/callee/meta/Cargo.toml b/contracts/foundry/callee/meta/Cargo.toml new file mode 100644 index 0000000000..dcca642d5a --- /dev/null +++ b/contracts/foundry/callee/meta/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "callee-meta" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[dev-dependencies] + +[dependencies.callee] +path = ".." + +[dependencies.multiversx-sc-meta] +version = "0.41.2" diff --git a/contracts/foundry/callee/meta/src/main.rs b/contracts/foundry/callee/meta/src/main.rs new file mode 100644 index 0000000000..29f7b204ed --- /dev/null +++ b/contracts/foundry/callee/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/contracts/foundry/callee/multiversx.json b/contracts/foundry/callee/multiversx.json new file mode 100644 index 0000000000..7365539625 --- /dev/null +++ b/contracts/foundry/callee/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/contracts/foundry/callee/src/callee.rs b/contracts/foundry/callee/src/callee.rs new file mode 100644 index 0000000000..784f1755cf --- /dev/null +++ b/contracts/foundry/callee/src/callee.rs @@ -0,0 +1,21 @@ +#![no_std] + +multiversx_sc::imports!(); + +#[multiversx_sc::contract] +pub trait CalleeContract { + #[init] + fn init(&self) {} + + #[endpoint] + #[payable("EGLD")] + fn fail_if_neg(&self, value: i64) -> ManagedBuffer { + require!(value >= 0, "negative"); + + if value == 0 { + ManagedBuffer::from("zero") + } else { + ManagedBuffer::from("positive") + } + } +} diff --git a/contracts/foundry/callee/wasm/Cargo.lock b/contracts/foundry/callee/wasm/Cargo.lock new file mode 100644 index 0000000000..8686ff683f --- /dev/null +++ b/contracts/foundry/callee/wasm/Cargo.lock @@ -0,0 +1,219 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", +] + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "callee" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "callee-wasm" +version = "0.0.0" +dependencies = [ + "callee", + "multiversx-sc-wasm-adapter", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" + +[[package]] +name = "multiversx-sc" +version = "0.41.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "752eed690b41c060e8766e8f6078a8e3585a01387278c652cf88599255cbc5af" +dependencies = [ + "bitflags", + "hashbrown", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d70ea458247d263b7e9fdfb207530b6a530546247139c162450e515c013a18" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad6920f80fda67fc60fd51aaa9f83ec7e069470f60a068c81205f9da5d05a30" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.41.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "674eb1e50b8bc71898d0b476210856a7bc2a4f21758987413d1ec7837d5dd16c" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.41.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92854d81a7cd14c7ec2389cdb4bf555b7b1bbad84b8f8f4deb5a7c0b6b2c71cc" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "nibble_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "proc-macro2" +version = "1.0.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type", + "nibble_vec", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" diff --git a/contracts/foundry/callee/wasm/Cargo.toml b/contracts/foundry/callee/wasm/Cargo.toml new file mode 100644 index 0000000000..c8c7c7e072 --- /dev/null +++ b/contracts/foundry/callee/wasm/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "callee-wasm" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[lib] +crate-type = [ "cdylib",] + +[workspace] +members = [ ".",] + +[dev-dependencies] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" + +[dependencies.callee] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.41.2" diff --git a/contracts/foundry/callee/wasm/src/lib.rs b/contracts/foundry/callee/wasm/src/lib.rs new file mode 100644 index 0000000000..37408c614d --- /dev/null +++ b/contracts/foundry/callee/wasm/src/lib.rs @@ -0,0 +1,25 @@ +// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 1 +// Async Callback (empty): 1 +// Total number of exported functions: 3 + +#![no_std] +#![feature(lang_items)] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + callee + ( + fail_if_neg + ) +} + +multiversx_sc_wasm_adapter::empty_callback! {} diff --git a/contracts/foundry/caller/.gitignore b/contracts/foundry/caller/.gitignore new file mode 100644 index 0000000000..2c76bc983e --- /dev/null +++ b/contracts/foundry/caller/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +*/target/ + +# The mxpy output +/output*/ diff --git a/contracts/foundry/caller/Cargo.toml b/contracts/foundry/caller/Cargo.toml new file mode 100644 index 0000000000..e4f108cbd1 --- /dev/null +++ b/contracts/foundry/caller/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "caller" +version = "0.0.0" +authors = [ "you",] +edition = "2018" +publish = false + +[lib] +path = "src/caller.rs" + +[dev-dependencies] +num-bigint = "0.4.2" + +[dependencies.multiversx-sc] +version = "0.41.2" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.41.2" diff --git a/contracts/foundry/caller/meta/Cargo.toml b/contracts/foundry/caller/meta/Cargo.toml new file mode 100644 index 0000000000..f6535a1fc9 --- /dev/null +++ b/contracts/foundry/caller/meta/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "caller-meta" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[dev-dependencies] + +[dependencies.caller] +path = ".." + +[dependencies.multiversx-sc-meta] +version = "0.41.2" diff --git a/contracts/foundry/caller/meta/src/main.rs b/contracts/foundry/caller/meta/src/main.rs new file mode 100644 index 0000000000..0e1f1c0a89 --- /dev/null +++ b/contracts/foundry/caller/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/contracts/foundry/caller/multiversx.json b/contracts/foundry/caller/multiversx.json new file mode 100644 index 0000000000..7365539625 --- /dev/null +++ b/contracts/foundry/caller/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/contracts/foundry/caller/scenarios/caller.scen.json b/contracts/foundry/caller/scenarios/caller.scen.json new file mode 100644 index 0000000000..a77f5616fd --- /dev/null +++ b/contracts/foundry/caller/scenarios/caller.scen.json @@ -0,0 +1,185 @@ +{ + "name": "caller", + "steps": [ + { + "step": "externalSteps", + "path": "steps/init.steps.json" + }, + { + "step": "scCall", + "id": "positive", + "comment": "send a positive number with 1k EGLD to caller", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "1000", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "3", + "500" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["str:positive", "str:done"], + "status": "" + } + }, + { + "step": "externalSteps", + "path": "steps/check_1.steps.json" + }, + { + "step": "scCall", + "id": "negative: error message", + "comment": "owner -> caller -> callee wrong func name", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "500", + "arguments": [ + "sc:callee", + "str:fail_if_negative", + "-1", + "250" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "10", + "message": "str:invalid function (not found)", + "out": [] + } + }, + { + "step": "externalSteps", + "path": "steps/check_1.steps.json" + }, + { + "step": "scCall", + "id": "negative: error message", + "comment": "owner -> caller -> callee. callee fails and everything is reverted", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "500", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "-1", + "250" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "10", + "message": "str:error signalled by smartcontract", + "out": [] + } + }, + { + "step": "externalSteps", + "path": "steps/check_1.steps.json" + }, + { + "step": "scCall", + "id": "positive with 0 EGLD", + "comment": "send a positive number with 0 EGLD to caller", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "0", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "3", + "0" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["str:positive", "str:done"], + "status": "" + } + }, + { + "step": "checkState", + "accounts": { + "address:owner": { + "nonce": "*", + "balance": "99000", + "storage": {}, + "code": "" + }, + "sc:caller": { + "nonce": "0", + "balance": "500", + "storage": {}, + "code": "file:../output/caller.wasm" + }, + "sc:callee": { + "nonce": "0", + "balance": "500", + "storage": {}, + "code": "file:../../callee/output/callee.wasm" + } + } + }, + { + "step": "scCall", + "id": "positive with 1 EGLD", + "comment": "send a positive number with an odd number of EGLD to caller", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "1", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "3", + "0" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["str:positive", "str:done"], + "status": "" + } + }, + { + "step": "checkState", + "accounts": { + "address:owner": { + "nonce": "*", + "balance": "98999", + "storage": {}, + "code": "" + }, + "sc:caller": { + "nonce": "0", + "balance": "501", + "storage": {}, + "code": "file:../output/caller.wasm" + }, + "sc:callee": { + "nonce": "0", + "balance": "500", + "storage": {}, + "code": "file:../../callee/output/callee.wasm" + } + } + } + + ] +} \ No newline at end of file diff --git a/contracts/foundry/caller/scenarios/errors.scen.json b/contracts/foundry/caller/scenarios/errors.scen.json new file mode 100644 index 0000000000..097787b281 --- /dev/null +++ b/contracts/foundry/caller/scenarios/errors.scen.json @@ -0,0 +1,96 @@ +{ + "name": "caller", + "steps": [ + { + "step": "externalSteps", + "path": "steps/init.steps.json" + }, + { + "step": "externalSteps", + "path": "steps/check_init.steps.json" + }, + { + "step": "scCall", + "id": "out of funds", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "1000000000", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "3", + "0" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "7", + "message": "" + } + }, + { + "step": "externalSteps", + "path": "steps/check_init.steps.json" + }, + { + "step": "scCall", + "id": "out of funds - indirect", + "comment": "SC attempts to send too many tokens", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "1000", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "3", + "2000" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "10", + "message": "str:failed transfer (insufficient funds)" + } + }, + { + "step": "externalSteps", + "path": "steps/check_init.steps.json" + }, + { + "step": "scCall", + "id": "nonexistent account", + "comment": "indirect call to nonexistent account", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "1000", + "arguments": [ + "sc:invalidaddress", + "str:fail_if_neg", + "3", + "10" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "10", + "message": "*" + } + }, + { + "step": "externalSteps", + "path": "steps/check_init.steps.json" + } + ] +} \ No newline at end of file diff --git a/contracts/foundry/caller/scenarios/exec_on_dest_ctx.scen.json b/contracts/foundry/caller/scenarios/exec_on_dest_ctx.scen.json new file mode 100644 index 0000000000..2a1aee42fa --- /dev/null +++ b/contracts/foundry/caller/scenarios/exec_on_dest_ctx.scen.json @@ -0,0 +1,185 @@ +{ + "name": "caller", + "steps": [ + { + "step": "externalSteps", + "path": "steps/init.steps.json" + }, + { + "step": "scCall", + "id": "positive", + "comment": "send a positive number with 1k EGLD to caller", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other_exec_on_dest_ctx", + "value": "1000", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "3", + "500" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["str:positive", "str:done"], + "status": "" + } + }, + { + "step": "externalSteps", + "path": "steps/check_1.steps.json" + }, + { + "step": "scCall", + "id": "negative: error message", + "comment": "owner -> caller -> callee wrong func name", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "500", + "arguments": [ + "sc:callee", + "str:fail_if_negative", + "-1", + "250" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "10", + "message": "str:invalid function (not found)", + "out": [] + } + }, + { + "step": "externalSteps", + "path": "steps/check_1.steps.json" + }, + { + "step": "scCall", + "id": "negative: error message", + "comment": "owner -> caller -> callee. callee fails and everything is reverted", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "500", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "-1", + "250" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "10", + "message": "str:error signalled by smartcontract", + "out": [] + } + }, + { + "step": "externalSteps", + "path": "steps/check_1.steps.json" + }, + { + "step": "scCall", + "id": "positive with 0 EGLD", + "comment": "send a positive number with 0 EGLD to caller", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "0", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "3", + "0" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["str:positive", "str:done"], + "status": "" + } + }, + { + "step": "checkState", + "accounts": { + "address:owner": { + "nonce": "*", + "balance": "99000", + "storage": {}, + "code": "" + }, + "sc:caller": { + "nonce": "0", + "balance": "500", + "storage": {}, + "code": "file:../output/caller.wasm" + }, + "sc:callee": { + "nonce": "0", + "balance": "500", + "storage": {}, + "code": "file:../../callee/output/callee.wasm" + } + } + }, + { + "step": "scCall", + "id": "positive with 1 EGLD", + "comment": "send a positive number with an odd number of EGLD to caller", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "1", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "3", + "0" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["str:positive", "str:done"], + "status": "" + } + }, + { + "step": "checkState", + "accounts": { + "address:owner": { + "nonce": "*", + "balance": "98999", + "storage": {}, + "code": "" + }, + "sc:caller": { + "nonce": "0", + "balance": "501", + "storage": {}, + "code": "file:../output/caller.wasm" + }, + "sc:callee": { + "nonce": "0", + "balance": "500", + "storage": {}, + "code": "file:../../callee/output/callee.wasm" + } + } + } + + ] +} \ No newline at end of file diff --git a/contracts/foundry/caller/scenarios/steps/check_1.steps.json b/contracts/foundry/caller/scenarios/steps/check_1.steps.json new file mode 100644 index 0000000000..7ed1ee3de4 --- /dev/null +++ b/contracts/foundry/caller/scenarios/steps/check_1.steps.json @@ -0,0 +1,29 @@ +{ + "name": "check after 1st call", + "steps": [ + { + "step": "checkState", + "comment": "caller should keep half of the EGLD", + "accounts": { + "address:owner": { + "nonce": "*", + "balance": "99000", + "storage": {}, + "code": "" + }, + "sc:caller": { + "nonce": "0", + "balance": "500", + "storage": {}, + "code": "file:../../output/caller.wasm" + }, + "sc:callee": { + "nonce": "0", + "balance": "500", + "storage": {}, + "code": "file:../../../callee/output/callee.wasm" + } + } + } + ] +} \ No newline at end of file diff --git a/contracts/foundry/caller/scenarios/steps/check_init.steps.json b/contracts/foundry/caller/scenarios/steps/check_init.steps.json new file mode 100644 index 0000000000..35522c8580 --- /dev/null +++ b/contracts/foundry/caller/scenarios/steps/check_init.steps.json @@ -0,0 +1,29 @@ +{ + "name": "check after 1st call", + "steps": [ + { + "step": "checkState", + "comment": "caller should keep half of the EGLD", + "accounts": { + "address:owner": { + "nonce": "*", + "balance": "100000", + "storage": {}, + "code": "" + }, + "sc:caller": { + "nonce": "0", + "balance": "0", + "storage": {}, + "code": "file:../../output/caller.wasm" + }, + "sc:callee": { + "nonce": "0", + "balance": "0", + "storage": {}, + "code": "file:../../../callee/output/callee.wasm" + } + } + } + ] +} \ No newline at end of file diff --git a/contracts/foundry/caller/scenarios/steps/init.steps.json b/contracts/foundry/caller/scenarios/steps/init.steps.json new file mode 100644 index 0000000000..9a9639ede9 --- /dev/null +++ b/contracts/foundry/caller/scenarios/steps/init.steps.json @@ -0,0 +1,57 @@ +{ + "name": "init and deploy", + "comment": "initialize the owner account and deploy caller and callee", + "steps": [ + { + "step": "setState", + "accounts": { + "address:owner": { + "nonce": "1", + "balance": "100000" + } + }, + "newAddresses": [ + { + "creatorAddress": "address:owner", + "creatorNonce": "1", + "newAddress": "sc:callee" + }, + { + "creatorAddress": "address:owner", + "creatorNonce": "2", + "newAddress": "sc:caller" + } + ] + }, + { + "step": "scDeploy", + "id": "deploy callee", + "tx": { + "from": "address:owner", + "contractCode": "file:../../../callee/output/callee.wasm", + "arguments": [], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "" + } + }, + { + "step": "scDeploy", + "id": "deploy caller", + "tx": { + "from": "address:owner", + "contractCode": "file:../../output/caller.wasm", + "arguments": [], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "" + } + } + ] +} \ No newline at end of file diff --git a/contracts/foundry/caller/src/caller.rs b/contracts/foundry/caller/src/caller.rs new file mode 100644 index 0000000000..264c578b37 --- /dev/null +++ b/contracts/foundry/caller/src/caller.rs @@ -0,0 +1,59 @@ +#![no_std] + +multiversx_sc::imports!(); + +#[multiversx_sc::contract] +pub trait CallerContract { + #[init] + fn init(&self) {} + + #[endpoint] + #[payable("EGLD")] + fn call_other( + &self, + dest: ManagedAddress, + func: ManagedBuffer, + value: i64, + to_send: BigUint, + ) -> ManagedBuffer { + let mut arg_buffer = ManagedArgBuffer::new(); + arg_buffer.push_arg(value); + + let result = + self.send_raw() + .direct_egld_execute(&dest, &to_send, 5000000, &func, &arg_buffer); + + match result { + Result::Err(_) => ManagedBuffer::from("failed"), + Result::Ok(_) => ManagedBuffer::from("done"), + } + } + + #[endpoint] + #[payable("EGLD")] + fn call_other_exec_on_dest_ctx( + &self, + dest: ManagedAddress, + func: ManagedBuffer, + value: i64, + to_send: BigUint, + ) -> ManagedBuffer { + let mut arg_buffer = ManagedArgBuffer::new(); + arg_buffer.push_arg(value); + + let result = self.send_raw().execute_on_dest_context_raw( + 5000000, + &dest, + &to_send, + &func, + &arg_buffer, + ); + + require!( + result.len() == 1, + "ExecuteOnDestContext result data is empty" + ); + + ManagedBuffer::from("done") + } +} diff --git a/contracts/foundry/caller/wasm/Cargo.lock b/contracts/foundry/caller/wasm/Cargo.lock new file mode 100644 index 0000000000..774a00da19 --- /dev/null +++ b/contracts/foundry/caller/wasm/Cargo.lock @@ -0,0 +1,219 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", +] + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "caller" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "caller-wasm" +version = "0.0.0" +dependencies = [ + "caller", + "multiversx-sc-wasm-adapter", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" + +[[package]] +name = "multiversx-sc" +version = "0.41.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "752eed690b41c060e8766e8f6078a8e3585a01387278c652cf88599255cbc5af" +dependencies = [ + "bitflags", + "hashbrown", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d70ea458247d263b7e9fdfb207530b6a530546247139c162450e515c013a18" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad6920f80fda67fc60fd51aaa9f83ec7e069470f60a068c81205f9da5d05a30" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.41.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "674eb1e50b8bc71898d0b476210856a7bc2a4f21758987413d1ec7837d5dd16c" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.41.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92854d81a7cd14c7ec2389cdb4bf555b7b1bbad84b8f8f4deb5a7c0b6b2c71cc" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "nibble_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "proc-macro2" +version = "1.0.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type", + "nibble_vec", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" diff --git a/contracts/foundry/caller/wasm/Cargo.toml b/contracts/foundry/caller/wasm/Cargo.toml new file mode 100644 index 0000000000..72b5ca9c06 --- /dev/null +++ b/contracts/foundry/caller/wasm/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "caller-wasm" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[lib] +crate-type = [ "cdylib",] + +[workspace] +members = [ ".",] + +[dev-dependencies] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" + +[dependencies.caller] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.41.2" diff --git a/contracts/foundry/caller/wasm/src/lib.rs b/contracts/foundry/caller/wasm/src/lib.rs new file mode 100644 index 0000000000..d6bf842ddd --- /dev/null +++ b/contracts/foundry/caller/wasm/src/lib.rs @@ -0,0 +1,26 @@ +// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 2 +// Async Callback (empty): 1 +// Total number of exported functions: 4 + +#![no_std] +#![feature(lang_items)] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + caller + ( + call_other + call_other_exec_on_dest_ctx + ) +} + +multiversx_sc_wasm_adapter::empty_callback! {} diff --git a/contracts/foundry/foundrylike/.gitignore b/contracts/foundry/foundrylike/.gitignore new file mode 100644 index 0000000000..2c76bc983e --- /dev/null +++ b/contracts/foundry/foundrylike/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +*/target/ + +# The mxpy output +/output*/ diff --git a/contracts/foundry/foundrylike/Cargo.toml b/contracts/foundry/foundrylike/Cargo.toml new file mode 100644 index 0000000000..cc5fb1a3eb --- /dev/null +++ b/contracts/foundry/foundrylike/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "test-adder" +version = "0.0.0" +authors = [ "you",] +edition = "2018" +publish = false + +[lib] +path = "src/test_adder.rs" + +[dev-dependencies] +num-bigint = "0.4.2" + +[dependencies.multiversx-sc] +version = "0.43.4" +path = "../../../framework/base" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.43.4" +path = "../../../framework/scenario" + diff --git a/contracts/foundry/foundrylike/foundry.json b/contracts/foundry/foundrylike/foundry.json new file mode 100644 index 0000000000..00b7434da3 --- /dev/null +++ b/contracts/foundry/foundrylike/foundry.json @@ -0,0 +1,5 @@ +{ + "contract_paths": [ + "../../../deps/mx-sdk-rs/contracts/examples/adder/output/adder.wasm" + ] +} \ No newline at end of file diff --git a/contracts/foundry/foundrylike/meta/Cargo.toml b/contracts/foundry/foundrylike/meta/Cargo.toml new file mode 100644 index 0000000000..289f12ff38 --- /dev/null +++ b/contracts/foundry/foundrylike/meta/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "test-adder-meta" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[dev-dependencies] + +[dependencies.test-adder] +path = ".." + +[dependencies.multiversx-sc-meta] +version = "0.43.4" +path = "../../../../framework/meta" diff --git a/contracts/foundry/foundrylike/meta/src/main.rs b/contracts/foundry/foundrylike/meta/src/main.rs new file mode 100644 index 0000000000..d99af9305d --- /dev/null +++ b/contracts/foundry/foundrylike/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/contracts/foundry/foundrylike/multiversx.json b/contracts/foundry/foundrylike/multiversx.json new file mode 100644 index 0000000000..7365539625 --- /dev/null +++ b/contracts/foundry/foundrylike/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/contracts/foundry/foundrylike/scenarios/test-adder.scen.json b/contracts/foundry/foundrylike/scenarios/test-adder.scen.json new file mode 100644 index 0000000000..3219956f1c --- /dev/null +++ b/contracts/foundry/foundrylike/scenarios/test-adder.scen.json @@ -0,0 +1,71 @@ +{ + "name": "test-adder", + "comment": "run foundry-like test for Adder", + "gasSchedule": "v3", + "steps": [ + { + "step": "setState", + "accounts": { + "address:k": { + "nonce": "1", + "balance": "100000" + } + }, + "newAddresses": [ + { + "creatorAddress": "address:k", + "creatorNonce": "1", + "newAddress": "sc:k-test" + } + ] + }, + { + "step": "fetchWasmSource", + "wasmPath": "file:../../../../deps/mx-sdk-rs/contracts/examples/adder/output/adder.wasm" + }, + { + "step": "scDeploy", + "id": "deploy test", + "comment": "deploy the test contract", + "tx": { + "from": "address:k", + "contractCode": "file:../output/test-adder.wasm", + "arguments": [ + "file:../../../../deps/mx-sdk-rs/contracts/examples/adder/output/adder.wasm" + ], + "gasLimit": "5,000,000,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "call test", + "comment": "call the parametric test endpoint with a concrete value", + "tx": { + "from": "address:k", + "to": "sc:k-test", + "function": "test_call_add", + "value": "0", + "arguments": [ + "3" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + } + ] +} \ No newline at end of file diff --git a/contracts/foundry/foundrylike/src/test_adder.rs b/contracts/foundry/foundrylike/src/test_adder.rs new file mode 100644 index 0000000000..499a07aacc --- /dev/null +++ b/contracts/foundry/foundrylike/src/test_adder.rs @@ -0,0 +1,109 @@ +#![no_std] + +multiversx_sc::imports!(); + +static INIT_SUM: u32 = 5u32; +#[multiversx_sc::contract] +pub trait TestAdder { + #[storage_mapper("ownerAddress")] + fn owner_address(&self) -> SingleValueMapper; + + #[storage_mapper("adderAddress")] + fn adder_address(&self) -> SingleValueMapper; + + /// Create the owner account and deploy adder + #[init] + fn init(&self, code_path: ManagedBuffer) { + // create the owner account + let owner = ManagedAddress::from(b"owner___________________________"); + self.owner_address().set(&owner); + + self.test_raw() + .create_account(&owner, 1, &BigUint::from(0u64)); + + // register an address for the contract to be deployed + let adder = ManagedAddress::from(b"adder___________________________"); + self.test_raw().register_new_address(&owner, 1, &adder); + + // deploy the adder contract + let mut adder_init_args = ManagedArgBuffer::new(); + adder_init_args.push_arg(INIT_SUM); // initial sum + + // deploy a contract from `owner` + let adder = self.test_raw().deploy_contract( + &owner, + 5000000000000, + &BigUint::zero(), + &code_path, + &adder_init_args, + ); + + // save the deployed contract's address + self.adder_address().set(&adder); + + // check the initial sum value + let sum_as_bytes = self + .test_raw() + .get_storage(&adder, &ManagedBuffer::from(b"sum")); + let sum = BigUint::from(sum_as_bytes); + self.test_raw().assert(sum == INIT_SUM); + } + + // Make a call from 'owner' to 'adder' and check the sum value + #[endpoint(test_call_add)] + fn test_call_add(&self, value: BigUint) { + self.test_raw().assume(value <= 100u32); + + let adder = self.adder_address().get(); + + self.call_add(&value); + + // check the sum value + let sum_as_bytes = self + .test_raw() + .get_storage(&adder, &ManagedBuffer::from(b"sum")); + let sum = BigUint::from(sum_as_bytes); + self.test_raw().assert(sum == (value + INIT_SUM)); + } + + #[endpoint(test_call_add_twice)] + fn test_call_add_twice(&self, value1: BigUint, value2: BigUint) { + self.test_raw().assume(value1 <= 100u32); + self.test_raw().assume(value2 <= 100u32); + + let adder = self.adder_address().get(); + + self.call_add(&value1); + self.call_add(&value2); + + // check the sum value + let sum_as_bytes = self + .test_raw() + .get_storage(&adder, &ManagedBuffer::from(b"sum")); + let sum = BigUint::from(sum_as_bytes); + self.test_raw().assert(sum == (value1 + value2 + INIT_SUM)); + } + + fn call_add(&self, value: &BigUint) { + let owner = self.owner_address().get(); + let adder = self.adder_address().get(); + + let mut adder_init_args = ManagedArgBuffer::new(); + adder_init_args.push_arg(value); // initial sum + + // start a prank and call 'adder' from 'owner' + self.test_raw().start_prank(&owner); + let res = self.send_raw().direct_egld_execute( + &adder, + &BigUint::from(0u32), + 5000000, + &ManagedBuffer::from(b"add"), + &adder_init_args, + ); + self.test_raw().stop_prank(); + + if res.is_err() { + panic!("call failed"); + } + } +} diff --git a/contracts/foundry/foundrylike/wasm/Cargo.lock b/contracts/foundry/foundrylike/wasm/Cargo.lock new file mode 100644 index 0000000000..7c28617de8 --- /dev/null +++ b/contracts/foundry/foundrylike/wasm/Cargo.lock @@ -0,0 +1,209 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", +] + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" + +[[package]] +name = "multiversx-sc" +version = "0.43.4" +dependencies = [ + "bitflags", + "hashbrown", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.18.1" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.18.1" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.43.4" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.43.4" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "nibble_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "proc-macro2" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type", + "nibble_vec", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "test-adder" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "test-adder-wasm" +version = "0.0.0" +dependencies = [ + "multiversx-sc-wasm-adapter", + "test-adder", +] + +[[package]] +name = "unicode-ident" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" diff --git a/contracts/foundry/foundrylike/wasm/Cargo.toml b/contracts/foundry/foundrylike/wasm/Cargo.toml new file mode 100644 index 0000000000..eb2916adba --- /dev/null +++ b/contracts/foundry/foundrylike/wasm/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "test-adder-wasm" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[lib] +crate-type = [ "cdylib",] + +[workspace] +members = [ ".",] + +[dev-dependencies] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" + +[dependencies.test-adder] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.43.4" +path = "../../../../framework/wasm-adapter" diff --git a/contracts/foundry/foundrylike/wasm/src/lib.rs b/contracts/foundry/foundrylike/wasm/src/lib.rs new file mode 100644 index 0000000000..73bef855f2 --- /dev/null +++ b/contracts/foundry/foundrylike/wasm/src/lib.rs @@ -0,0 +1,30 @@ +// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 2 +// Async Callback (empty): 1 +// Total number of exported functions: 4 + +#![no_std] + +// 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!(); + +multiversx_sc_wasm_adapter::endpoints! { + test_adder + ( + init => init + test_call_add => test_call_add + test_call_add_twice => test_call_add_twice + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/contracts/foundry/test_multisig/.gitignore b/contracts/foundry/test_multisig/.gitignore new file mode 100644 index 0000000000..2c76bc983e --- /dev/null +++ b/contracts/foundry/test_multisig/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +*/target/ + +# The mxpy output +/output*/ diff --git a/contracts/foundry/test_multisig/Cargo.toml b/contracts/foundry/test_multisig/Cargo.toml new file mode 100644 index 0000000000..8228080223 --- /dev/null +++ b/contracts/foundry/test_multisig/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "test_multisig" +version = "0.0.0" +authors = [ "you",] +edition = "2018" +publish = false + +[lib] +path = "src/test_multisig.rs" + +[dev-dependencies] +num-bigint = "0.4.2" + +[dependencies.multiversx-sc] +version = "0.43.4" +path = "../../../framework/base" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.43.4" +path = "../../../framework/scenario" + diff --git a/contracts/foundry/test_multisig/foundry.json b/contracts/foundry/test_multisig/foundry.json new file mode 100644 index 0000000000..eac6b162bc --- /dev/null +++ b/contracts/foundry/test_multisig/foundry.json @@ -0,0 +1,5 @@ +{ + "contract_paths": [ + "../../../deps/mx-sdk-rs/contracts/examples/multisig/output/multisig.wasm" + ] +} \ No newline at end of file diff --git a/contracts/foundry/test_multisig/meta/Cargo.toml b/contracts/foundry/test_multisig/meta/Cargo.toml new file mode 100644 index 0000000000..6a73e4c794 --- /dev/null +++ b/contracts/foundry/test_multisig/meta/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "test_multisig-meta" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[dev-dependencies] + +[dependencies.test_multisig] +path = ".." + +[dependencies.multiversx-sc-meta] +version = "0.43.4" +path = "../../../../framework/meta" diff --git a/contracts/foundry/test_multisig/meta/src/main.rs b/contracts/foundry/test_multisig/meta/src/main.rs new file mode 100644 index 0000000000..3c6c55534f --- /dev/null +++ b/contracts/foundry/test_multisig/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/contracts/foundry/test_multisig/multiversx.json b/contracts/foundry/test_multisig/multiversx.json new file mode 100644 index 0000000000..7365539625 --- /dev/null +++ b/contracts/foundry/test_multisig/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/contracts/foundry/test_multisig/src/test_multisig.rs b/contracts/foundry/test_multisig/src/test_multisig.rs new file mode 100644 index 0000000000..87f58e22fe --- /dev/null +++ b/contracts/foundry/test_multisig/src/test_multisig.rs @@ -0,0 +1,135 @@ +#![no_std] + +multiversx_sc::imports!(); + +static OWNER: &[u8; 32] = b"owner___________________________"; +static ALICE: &[u8; 32] = b"alice___________________________"; +static BOB: &[u8; 32] = b"bob_____________________________"; +static CHARLIE: &[u8; 32] = b"charlie_________________________"; +static MULTISIG: &[u8; 32] = b"multisig________________________"; + +#[multiversx_sc::contract] +pub trait TestMultisigContract { + #[init] + fn init(&self, code_path: ManagedBuffer) { + self.init_accounts(); + self.deploy(&code_path); + } + + fn init_accounts(&self) { + let owner = ManagedAddress::from(OWNER); + self.test_raw() + .create_account(&owner, 0, &BigUint::from(0u64)); + self.test_raw() + .create_account(&ManagedAddress::from(ALICE), 0, &BigUint::from(0u64)); + self.test_raw() + .create_account(&ManagedAddress::from(BOB), 0, &BigUint::from(0u64)); + self.test_raw() + .create_account(&ManagedAddress::from(CHARLIE), 0, &BigUint::from(0u64)); + + let multisig = ManagedAddress::from(MULTISIG); + self.test_raw().register_new_address(&owner, 0, &multisig); + } + + fn deploy(&self, code_path: &ManagedBuffer) { + let mut init_args = ManagedArgBuffer::new(); + init_args.push_arg(2); // quorum = 2 + init_args.push_arg(ManagedAddress::from(ALICE)); // board members = alice, bob, charlie + init_args.push_arg(ManagedAddress::from(BOB)); + init_args.push_arg(ManagedAddress::from(CHARLIE)); + + let multisig = self.test_raw().deploy_contract( + &ManagedAddress::from(OWNER), + 5000000000000, + &BigUint::zero(), + code_path, + &init_args, + ); + + self.test_raw().assert(self.get_quorum(&multisig) == 2u32); + self.test_raw() + .assert(self.get_num_board_members(&multisig) == 3u32); + } + + fn get_quorum(&self, multisig: &ManagedAddress) -> BigUint { + let bs = self + .test_raw() + .get_storage(multisig, &ManagedBuffer::from(b"quorum")); + BigUint::from(bs) + } + + fn get_num_board_members(&self, multisig: &ManagedAddress) -> BigUint { + let bs = self + .test_raw() + .get_storage(multisig, &ManagedBuffer::from(b"num_board_members")); + BigUint::from(bs) + } + + #[endpoint(test_change_quorum)] + fn test_change_quorum(&self, value: BigUint) { + let multisig = ManagedAddress::from(MULTISIG); + let alice = ManagedAddress::from(ALICE); + let bob = ManagedAddress::from(BOB); + + // make assumptions + self.test_raw() + .assume(value <= self.get_num_board_members(&multisig)); + + self.change_quorum_propose(&multisig, &alice, &value); + self.change_quorum_sign(&multisig, &bob); + self.perform_action(&multisig, &alice); + + // check the final quorum + self.test_raw().assert(value == self.get_quorum(&multisig)); + } + + fn change_quorum_propose( + &self, + multisig: &ManagedAddress, + proposer: &ManagedAddress, + value: &BigUint, + ) { + let mut args = ManagedArgBuffer::new(); + args.push_arg(value); + + self.test_raw().start_prank(proposer); + let _ = self.send_raw().direct_egld_execute( + multisig, + &BigUint::from(0u32), + 5000000, + &ManagedBuffer::from(b"proposeChangeQuorum"), + &args, + ); + self.test_raw().stop_prank(); + } + + fn change_quorum_sign(&self, multisig: &ManagedAddress, signer: &ManagedAddress) { + let mut args = ManagedArgBuffer::new(); + args.push_arg(1u32); + + self.test_raw().start_prank(signer); + let _ = self.send_raw().direct_egld_execute( + multisig, + &BigUint::from(0u32), + 5000000, + &ManagedBuffer::from(b"sign"), + &args, + ); + self.test_raw().stop_prank(); + } + + fn perform_action(&self, multisig: &ManagedAddress, performer: &ManagedAddress) { + let mut args = ManagedArgBuffer::new(); + args.push_arg(1u32); + + self.test_raw().start_prank(performer); + let _ = self.send_raw().direct_egld_execute( + multisig, + &BigUint::from(0u32), + 5000000, + &ManagedBuffer::from(b"performAction"), + &args, + ); + self.test_raw().stop_prank(); + } +} diff --git a/contracts/foundry/test_multisig/wasm/Cargo.lock b/contracts/foundry/test_multisig/wasm/Cargo.lock new file mode 100644 index 0000000000..d2a8373d9e --- /dev/null +++ b/contracts/foundry/test_multisig/wasm/Cargo.lock @@ -0,0 +1,209 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", +] + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" + +[[package]] +name = "multiversx-sc" +version = "0.43.4" +dependencies = [ + "bitflags", + "hashbrown", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.18.1" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.18.1" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.43.4" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.43.4" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "nibble_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "proc-macro2" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type", + "nibble_vec", +] + +[[package]] +name = "smallvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "test_multisig" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "test_multisig-wasm" +version = "0.0.0" +dependencies = [ + "multiversx-sc-wasm-adapter", + "test_multisig", +] + +[[package]] +name = "unicode-ident" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" diff --git a/contracts/foundry/test_multisig/wasm/Cargo.toml b/contracts/foundry/test_multisig/wasm/Cargo.toml new file mode 100644 index 0000000000..d7b7de9490 --- /dev/null +++ b/contracts/foundry/test_multisig/wasm/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "test_multisig-wasm" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[lib] +crate-type = [ "cdylib",] + +[workspace] +members = [ ".",] + +[dev-dependencies] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" + +[dependencies.test_multisig] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.43.4" +path = "../../../../framework/wasm-adapter" diff --git a/contracts/foundry/test_multisig/wasm/src/lib.rs b/contracts/foundry/test_multisig/wasm/src/lib.rs new file mode 100644 index 0000000000..0424b5c058 --- /dev/null +++ b/contracts/foundry/test_multisig/wasm/src/lib.rs @@ -0,0 +1,29 @@ +// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 1 +// Async Callback (empty): 1 +// Total number of exported functions: 3 + +#![no_std] + +// 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!(); + +multiversx_sc_wasm_adapter::endpoints! { + test_multisig + ( + init => init + test_change_quorum => test_change_quorum + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/contracts/foundry/test_testapi/.gitignore b/contracts/foundry/test_testapi/.gitignore new file mode 100644 index 0000000000..2c76bc983e --- /dev/null +++ b/contracts/foundry/test_testapi/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +*/target/ + +# The mxpy output +/output*/ diff --git a/contracts/foundry/test_testapi/Cargo.toml b/contracts/foundry/test_testapi/Cargo.toml new file mode 100644 index 0000000000..7d9f0b0ed3 --- /dev/null +++ b/contracts/foundry/test_testapi/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "test-testapi" +version = "0.0.0" +authors = [ "you",] +edition = "2018" +publish = false + +[lib] +path = "src/test_testapi.rs" + +[dev-dependencies] +num-bigint = "0.4.2" + +[dependencies.multiversx-sc] +version = "0.43.4" +path = "../../../framework/base" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.43.4" +path = "../../../framework/scenario" + diff --git a/contracts/foundry/test_testapi/foundry.json b/contracts/foundry/test_testapi/foundry.json new file mode 100644 index 0000000000..5a61e45e68 --- /dev/null +++ b/contracts/foundry/test_testapi/foundry.json @@ -0,0 +1,3 @@ +{ + "contract_paths": [] +} \ No newline at end of file diff --git a/contracts/foundry/test_testapi/meta/Cargo.toml b/contracts/foundry/test_testapi/meta/Cargo.toml new file mode 100644 index 0000000000..7e03bfe984 --- /dev/null +++ b/contracts/foundry/test_testapi/meta/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "test-testapi-meta" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[dev-dependencies] + +[dependencies.test-testapi] +path = ".." + +[dependencies.multiversx-sc-meta] +version = "0.43.4" +path = "../../../../framework/meta" diff --git a/contracts/foundry/test_testapi/meta/src/main.rs b/contracts/foundry/test_testapi/meta/src/main.rs new file mode 100644 index 0000000000..4ce9753347 --- /dev/null +++ b/contracts/foundry/test_testapi/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/contracts/foundry/test_testapi/multiversx.json b/contracts/foundry/test_testapi/multiversx.json new file mode 100644 index 0000000000..7365539625 --- /dev/null +++ b/contracts/foundry/test_testapi/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/contracts/foundry/test_testapi/src/test_testapi.rs b/contracts/foundry/test_testapi/src/test_testapi.rs new file mode 100644 index 0000000000..64a34ae44c --- /dev/null +++ b/contracts/foundry/test_testapi/src/test_testapi.rs @@ -0,0 +1,81 @@ +#![no_std] + +multiversx_sc::imports!(); + +#[multiversx_sc::contract] +pub trait TestTestapi { + #[init] + fn init(&self) { + let alice = ManagedAddress::from(b"alice___________________________"); + self.test_raw() + .create_account(&alice, 1, &BigUint::from(0u64)); + + self.test_set_balance(&alice); + self.test_set_esdt_balance(&alice); + self.test_set_timestamp(); + self.test_set_get_storage(&alice); + } + + fn test_set_balance(&self, addr: &ManagedAddress) { + // Given + let value = BigUint::from(100000000u64); + + // When + self.test_raw().set_balance(addr, &value); + + // Expect + let actual = self.blockchain().get_balance(addr); + + require!( + value == actual, + "Actual balance does not match the given value" + ); + } + + fn test_set_esdt_balance(&self, addr: &ManagedAddress) { + // Given + let value = BigUint::from(100000000u64); + let token = TokenIdentifier::from("MY_ESDT_TOKEN"); + + // When + self.test_raw().set_esdt_balance(addr, &token, &value); + + // Expect + let actual = self.blockchain().get_esdt_balance(addr, &token, 0u64); + + require!( + value == actual, + "Actual esdt balance does not match the given value" + ); + } + + fn test_set_timestamp(&self) { + // Given + let value = 1234567890u64; + + // When + self.test_raw().set_block_timestamp(value); + + // Expect + require!( + value == self.blockchain().get_block_timestamp(), + "Actual timestamp does not match the given value" + ); + } + + fn test_set_get_storage(&self, addr: &ManagedAddress) { + // Given + let key = ManagedBuffer::from(b"a_storage_key"); + let value = ManagedBuffer::from(b"a storage value"); + + // When + self.test_raw().set_storage(addr, &key, &value); + + // Expect + let actual = self.test_raw().get_storage(addr, &key); + require!( + actual == value, + "Actual storage does not match the given value" + ); + } +} diff --git a/contracts/foundry/test_testapi/wasm/Cargo.lock b/contracts/foundry/test_testapi/wasm/Cargo.lock new file mode 100644 index 0000000000..11182740a4 --- /dev/null +++ b/contracts/foundry/test_testapi/wasm/Cargo.lock @@ -0,0 +1,209 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", +] + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" + +[[package]] +name = "multiversx-sc" +version = "0.43.4" +dependencies = [ + "bitflags", + "hashbrown", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.18.1" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.18.1" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.43.4" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.43.4" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "nibble_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec", +] + +[[package]] +name = "num-traits" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "proc-macro2" +version = "1.0.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type", + "nibble_vec", +] + +[[package]] +name = "smallvec" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "test-testapi" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "test-testapi-wasm" +version = "0.0.0" +dependencies = [ + "multiversx-sc-wasm-adapter", + "test-testapi", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" diff --git a/contracts/foundry/test_testapi/wasm/Cargo.toml b/contracts/foundry/test_testapi/wasm/Cargo.toml new file mode 100644 index 0000000000..f9913c9aff --- /dev/null +++ b/contracts/foundry/test_testapi/wasm/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "test-testapi-wasm" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[lib] +crate-type = [ "cdylib",] + +[workspace] +members = [ ".",] + +[dev-dependencies] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" + +[dependencies.test-testapi] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.43.4" +path = "../../../../framework/wasm-adapter" diff --git a/contracts/foundry/test_testapi/wasm/src/lib.rs b/contracts/foundry/test_testapi/wasm/src/lib.rs new file mode 100644 index 0000000000..4ddd0648f4 --- /dev/null +++ b/contracts/foundry/test_testapi/wasm/src/lib.rs @@ -0,0 +1,28 @@ +// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 0 +// Async Callback (empty): 1 +// Total number of exported functions: 2 + +#![no_std] + +// 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!(); + +multiversx_sc_wasm_adapter::endpoints! { + test_testapi + ( + init => init + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/framework/base/src/api.rs b/framework/base/src/api.rs index d59a15931d..04bd8702e2 100644 --- a/framework/base/src/api.rs +++ b/framework/base/src/api.rs @@ -12,6 +12,7 @@ mod managed_types; mod print_api; mod send_api; mod storage_api; +mod test_api; pub mod uncallable; mod vm_api; @@ -29,4 +30,5 @@ pub use managed_types::*; pub use print_api::*; pub use send_api::*; pub use storage_api::*; +pub use test_api::*; pub use vm_api::VMApi; diff --git a/framework/base/src/api/external_view/ev_wrapper.rs b/framework/base/src/api/external_view/ev_wrapper.rs index 6b88231e5b..a484a6c5cc 100644 --- a/framework/base/src/api/external_view/ev_wrapper.rs +++ b/framework/base/src/api/external_view/ev_wrapper.rs @@ -3,7 +3,7 @@ use core::marker::PhantomData; use crate::api::{ BlockchainApi, CallTypeApi, CallValueApi, CryptoApi, EndpointArgumentApi, EndpointFinishApi, ErrorApi, HandleTypeInfo, LogApi, ManagedTypeApi, PrintApi, SendApi, StaticVarApi, - StorageMapperApi, StorageWriteApi, VMApi, + StorageMapperApi, StorageWriteApi, TestApi, VMApi, }; #[derive(Clone)] @@ -170,6 +170,17 @@ impl CallTypeApi for ExternalViewApi where A: VMApi {} impl StorageMapperApi for ExternalViewApi where A: VMApi {} +impl TestApi for ExternalViewApi +where + A: VMApi, +{ + type TestApiImpl = A::TestApiImpl; + + fn test_api_impl() -> Self::TestApiImpl { + A::test_api_impl() + } +} + impl VMApi for ExternalViewApi where A: VMApi, diff --git a/framework/base/src/api/test_api.rs b/framework/base/src/api/test_api.rs new file mode 100644 index 0000000000..46d76a86c5 --- /dev/null +++ b/framework/base/src/api/test_api.rs @@ -0,0 +1,104 @@ +use super::{ErrorApi, ErrorApiImpl, HandleTypeInfo, ManagedTypeApi}; + +const TEST_API_ERROR_MSG: &str = "cannot call the test API in this context"; + +pub trait TestApi: ManagedTypeApi + ErrorApi { + type TestApiImpl: TestApiImpl + + HandleTypeInfo< + ManagedBufferHandle = Self::ManagedBufferHandle, + BigIntHandle = Self::BigIntHandle, + BigFloatHandle = Self::BigFloatHandle, + EllipticCurveHandle = Self::EllipticCurveHandle, + >; + + fn test_api_impl() -> Self::TestApiImpl; +} + +#[allow(unused_variables)] +pub trait TestApiImpl: HandleTypeInfo + ErrorApi { + fn create_account( + &self, + address: Self::ManagedBufferHandle, + nonce: u64, + balance: Self::BigIntHandle, + ) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + fn register_new_address( + &self, + owner: Self::ManagedBufferHandle, + nonce: u64, + new_address: Self::ManagedBufferHandle, + ) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + // Deploy a contract whose code was previously fetched using "fetchWasmSource" in Mandos. + fn deploy_contract( + &self, + owner: Self::ManagedBufferHandle, + gas_limit: u64, + value: Self::BigIntHandle, + code_path: Self::ManagedBufferHandle, + arguments: Self::ManagedBufferHandle, + result_address_handle: Self::ManagedBufferHandle, + ) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + // Set storage of any account + fn set_storage( + &self, + address: Self::ManagedBufferHandle, + key: Self::ManagedBufferHandle, + value: Self::ManagedBufferHandle, + ) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + // Get storage of any account + fn get_storage( + &self, + address: Self::ManagedBufferHandle, + key: Self::ManagedBufferHandle, + result_value: Self::ManagedBufferHandle, + ) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + // Start a prank: set the caller address for contract calls until stop_prank + fn start_prank(&self, address: Self::ManagedBufferHandle) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + // Stop a prank: reset the caller address + fn stop_prank(&self) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + fn assume(&self, p: bool) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + fn assert(&self, p: bool) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + fn set_block_timestamp(&self, timestamp: u64) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + fn set_balance(&self, address: Self::ManagedBufferHandle, value: Self::BigIntHandle) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + fn set_esdt_balance( + &self, + address: Self::ManagedBufferHandle, + token_id: Self::ManagedBufferHandle, + value: Self::BigIntHandle, + ) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } +} diff --git a/framework/base/src/api/uncallable.rs b/framework/base/src/api/uncallable.rs index f666edc4db..2fa8a95523 100644 --- a/framework/base/src/api/uncallable.rs +++ b/framework/base/src/api/uncallable.rs @@ -17,6 +17,7 @@ mod print_api_uncallable; mod send_api_uncallable; mod static_var_api_uncallable; mod storage_api_uncallable; +mod test_api_uncallable; mod vm_api_uncallable; /// Dummy type with no implementation. diff --git a/framework/base/src/api/uncallable/test_api_uncallable.rs b/framework/base/src/api/uncallable/test_api_uncallable.rs new file mode 100644 index 0000000000..563c27e423 --- /dev/null +++ b/framework/base/src/api/uncallable/test_api_uncallable.rs @@ -0,0 +1,13 @@ +use crate::api::{TestApi, TestApiImpl}; + +use super::UncallableApi; + +impl TestApi for UncallableApi { + type TestApiImpl = Self; + + fn test_api_impl() -> Self::TestApiImpl { + unreachable!() + } +} + +impl TestApiImpl for UncallableApi {} diff --git a/framework/base/src/api/vm_api.rs b/framework/base/src/api/vm_api.rs index c7cac0daa2..7a39c24ee2 100644 --- a/framework/base/src/api/vm_api.rs +++ b/framework/base/src/api/vm_api.rs @@ -1,7 +1,7 @@ use super::{ BlockchainApi, CallTypeApi, CallValueApi, CryptoApi, EndpointArgumentApi, EndpointFinishApi, ErrorApi, LogApi, ManagedTypeApi, PrintApi, SendApi, StorageMapperApi, StorageReadApi, - StorageReadApiImpl, StorageWriteApi, + StorageReadApiImpl, StorageWriteApi, TestApi, }; pub trait VMApi: @@ -19,6 +19,7 @@ pub trait VMApi: + PrintApi + CallTypeApi + StorageMapperApi + + TestApi + Clone // TODO: remove + PartialEq // for helping derive PartialEq for managed types + Eq diff --git a/framework/base/src/contract_base/contract_base_trait.rs b/framework/base/src/contract_base/contract_base_trait.rs index cec45dfa0f..77088ae0fe 100644 --- a/framework/base/src/contract_base/contract_base_trait.rs +++ b/framework/base/src/contract_base/contract_base_trait.rs @@ -1,6 +1,6 @@ use super::{ BlockchainWrapper, CallValueWrapper, CryptoWrapper, ErrorHelper, ManagedSerializer, - SendRawWrapper, SendWrapper, StorageRawWrapper, + SendRawWrapper, SendWrapper, StorageRawWrapper, TestRawWrapper, }; use crate::api::VMApi; @@ -62,4 +62,9 @@ pub trait ContractBase: Sized { fn storage_raw(&self) -> StorageRawWrapper { StorageRawWrapper::new() } + + #[inline] + fn test_raw(&self) -> TestRawWrapper { + TestRawWrapper::new() + } } diff --git a/framework/base/src/contract_base/wrappers.rs b/framework/base/src/contract_base/wrappers.rs index 4a32bf0a7b..64a044f09b 100644 --- a/framework/base/src/contract_base/wrappers.rs +++ b/framework/base/src/contract_base/wrappers.rs @@ -7,6 +7,7 @@ mod send_raw_wrapper; mod send_wrapper; mod serializer; mod storage_raw_wrapper; +mod test_raw_wrapper; pub use blockchain_wrapper::BlockchainWrapper; pub use call_value_wrapper::CallValueWrapper; @@ -17,3 +18,4 @@ pub use send_raw_wrapper::SendRawWrapper; pub use send_wrapper::SendWrapper; pub use serializer::{ExitCodecErrorHandler, ManagedSerializer}; pub use storage_raw_wrapper::StorageRawWrapper; +pub use test_raw_wrapper::TestRawWrapper; diff --git a/framework/base/src/contract_base/wrappers/test_raw_wrapper.rs b/framework/base/src/contract_base/wrappers/test_raw_wrapper.rs new file mode 100644 index 0000000000..d3d0e58580 --- /dev/null +++ b/framework/base/src/contract_base/wrappers/test_raw_wrapper.rs @@ -0,0 +1,129 @@ +use core::marker::PhantomData; + +use crate::{ + api::{TestApi, TestApiImpl}, + types::{ + BigUint, ManagedAddress, ManagedArgBuffer, ManagedBuffer, ManagedType, TokenIdentifier, + }, +}; + +#[derive(Default)] +pub struct TestRawWrapper +where + A: TestApi, +{ + _phantom: PhantomData, +} + +impl TestRawWrapper +where + A: TestApi, +{ + pub fn new() -> Self { + TestRawWrapper { + _phantom: PhantomData, + } + } + + pub fn create_account(&self, address: &ManagedAddress, nonce: u64, balance: &BigUint) { + A::test_api_impl().create_account(address.get_handle(), nonce, balance.get_handle()); + } + + pub fn register_new_address( + self, + owner: &ManagedAddress, + nonce: u64, + new_address: &ManagedAddress, + ) { + A::test_api_impl().register_new_address( + owner.get_handle(), + nonce, + new_address.get_handle(), + ); + } + + // Deploy a contract whose code was previously fetched using "fetchWasmSource" in Mandos. + pub fn deploy_contract( + self, + owner: &ManagedAddress, + gas_limit: u64, + value: &BigUint, + code_path: &ManagedBuffer, + arguments: &ManagedArgBuffer, + ) -> ManagedAddress { + let dest = ManagedAddress::zero(); + + A::test_api_impl().deploy_contract( + owner.get_handle(), + gas_limit, + value.get_handle(), + code_path.get_handle(), + arguments.get_handle(), + dest.get_handle(), + ); + + dest + } + + // Set storage of any account + pub fn set_storage( + self, + address: &ManagedAddress, + key: &ManagedBuffer, + value: &ManagedBuffer, + ) { + A::test_api_impl().set_storage(address.get_handle(), key.get_handle(), value.get_handle()); + } + + // Get storage of any account + pub fn get_storage( + self, + address: &ManagedAddress, + key: &ManagedBuffer, + ) -> ManagedBuffer { + let dest = ManagedBuffer::new(); + + A::test_api_impl().get_storage(address.get_handle(), key.get_handle(), dest.get_handle()); + + dest + } + + // Start a prank: set the caller address for contract calls until stop_prank + pub fn start_prank(self, address: &ManagedAddress) { + A::test_api_impl().start_prank(address.get_handle()); + } + + // Stop a prank: reset the caller address + pub fn stop_prank(self) { + A::test_api_impl().stop_prank(); + } + + pub fn assume(self, p: bool) { + A::test_api_impl().assume(p); + } + + pub fn assert(self, p: bool) { + A::test_api_impl().assert(p); + } + + pub fn set_block_timestamp(self, timestamp: u64) { + A::test_api_impl().set_block_timestamp(timestamp); + } + + pub fn set_balance(self, address: &ManagedAddress, value: &BigUint) { + A::test_api_impl().set_balance(address.get_handle(), value.get_handle()); + } + + pub fn set_esdt_balance( + self, + address: &ManagedAddress, + token_id: &TokenIdentifier, + value: &BigUint, + ) { + A::test_api_impl().set_esdt_balance( + address.get_handle(), + token_id.get_handle(), + value.get_handle(), + ); + } +} diff --git a/framework/meta/src/print_util.rs b/framework/meta/src/print_util.rs index e6fd7053d1..94b6cf1d4a 100644 --- a/framework/meta/src/print_util.rs +++ b/framework/meta/src/print_util.rs @@ -76,7 +76,7 @@ pub fn print_call_wasm2wat(wasm_path: &str, wat_path: &str) { } pub fn print_pack_mxsc_file(output_mxsc_path: &str) { - println!("{}", format!("Packing {output_mxsc_path} ...").green(),); + println!("{}", format!("\nPacking {output_mxsc_path} ...").green(),); } pub fn print_contract_size(size: usize) { @@ -107,7 +107,7 @@ pub fn print_invalid_vm_hook(import_name: &str, ei_version: &str) { } pub fn print_check_ei_ok() { - println!("{}", " OK".green(),); + print!("{}", " OK".green(),); } pub fn print_ignore_ei_check() { diff --git a/framework/scenario/src/api/core_api_vh.rs b/framework/scenario/src/api/core_api_vh.rs index e6012be410..4a34aa381a 100644 --- a/framework/scenario/src/api/core_api_vh.rs +++ b/framework/scenario/src/api/core_api_vh.rs @@ -7,3 +7,4 @@ mod error_api_vh; mod log_api_vh; mod send_api_vh; mod storage_api_vh; +mod test_api_vh; diff --git a/framework/scenario/src/api/core_api_vh/test_api_vh.rs b/framework/scenario/src/api/core_api_vh/test_api_vh.rs new file mode 100644 index 0000000000..b613b61722 --- /dev/null +++ b/framework/scenario/src/api/core_api_vh/test_api_vh.rs @@ -0,0 +1,13 @@ +use multiversx_sc::api::{TestApi, TestApiImpl}; + +use crate::api::{VMHooksApi, VMHooksApiBackend}; + +impl TestApi for VMHooksApi { + type TestApiImpl = Self; + + fn test_api_impl() -> Self::TestApiImpl { + Self::api_impl() + } +} + +impl TestApiImpl for VMHooksApi {} diff --git a/framework/wasm-adapter/src/api/mod.rs b/framework/wasm-adapter/src/api.rs similarity index 94% rename from framework/wasm-adapter/src/api/mod.rs rename to framework/wasm-adapter/src/api.rs index cde7d89e6b..f4fde42cef 100644 --- a/framework/wasm-adapter/src/api/mod.rs +++ b/framework/wasm-adapter/src/api.rs @@ -9,6 +9,7 @@ mod managed_types; mod print_api_node; mod send_api_node; mod storage_api_node; +mod test_api_node; mod unsafe_buffer; mod vm_api_node; diff --git a/framework/wasm-adapter/src/api/test_api_node.rs b/framework/wasm-adapter/src/api/test_api_node.rs new file mode 100644 index 0000000000..f8c007854b --- /dev/null +++ b/framework/wasm-adapter/src/api/test_api_node.rs @@ -0,0 +1,170 @@ +use super::VmApiImpl; +use multiversx_sc::api::{TestApi, TestApiImpl}; + +extern "C" { + + fn createAccount(addressHandle: i32, nonce: i64, balanceHandle: i32); + + fn registerNewAddress(ownerHandle: i32, nonce: i64, newAddressHandle: i32); + + fn deployContract( + ownerHandle: i32, + gasLimit: i64, + valueHandle: i32, + codePathHandle: i32, + argumentsHandle: i32, + resultAddressHandle: i32, + ); + + fn setStorage(addressHandle: i32, keyHandle: i32, valueHandle: i32); + + fn getStorage(addressHandle: i32, keyHandle: i32, dstHandle: i32); + + fn assumeBool(p: bool); + fn assertBool(p: bool); + + fn startPrank(addressHandle: i32); + fn stopPrank(); + + fn setBlockTimestamp(timestamp: i64); + + fn setExternalBalance(addressHandle: i32, valueHandle: i32); + + fn setESDTExternalBalance(addressHandle: i32, tokenIdHandle: i32, valueHandle: i32); +} + +impl TestApi for VmApiImpl { + type TestApiImpl = VmApiImpl; + + #[inline] + fn test_api_impl() -> Self::TestApiImpl { + VmApiImpl {} + } +} + +impl TestApiImpl for VmApiImpl { + fn create_account( + &self, + address: Self::ManagedBufferHandle, + nonce: u64, + balance: Self::BigIntHandle, + ) { + unsafe { + createAccount(address, nonce as i64, balance); + } + } + + fn register_new_address( + &self, + owner: Self::ManagedBufferHandle, + nonce: u64, + new_address: Self::ManagedBufferHandle, + ) { + unsafe { + registerNewAddress(owner, nonce as i64, new_address); + } + } + + // Deploy a contract whose code was previously fetched using "fetchWasmSource" in Mandos. + fn deploy_contract( + &self, + owner: Self::ManagedBufferHandle, + gas_limit: u64, + value: Self::BigIntHandle, + code_path: Self::ManagedBufferHandle, + arguments: Self::ManagedBufferHandle, + result_address_handle: Self::ManagedBufferHandle, + ) { + unsafe { + // let mut dest = ManagedAddress::zero(); + + deployContract( + owner, + gas_limit as i64, + value, + code_path, + arguments, + result_address_handle, + ); + + // dest + } + } + + // Set storage of any account + fn set_storage( + &self, + address: Self::ManagedBufferHandle, + key: Self::ManagedBufferHandle, + value: Self::ManagedBufferHandle, + ) { + unsafe { + setStorage(address, key, value); + } + } + + // Get storage of any account + fn get_storage( + &self, + address: Self::ManagedBufferHandle, + key: Self::ManagedBufferHandle, + result_value: Self::ManagedBufferHandle, + ) { + unsafe { + // let mut dest = ManagedBuffer::new(); + + getStorage(address, key, result_value); + + // dest + } + } + + // Start a prank: set the caller address for contract calls until stop_prank + fn start_prank(&self, address: Self::ManagedBufferHandle) { + unsafe { + startPrank(address); + } + } + + // Stop a prank: reset the caller address + fn stop_prank(&self) { + unsafe { + stopPrank(); + } + } + + fn assume(&self, p: bool) { + unsafe { + assumeBool(p); + } + } + + fn assert(&self, p: bool) { + unsafe { + assertBool(p); + } + } + + fn set_block_timestamp(&self, timestamp: u64) { + unsafe { + setBlockTimestamp(timestamp as i64); + } + } + + fn set_balance(&self, address: Self::ManagedBufferHandle, value: Self::BigIntHandle) { + unsafe { + setExternalBalance(address, value); + } + } + + fn set_esdt_balance( + &self, + address: Self::ManagedBufferHandle, + token_id: Self::ManagedBufferHandle, + value: Self::BigIntHandle, + ) { + unsafe { + setESDTExternalBalance(address, token_id, value); + } + } +} diff --git a/vm/src/mem_conv.rs b/vm/src/mem_conv.rs index d292dfbd10..eb8c46de59 100644 --- a/vm/src/mem_conv.rs +++ b/vm/src/mem_conv.rs @@ -7,7 +7,6 @@ where f(bytes.as_ptr() as MemPtr, bytes.len() as MemLength) } -#[allow(clippy::needless_pass_by_ref_mut)] pub fn with_mem_ptr_mut(bytes: &mut [u8], f: F) -> R where F: FnOnce(MemPtr, MemLength) -> R,