diff --git a/Cargo.lock b/Cargo.lock index a131bb32..bdf0a110 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1922,6 +1922,24 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "test-caller" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-modules", + "multiversx-sc-scenario", + "num-bigint", +] + +[[package]] +name = "test-caller-meta" +version = "0.0.0" +dependencies = [ + "multiversx-sc-meta", + "test-caller", +] + [[package]] name = "tinyvec" version = "1.6.0" diff --git a/Cargo.toml b/Cargo.toml index 2d9d9bd7..2c45d19e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,5 +9,7 @@ members = [ "multisig", "multisig/meta", "bridged-tokens-wrapper", - "bridged-tokens-wrapper/meta" + "bridged-tokens-wrapper/meta", + "test-caller", + "test-caller/meta" ] diff --git a/test-caller/.gitignore b/test-caller/.gitignore new file mode 100644 index 00000000..2c76bc98 --- /dev/null +++ b/test-caller/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +*/target/ + +# The mxpy output +/output*/ diff --git a/test-caller/Cargo.toml b/test-caller/Cargo.toml new file mode 100644 index 00000000..0a744cb1 --- /dev/null +++ b/test-caller/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "test-caller" +version = "0.0.0" +authors = ["Iulian Pascalau "] +edition = "2018" +publish = false + +[lib] +path = "src/test-caller.rs" + +[dependencies.multiversx-sc] +version = "=0.47.5" + +[dependencies.multiversx-sc-modules] +version = "0.47.5" + +[dev-dependencies] +num-bigint = "0.4.2" + +[dev-dependencies.multiversx-sc-scenario] +version = "=0.47.5" diff --git a/test-caller/meta/Cargo.toml b/test-caller/meta/Cargo.toml new file mode 100644 index 00000000..6b8a5ae3 --- /dev/null +++ b/test-caller/meta/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "test-caller-meta" +version = "0.0.0" +edition = "2018" +publish = false +authors = ["you"] + +[dev-dependencies] + +[dependencies.test-caller] +path = ".." + +[dependencies.multiversx-sc-meta] +version = "=0.47.5" diff --git a/test-caller/meta/src/main.rs b/test-caller/meta/src/main.rs new file mode 100644 index 00000000..2e214d31 --- /dev/null +++ b/test-caller/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/test-caller/multiversx.json b/test-caller/multiversx.json new file mode 100644 index 00000000..73655396 --- /dev/null +++ b/test-caller/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/test-caller/src/test-caller.rs b/test-caller/src/test-caller.rs new file mode 100644 index 00000000..d4dc0e86 --- /dev/null +++ b/test-caller/src/test-caller.rs @@ -0,0 +1,25 @@ +#![no_std] + +multiversx_sc::imports!(); +multiversx_sc::derive_imports!(); + +#[multiversx_sc::contract] +pub trait TestCallerContract: +{ + #[init] + fn init(&self) { + } + + #[upgrade] + fn upgrade(&self) { + } + + #[payable("*")] + #[endpoint(callPayable)] + fn call_payable(&self) { + } + + #[endpoint(callNonPayable)] + fn call_non_payable(&self) { + } +} diff --git a/test-caller/wasm/Cargo.lock b/test-caller/wasm/Cargo.lock new file mode 100644 index 00000000..0bfb53c1 --- /dev/null +++ b/test-caller/wasm/Cargo.lock @@ -0,0 +1,190 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "bitflags" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[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.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "multiversx-sc" +version = "0.47.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2a40b8535885488f1449ba6f03e05e6013c2ff73c89c54f94dcdc0af7c8084" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.18.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1da6db65170105c9495848c5e4ba388abb1f9201ff2ca362056c9328f36b7760" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.18.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "631c4d4b37fc94659c8d6cf559c21b68c68899095201de2e1b779fccad7b0b03" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.47.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73567b0b79730b4f6000c2fac4a21ea7ba8c8b12aa32901dd8ff10ccb90cfd79" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-modules" +version = "0.47.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ccacf17315c86c4ef77cf75851c7ad2c7f8bd4584fb1bf1a71d043db12175c" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.47.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e6e0330769b8b46966c5fc59fd13bd95a0d5b330cf0aa55c0403dbb911fa71" +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.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proc-macro2" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +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.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "syn" +version = "2.0.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "test-caller" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-modules", +] + +[[package]] +name = "test-caller-wasm" +version = "0.0.0" +dependencies = [ + "multiversx-sc-wasm-adapter", + "test-caller", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/test-caller/wasm/Cargo.toml b/test-caller/wasm/Cargo.toml new file mode 100644 index 00000000..cee546ca --- /dev/null +++ b/test-caller/wasm/Cargo.toml @@ -0,0 +1,31 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "test-caller-wasm" +version = "0.0.0" +edition = "2018" +publish = false + +[lib] +crate-type = ["cdylib"] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" +overflow-checks = false + +[dependencies.test-caller] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "=0.47.5" + +[workspace] +members = ["."] diff --git a/test-caller/wasm/src/lib.rs b/test-caller/wasm/src/lib.rs new file mode 100644 index 00000000..c0f72269 --- /dev/null +++ b/test-caller/wasm/src/lib.rs @@ -0,0 +1,29 @@ +// Code generated by the multiversx-sc build system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 3 +// Async Callback (empty): 1 +// Total number of exported functions: 5 + +#![no_std] +#![allow(internal_features)] +#![feature(lang_items)] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + test_caller + ( + init => init + upgrade => upgrade + callPayable => call_payable + callNonPayable => call_non_payable + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {}